Partial derivatives and the chain rule

22 min · 3 drills

In the textbook: Ch. 8.4 Die erste Ableitung8.5 Partielle Ableitungen zweiter Ordnung8.6 Globale Optimierung8.7 Kettenregel und implizite Funktionen

In the last article the bakery owner changed one thing at a time: now she hired a baker, now she bought an oven. That is exactly how a partial derivative arises. In real life, though, several things often change on the same day, and then the question is a different one: how do you add up their effects?

Take an ice-cream stand by the river. How many servings it sells in an hour depends on the weather and on the price. At noon, at 24 degrees and a price of 2.50 €, the stand sells 60 servings an hour. The forecast for three o'clock is 28 degrees, and the owner wants to raise the price to 2.70 €. How many servings an hour will he sell then?

From the past weeks he knows two things:

  • each extra degree, at the same price, brings about 5 servings an hour;
  • each extra 10 cents, in the same weather, costs about 3 servings.

That is enough to work it out:

What changes by 3 pmBy how muchSales per hour
Temperature4 degrees warmer20 servings more (4 times 5)
Price0.20 € higher6 servings fewer (2 times 3)
Together74 instead of 60 servings

The 5 servings per degree and the 3 servings per 10 cents are the two partial derivatives: each tells you what one quantity brings while the other stays as it is. When both change by three o'clock, you add up their contributions, as long as the steps are small. The rule for this is called the chain rule (“Kettenregel”): it tells you how fast the result changes when both quantities change over time.

In the exam, partial derivatives come up in three kinds of task. Each time they are worked out at a point, and the question is one of three:

  • By how much does the result change when only one quantity grows (like sales from one degree more)?
  • How fast does it change while both quantities change over time (like sales by three o'clock)?
  • How fast does it change when you go in a given direction, that is, change both quantities in a fixed ratio (this is the directional derivative, “Richtungsableitung”)?

The article “Functions of two variables” explains the partial derivative (“partielle Ableitung”) from the start, with a bakery as its example.

At a glance

The kiosk showed two of the three questions: what one quantity does and what both do when they change together. The overview below has all three questions and the Hessian matrix as well:

  • Partial derivative at a point

    How much does the function change if only one input rises (“Grenzproduktivität”, marginal product)? For output Q=c KαLβ from capital K and labour L the derivative by L equals β times Q/L.
    QL=β⋅QL

    Trap: differentiating by the wrong variable or forgetting the mixed derivative in the Hessian; it stands in both cells off the diagonal.

  • Chain rule along a curve

    Besides f(x,y), x(t) and y(t) are given; you are asked how fast f changes. Each input adds its part: fx times the speed x′(t), plus the same for y.
    ddtf(x(t),y(t))=fx⋅x′(t)+fy⋅y′(t)

    Trap: putting in x(t) itself instead of its speed x′(t); you take fx at the point of the curve and multiply by x′(t).

  • Directional derivative

    A point and a direction vector v are given (“Richtungsableitung”, directional derivative). You multiply the partial derivatives fx, fy by the coordinates v1, v2 and add.
    fv=fx v1+fy v2

    Trap: dividing by the length of the vector though the task does not ask for it; you take the vector as given.

Full list: Formula sheet and what to memorise.

Partial derivative at a point: marginal product

The owner of the kiosk knew the five servings per degree from past weeks. When a formula is given, you compute such a number yourself, and that is exactly what the first exam task asks for:

Exam-style task

Gegeben ist die Funktion

f(x,y)=5x2y2+7xy+7y2

Berechnen Sie die partielle Ableitung ∂f∂x an der Stelle (x,y)=(1,3).

  1. a)90
  2. b)111
  3. c)129
  4. d)68
  5. e)79

How to recognise the task. A function of two quantities and a point are given; you are asked how much the function changes if only one of the quantities grows: “Grenzproduktivität der Arbeit” (marginal product of labour) or ∂Q∂L.

For the Cobb-Douglas production function Q=c KαLβ (c is a number, α and β are the exponents of capital K and labour L) there is a short way:

QL=β⋅QL,QK=α⋅QK
  • Steps: Hold the other variable fixed → Differentiate → Evaluate at the point → Check.
  • Formula sheet (“Formelsammlung”, the printed sheet): not on it.
  • Memorise: Cobb-Douglas: QL=β⋅Q/L, QK=α⋅Q/K.

Derivative with respect to x: y is a fixed number.

y is fixed, so the term 7y2 without x gives 0.

fx=10x⋅y2+7y.

fx(1,3)=10⋅1⋅9+7⋅3=111.

If x rises from 1 to 1.01, f grows by about 111⋅0.01=1.11; the exact change is 1.1145.

A firm's output is Q(K,L)=40 K0.25L0.75, and the marginal product of labour is needed at K=81 and L=16. The curve in the figure is the slice at K=81, the output as a function of labour; the steps below find its slope at L=16, and the dashed tangent shows it.

Output at a fixed capital of 81 as a function of labour; tangent at L = 16 with slope 4508162432labour Loutput QK = 81: Q = 120 · L to the 0.75slope 45

K=81, 810.25=3, so Q=120 L0.75.

QL=120⋅0.75 L−0.25=90 L−0.25.

16−0.25=12, QL=90⋅12=45.

Q=40⋅3⋅8=960, 0.75⋅96016=45.

Three more cases:

  • the function contains exy or ln⁡(x+y): you need the chain rule for one variable (article on the derivative), (exy)x=y exy, (ln⁡(x+y))x=1x+y;
  • the second derivatives of such a function: (exy)xx=y2exy, (exy)xy=exy+xy exy (product rule);
  • a fraction uv: the quotient rule uxv−u vxv2 (article on the derivative).

Trap. Differentiating with respect to the wrong variable: QK=0.25⋅96081≈2.96 instead of 45.

Your turn1 of 3

The production function is Q(K,L)=25 K0.4L0.6. What is the marginal product of capital at K=243 and L=1024? Round to two decimal places.

Hessian matrix at a point: four second derivatives

The partial derivative showed how fast the function grows. Differentiate it once more and you see how that speed itself changes. The exam sometimes asks for all four such numbers at one point.

How to recognise the task. “Hesse-Matrix im Punkt” (Hessian matrix at the point) or ∂2f∂y2 (that is fyy): the second partial derivatives at a point are asked for.

The second-order partial derivatives (section “Second-order partial derivatives”) at a point go into the table

H=(fxxfxyfxyfyy),det⁡H=fxx⋅fyy−(fxy)2

For f=x3y−2xy2 at the point (1,2) the matrix is (12−5−5−4), the determinant 12⋅(−4)−25=−73.

Trap. Forgetting to square fxy in the determinant: −48−(−5)=−43 instead of −73.

How fast the function changes along a curve: chain rule

Up to here only one quantity changed at a time. At the kiosk from the introduction both the weather and the price changed by three o'clock. In the exam both quantities are given as functions of time:

Exam-style task

Gegeben sind

z(x,y)=4x2+3xy+3y2

und die Kurve x(t)=5+3t, y(t)=3+3t. Berechnen Sie die Ableitung von z(t)=f(x(t),y(t)) nach t an der Stelle t=0.

  1. a)99
  2. b)147
  3. c)246
  4. d)141
  5. e)172

How to recognise the task. Besides f(x,y), x(t) and y(t) are given: both quantities depend on a third one, usually time. You are asked how fast f changes, often “im Zeitpunkt t=0” (at the starting moment).

The formula and two examples below explain each line of the list.

  • Steps: Find the point of the curve → Partial derivatives there → Differentiate the curve → Put it together.
  • Formula sheet: c′(t)=f′(g(t))T⋅g′(t), that is fxx′+fyy′. On the sheet g(t) is the curve point (x(t),y(t)) and c(t) the value of f there.
  • Memorise: take fx, fy at the point (x(t),y(t)).
ddtf(x(t),y(t))=fx⋅x′(t)+fy⋅y′(t)

At t=0 the point on the curve can be read straight from the task.

x(0)=5, y(0)=3.

zx=8x+3y=40+9=49 and zy=3x+6y=15+18=33.

x′(t)=3 and y′(t)=3.

dzdt(0)=49⋅3+33⋅3=147+99=246.

Given f(x,y)=x2y+3y2, x(t)=2t+1 and y(t)=t2; the derivative with respect to t is needed at t=1.

t=1: x=3, y=1.

fx=2xy=6, fy=x2+6y=15.

x′(t)=2, y′(t)=2t=2.

6⋅2+15⋅2=42.

Trap. Putting in the values x(t), y(t) themselves instead of the derivatives of the curve: in the second example above this gives 6⋅3+15⋅1=33 instead of 42. Another mistake: taking the partial derivatives at (1,1) instead of at the point of the curve (3,1).

Your turn2 of 3

Given f(x,y)=xy2+2x, x(t)=t2 and y(t)=3t−1. What is the derivative of f(x(t),y(t)) with respect to t at t=1?

How fast the function changes in a given direction: directional derivative

In the chain rule two functions of time set the path. Sometimes only a step from the point is given, a vector, and the question is how fast the function changes in that direction:

Exam-style task

Die Höhe eines Hügels über dem Punkt (x,y) ist

h(x,y)=798−2x2+xy

Eine Wanderin steht über dem Punkt (2,4) und geht in Richtung (0.8,0.4) los. Wie groß ist die Richtungsableitung der Höhe dort?

  1. a)−2.4
  2. b)735.9
  3. c)798.0
  4. d)0.0
  5. e)−2.7

How to recognise the task. A point and a vector v are given: “Richtungsableitung in Richtung v⃗” (directional derivative in the direction of v⃗). Often the task says whether the vector is to be normalised (divided by its length).

The gradient ∇f=(fx,fy) is the pair of the two partial derivatives. The dot product (“Skalarprodukt”) of two pairs: multiply the first numbers, multiply the second numbers and add.

fv=∇f⋅v=fx v1+fy v2
  • Steps: Partial derivatives at the point → Take the direction → Multiply and add → Check whether to normalise.
  • Formula sheet (with the point a and the direction v): c′(0)=vT⋅f′(a), that is ∇f⋅v, and c′′(0)=vTf′′(a) v. This is the second derivative in the direction v; its formula is further below.
  • Memorise: ∇f=(fx,fy) at the point; divide by ∣v∣ only if the task asks for it.

The task with the hiker on the hill does not ask to normalise the vector, so (0.8,0.4) goes in as it stands.

hx=−4x+y, at the point (2,4) this is −4; hy=x, this is 2. The number 798 drops out when differentiating.

−4⋅0.8+2⋅0.4=−3.2+0.8=−2.4.

The minus sign means the height falls in this direction: the hiker walks downhill. The answer is −2.4.

Given f(x,y)=2x2+xy2, the point (1,2) and the direction v=(3,4). The figure shows the gradient and the direction vector, both starting at the point (1,2).

Gradient (8, 4) and direction vector (3, 4) at the point (1, 2)02468101234567xygradient (8, 4)v = (3, 4)(1, 2)dot product: 40

fx=4x+y2=8, fy=2xy=4, ∇f=(8,4).

v=(3,4), as given.

8⋅3+4⋅4=40.

The task does not ask to divide by the length: the answer is 40. With the length ∣v∣=5 it would be 40/5=8.

The second directional derivative (on the sheet c′′(0)): the Hessian at the point is multiplied by v on the right and on the left. For v=(v1,v2) this gives fvv=fxxv12+2fxyv1v2+fyyv22. In the second example above, with v=(3,4) at the point (1,2), fxx=4, fxy=2y=4, fyy=2x=2, so fvv=36+96+32=164.

Trap. Dividing by ∣v∣ without being asked (8 instead of 40), or swapping the components of the vector.

Your turn3 of 3

Find the directional derivative fv=∇f⋅v of the function f(x,y)=x2y+3y at the point (2,1) for v=(1,2).

Percentage change and homogeneity

All the tasks above answered in the units of the function itself: servings, pieces, money. Sometimes the change is needed in percent, like the elasticity of a function of one variable. Partial elasticity and homogeneity are worked through in the step-by-step block below. The total differential is explained in the section “The total differential”.

Formula sheet and what to memorise

The chain rule and the directional derivative are on the sheet, but in vector notation, with rows and columns. Next to each line is how it looks in our letters.

On the formula sheet:

  • chain rule along a curve c′(t)=f′(g(t))T⋅g′(t), that is fxx′+fyy′: section “How fast the function changes along a curve”
  • directional derivative vT⋅f′(a), that is ∇f⋅v, and second directional derivative vTf′′(a) v: section “How fast the function changes in a given direction”
  • elasticity f′(x)⋅xf(x) (in the part on differential calculus): with fx instead of f′ this is the partial elasticity

Memorise yourself:

  • fx: differentiate with respect to x, treat y as a number; a sum term by term (section “Partial derivative at a point: marginal product”)
  • Cobb-Douglas Q=c KαLβ: QL=β⋅Q/L, QK=α⋅Q/K (section “Partial derivative at a point: marginal product”)
  • Hessian matrix at the point: fxx, fxy in the first row, fxy, fyy in the second; det⁡H=fxxfyy−(fxy)2 (section “Hessian matrix at a point: four second derivatives”)
  • in the chain rule, take the partial derivatives at the point (x(t),y(t)) (section “How fast the function changes along a curve”)
  • normalise v only if the task asks for it (section “How fast the function changes in a given direction”)

Cards to memorise

Tap a card to see the formula. All topic cards

Formula

Q=c KαLβ: what are QL and QK in short form?

Formula

What is the Hessian determinant D of f(x,y)?

Now practise it

Partial derivatives and the chain rule

Trainer · Functions of several variables

Practise
Next: Extrema in two variables and maximum profit
0/3

Was this article helpful?