tree-diagram chain rule
When a function depends on intermediate variables that themselves depend on other variables, the multivariable chain rule can sprout many terms, and it is dangerously easy to lose one. The tree diagram is a simple drawing — a piece of bookkeeping, not new theory — that guarantees you write down exactly the right sum.
You draw the final quantity at the top, branch down to each variable it directly depends on, then branch again from those to the variables they depend on, and so on until you reach the independent variables. To compute the derivative of the top with respect to a chosen bottom variable, you list every distinct path from top to that variable; along each path you multiply the (partial) derivatives written on the branches; then you add the products of all the paths. In short: multiply along each branch, add across the branches. Every term in the chain rule corresponds to exactly one root-to-leaf path, so if your diagram has three paths reaching t, your formula has three terms.
The tree is the antidote to the single most common chain-rule mistake — dropping a pathway — and it scales gracefully to messy real situations: a thermodynamic potential depending on temperature and volume, which depend on time; a loss function depending on weights through several layers of a network. The same multiply-along, add-across discipline that organizes a homework problem is, structurally, exactly the reverse-mode automatic differentiation that trains modern machine-learning models.
Let w = f(x, y), with x = g(s, t) and y = h(s, t). Two paths reach s (through x and through y), so partial w / partial s = (partial f / partial x)(partial x / partial s) + (partial f / partial y)(partial y / partial s) — one term per root-to-leaf path.
Two branches reach s, so the formula has two terms — the tree makes the count impossible to get wrong.
The tree organizes terms but cannot tell you whether a variable is held fixed or allowed to vary. In thermodynamics especially, you must state which variables are independent, or the same symbol partial f / partial x can mean two different things.