Changing both variables changes f by about Δz ≈ f_x Δx + f_y Δy: the graph is close to its tangent plane z = z₀ + f_x(x − x₀) + f_y(y − y₀). At a local maximum or minimum both partial derivatives vanish, so the tangent plane is horizontal; such points are critical points, and they can also be saddles. Completing squares shows that x² − 2xy + 3y² + 2x − 2y has a minimum at (−1, 0). Least squares fits the line y = ax + b to data by minimising the total square deviation D(a, b), which gives a 2 × 2 linear system for a and b.
fx tells how f changes when x changes a little, fy when y does. Changing both, the two effects add up, as if x changed first and then y. For z=f(x,y) (transcript, p. 1; notes, p. 1):
Approximation formula
Δz≈fxΔx+fyΔy
In words
capital delta z is approximately f sub x capital delta x plus f sub y capital delta y
It is one of the most important formulas about partial derivatives. It is only an approximation, for small Δx and Δy; there are higher-order terms with second and third derivatives (p. 1).
Why is the formula true? fx and fy are slopes of two lines tangent to the graph, in the slices parallel to the xz- and yz-planes. Writing a=fx(x0,y0) and b=fy(x0,y0), the two lines are (p. 1; notes, p. 1):
Two tangent lines
y=y0,z=z0+a(x−x0)andx=x0,z=z0+b(y−y0)
In words
y equals y nought, z equals z nought plus a the quantity x minus x nought, and x equals x nought, z equals z nought plus b the quantity y minus y nought
Two lines through a point determine a plane, the tangent plane to the graph (p. 1; notes, p. 1):
Tangent plane
z=z0+fx(x0,y0)(x−x0)+fy(x0,y0)(y−y0)
In words
z equals z nought plus f sub x ( x nought, y nought ) the quantity x minus x nought, all plus f sub y ( x nought, y nought ) the quantity y minus y nought
Holding y=y0 gives the first line, holding x=x0 the second. (The same plane comes out of the cross product of vectors along the two lines, as a normal vector, p. 1.) On the tangent planeΔz would equal fxΔx+fyΔy exactly; the approximation formula says that the graph is close to its tangent plane near the point (p. 1; notes, p. 1).
To minimise or maximise a function of one variable, set its derivative to zero. With several variables (p. 1): at a local minimum or maximum, bothpartial derivatives are zero. If fx=0 but fy=0, the point might be a minimum of the slice parallel to the x-axis, but changing y would still make f larger or smaller (pp. 1–2; notes, p. 1). And if both are zero, the approximation formula says f does not change to first order: only quadratic or higher terms remain. Equivalently, the tangent plane is horizontal, z= constant (p. 2; notes, p. 1).
Critical point
fx(x0,y0)=0andfy(x0,y0)=0
In words
f sub x ( x nought, y nought ) equals 0 and f sub y ( x nought, y nought ) equals 0
These conditions are necessary but not sufficient (p. 2). A critical point can be a local minimum (like x2+y2 at the origin; "local" because elsewhere the function may go lower), a local maximum, or a saddle point (like y2−x2): a mountain pass, where the ground is level but some directions go up and others down. Saddles have no counterpart in one variable (p. 2; notes, p. 1).
Take the lecture's example f(x,y)=x2−2xy+3y2+2x−2y (p. 2; notes, p. 1). Then fx=2x−2y+2 and fy=−2x+6y−2. Setting both to zero: adding the equations gives 4y=0, so y=0, and then 2x+2=0 gives x=−1. The only critical point is (−1,0) (p. 2; notes, p. 1). (A tip from the lecture: simplify two equations by combining them, but always keep two equations, p. 2.)
Is it a minimum? The general test comes next lecture; here completing the square works. x2−2xy starts (x−y)2, and 2x−2y=2(x−y) completes a second square (p. 2; notes, p. 2):
Completing the square
f(x,y)=(x−y)2+2y2+2(x−y)=(x−y+1)2+2y2−1≥−1
In words
f(x, y) equals the quantity x minus y, all squared plus 2 y squared plus 2 the quantity x minus y, equals the quantity x minus y plus 1, all squared plus 2 y squared minus 1 is greater than or equal to minus 1
Squares are never negative, so f≥−1, with equality only when x−y+1=0 and y=0: at the critical point(−1,0), which is therefore a minimum (pp. 2–3; notes, p. 2). (Auroux admits he built the example by expanding this form; in general things will not simplify so neatly, p. 2.)
In experimental science you measure pairs of numbers (x1,y1),…,(xn,yn) that lie roughly on a line, and want the best-fit liney=ax+b (transcript, p. 3; notes, p. 2). The unknowns are a and b, not x and y: the data are given numbers (p. 3). (Here a and b are the line's slope and intercept, no longer the partial derivatives of the tangent plane.)
"Best" needs a definition. The usual choice measures, for each data point, the vertical deviationyi−(axi+b) between the measured and the predicted value (often more relevant than perpendicular distance, since x and y may be in different units), and minimises the sum of the squares (p. 3; notes, p. 2):
Total square deviation
D(a,b)=i=1∑n(yi−(axi+b))2
In words
capital D (a, b) equals the sum from i equals 1 to n of the quantity y initial minus the quantity a x sub i plus b, all squared
Minimising the largest deviation instead would give too much weight to one bad measurement; squares make the line look right and, above all, make the minimisation simple (p. 3). Look for a critical point of D(a,b). By the chain rule (p. 3; notes, p. 2):
partial capital D over partial a equals the sum of 2 the quantity y initial minus the quantity a x sub i plus b, (- x sub i ) equals 0, partial capital D over partial b equals the sum of 2 the quantity y initial minus the quantity a x sub i plus b, (-1) equals 0
Dropping the factors −2 and collecting the a's and b's gives a 2 × 2 linear system for a and b, whose coefficients are just numbers computed from the data (p. 4; notes, p. 2):
The least-squares equations
(∑xi2)a+(∑xi)b=∑xiyi,(∑xi)a+nb=∑yi
In words
( the sum of x sub i squared )a plus ( the sum of x sub i )b equals the sum of x sub i y initial, ( the sum of x sub i )a plus n b equals the sum of y initial
The method is more general (p. 4; notes, p. 2). Exponential lawsy=ceax: minimising the square error directly gives equations that cannot be solved easily, but lny=lnc+ax is linear, so fit a straight line to lny against x, with b=lnc. The lecture's example is Moore's law: the number of transistors on a chip, which does not follow a line but does on a log plot, growing exponentially (doubling every 18 months or two years, depending on the version). Quadratic lawsy=ax2+bx+c: minimising the total square deviation gives a 3 × 3 linear system for a, b, c (p. 4; notes, p. 2).
Worked example
A tangent plane, and a line through four points
(a) Use the tangent plane of f(x,y)=x2y at (1,2) to estimate f(1.1,1.9). (b) Find the least-squares line through (0,1), (1,3), (2,4), (3,6), and its total square deviation.
(a) The tangent plane
f(1,2)=2, fx=2xy=4 and fy=x2=1, so the tangent plane is z=2+4(x−1)+(y−2). At (1.1,1.9): z=2+0.4−0.1=2.3. Exactly, f(1.1,1.9)=1.21×1.9=2.299.
(b) The sums
With n=4: ∑xi=6, ∑xi2=0+1+4+9=14, ∑yi=14, ∑xiyi=0+3+8+18=29. The system is 14a+6b=29 and 6a+4b=14.
(b) Solve
From the second equation b=3.5−1.5a; then 14a+21−9a=29, so 5a=8, a=1.6 and b=1.1: the line y=1.6x+1.1. Its deviations are −0.1, 0.3, −0.3, 0.1, so D=0.01+0.09+0.09+0.01=0.2.
In the tangent plane, the slope f_x(x₀, y₀); in least squares, the slope of the fitted line (or the rate in an exponential or quadratic law). Say it: “a”.
A way of multiplying two vectors that gives a third vector, at right angles to both, as long as the area of their parallelogram. Explained in Torque and the cross product.
The straight line that passes as close as possible to a set of data points, usually chosen by least squares. Explained in Graphs, straight lines and slope.
Of a relation or equation: using only first powers of the unknowns, so doubling the cause doubles the effect and effects simply add. Explained in Solving and rearranging formulas.
How fast and in which direction something moves: a vector whose length is the speed and whose direction is the direction of motion. Explained in Velocity, acceleration and Kepler's second law.
Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).