The derivative as the best linear approximation, in any dimension.
10 chapters written · 46 definitions · 60 theorems · builds on Unit 1, Unit 2, Unit 4
The story
The derivative of a function of many variables is a linear map: the best linear approximation near a point. Unit 2 made that idea precise; this unit uses it. Partial derivatives and the gradient (5.2) are pieces of the derivative, the Jacobian (5.3) is its matrix, and the chain rule (5.4) is matrix multiplication.
From there: Taylor's theorem and the Hessian decide maxima and minima using eigenvalues (5.6), the inverse and implicit function theorems say when equations can be solved locally (5.7), and Lagrange multipliers handle constraints (5.8). The unit ends with partial differential equations (5.9) and gradient descent (5.10).
Every theorem in the unit, in the order it is proved. Each one is used by the ones after it. The label says whether it is on the 375/376 exams (T), an Apostol extra (A), or beyond both (B).
Theorem · TBuilding continuous fields Sums, scalar multiples, dot products, norms and compositions of continuous fields are continuous; so are the coordinate functions, linear maps, polynomials, and quotients where the denominator is not zero.
Theorem · TThe gradient is the direction of steepest ascent If f′(a;y)=∇f(a)⋅y for all y and ∇f(a)=O, then among unit vectors u the rate f′(a;u) is largest, equal to ∥∇f(a)∥, for u=∇f(a)/∥∇f(a)∥, smallest for u=−∇f(a)/∥∇f(a)∥, and 0 for u perpendicular to ∇f(a).
Theorem · TThe gradient is perpendicular to level sets If f is differentiable at a and r is a curve in the level set f=c through a, then ∇f(a)⋅r′(t0)=0: the gradient is perpendicular to the tangent vector of every such curve.
Theorem · TThe chain rule for fields If g is differentiable at a and f is differentiable at b=g(a), then h=f∘g is differentiable at a and h′(a)=f′(b)∘g′(a); in matrices, Dh(a)=Df(b)Dg(a).
Theorem · TSecond derivative along a path If r is twice differentiable and f has continuous second partials, then dt2d2f(r(t))=∑i,jDjDif(r(t))ri′(t)rj′(t)+∇f(r(t))⋅r′′(t).
Lemma · AThe rectangle lemma If fx and fxy exist on an open set containing the rectangle with corners (a,b) and (a+h,b+k), then Δ(h,k)=hkfxy(ξ,η) for some point (ξ,η) strictly inside the rectangle.
Corollary · AOrder does not matter for C^k fields If f is of class Ck on an open set, then any two partial derivatives of order at most k that differentiate the same number of times in each variable are equal; in particular the matrix of second partials of a C2 field is symmetric.
Theorem · TSecond-order Taylor formula for scalar fields If f is C2 on a ball B(a,r) and ∥v∥<r, then f(a+v)=f(a)+∇f(a)⋅v+21vTHf(a+cv)v for some c∈(0,1), and also f(a+v)=f(a)+∇f(a)⋅v+21vTHf(a)v+∥v∥2E2(a,v) with E2(a,v)→0 as v→O.
Theorem · BInverse function theorem If F:U→Rn is continuously differentiable on an open set U and detDF(a)=0, then F has a continuously differentiable local inverse G near a, with DG(F(x))=DF(x)−1.
Theorem · TImplicit function theorem If F(x,y)=O at (a,b), F is continuously differentiable and the m×m matrix DyF(a,b) is invertible, then near (a,b) the equation defines exactly one y=g(x), it is continuously differentiable, and Dg(x)=−DyF−1DxF.
Corollary · TImplicit differentiation formulas Under the hypotheses of the implicit function theorem: dxdy=−FyFx; for F(x,y,z)=0, zx=−FzFx and zy=−FzFy; for two equations in u,v, ux=−∂(F,G)/∂(u,v)∂(F,G)/∂(x,v).
Corollary · BLevel sets near a regular point are graphs If a is a regular point of F:RN→Rm with F(a)=c, then near a the level set {F=c} is the graph of a C1 function of N−m of the coordinates, and its tangent vectors at a are exactly the vectors in the null space of DF(a).
Theorem · TLagrange multiplier theorem If f,g1,…,gm are C1, f has a local constrained extremum at a, and a is a regular point of g (the gradients ∇gi(a) are linearly independent), then ∇f(a)=∑λi∇gi(a) for unique numbers λi.
Theorem · BSecond-order test for constrained extrema At a regular point with multipliers λi: if vTHv>0 for all nonzero v in the tangent space then a is a strict local constrained minimum; if <0, a strict local maximum; a local minimum forces vTHv≥0 on the tangent space.
Corollary · BBordered determinant test in two variables For f(x,y) with one constraint g at a regular point: detB>0 means a strict local constrained maximum, detB<0 a strict local constrained minimum, where B is the 3×3 bordered Hessian.
Theorem · BThe multiplier is the price of the constraint If the constrained optimum x∗(c) depends differentiably on c and V(c)=f(x∗(c)), then V′(c)=λ(c): the multiplier is the rate at which the best value changes when the constraint g=c is moved.
Theorem · BPositive semidefinite Hessian implies convex If f is C2 on an open convex set and its Hessian is positive semidefinite everywhere, then f is convex; in particular 21xTAx−bTx is convex when A is symmetric positive semidefinite.
Theorem · Ad'Alembert's solution of the wave equation If F is twice differentiable and G is differentiable, then u(x,t)=21[F(x+ct)+F(x−ct)]+2c1∫x−ctx+ctG(s)ds solves utt=c2uxx with u(x,0)=F(x) and ut(x,0)=G(x); conversely every C2 solution on R2 has this form.
Theorem · BMean value property of harmonic functions If u is harmonic on an open set containing the closed disc of radius R about a, then u(a)=2π1∫02πu(a1+Rcosθ,a2+Rsinθ)dθ: the value at the centre is the average over the circle.
Corollary · BMaximum principle for harmonic functions If u is harmonic on a connected open set Ω and has a maximum (or a minimum) at a point of Ω, then u is constant. So a non-constant harmonic function on a bounded region, continuous up to the boundary, attains its largest and smallest values on the boundary only.
Lemma · BDescent lemma If ∇f is L-Lipschitz, then f(y)≤f(x)+∇f(x)⋅(y−x)+2L∥y−x∥2; consequently the step y=x−η∇f(x) with η≤L1 gives f(y)≤f(x)−2η∥∇f(x)∥2.
Theorem · BGradient descent on a quadratic For f(x)=21xTAx−bTx with A symmetric positive definite with eigenvalues in [μ,L], gradient descent converges to x∗=A−1b for every start if and only if 0<η<2/L; the error is multiplied by max(∣1−ημ∣,∣1−ηL∣) per step, which is smallest, equal to κ+1κ−1 with κ=L/μ, at η=L+μ2.
Corollary · BGradient descent is a contraction If f is C2 with μI⪯Hf(x)⪯LI everywhere on Rn and 0<η<2/L, then T(x)=x−η∇f(x) is a contraction with constant ρ=max(∣1−ημ∣,∣1−ηL∣)<1, so gradient descent converges to the unique minimiser x∗ and ∥xk−x∗∥≤1−ρρk∥x1−x0∥.
Theorem · BMomentum on a quadratic For a quadratic with eigenvalues in [μ,L], the heavy-ball method with η=(L+μ)24 and β=(κ+1κ−1)2 makes the error decay at the rate κ+1κ−1 (up to a factor polynomial in k).
Theorem · BNoise floor of stochastic gradient descent For the loss N1∑21(w−ai)2, whose minimiser is the mean aˉ, SGD with a fixed step η∈(0,2) has E[wk]−aˉ→0 but E[(wk−aˉ)2]→2−ηησ2, where σ2 is the variance of the ai; with steps ηk=k+11 the iterate is the running average and the error tends to 0.
Theorem · BQuadratic convergence of Newton's method If F(x∗)=O, JF(x∗) is invertible with ∥JF(x∗)−1∥≤β0 and JF is M-Lipschitz near x∗, then for ∥x0−x∗∥≤2β0M1 the Newton iterates satisfy ∥xk+1−x∗∥≤β0M∥xk−x∗∥2: the number of correct digits doubles at each step.
Proposition · BGradient descent near a saddle For f=21(ax2−γy2) with a,γ>0, gradient descent with step η has yk=(1+ηγ)ky0: it leaves the saddle exponentially fast but with a time of order ηγ1ln∣y0∣1, which is long when the negative curvature γ is small.
A mixed set of 12 quick checks drawn at random from the 77 in this unit's chapters. Each one says which chapter it comes from, so a miss tells you what to reread. Press "New set" for another mix.
Quick checkThe level sets of f(x,y)=x2+y2 are circles about the origin. What are the level sets of g(x,y)=exy for c>0?
exy=c is equivalent to xy=lnc, because et is one-to-one. For c=1 this is xy=0, the two coordinate axes. For c=e it is xy=1, a hyperbola in the first and third quadrants.
Quick checkA function f(x,y) is continuous in x for every fixed y, and continuous in y for every fixed x. Is f continuous as a function of (x,y)?
Continuity in each variable separately only controls f along the horizontal and vertical lines. Joint continuity controls f along every path, including the diagonal, where this function equals 21. This is exactly the question on the 375 final review.
Quick checkTo prove lim(x,y)→(0,0)f=0 a student checks that f→0 along y=mx for every m, and along both axes. What has the student proved?
There are paths that are not straight lines. The function x4+y2x2y passes this check and has no limit. A proof needs a bound free of the direction of approach, or an ε and δ argument.
Quick checkFor f(x,y)=arcsinx2+y2x, can we define f(0,0) so that f becomes continuous at the origin?
A continuous extension needs one limit, and two paths give 2π and −2π. (Along the y-axis the value is 0, a third number.) The limit at the origin does not exist, so no value works.
Quick checkFor a scalar field f:R3→R, in which space does the vector ∇f(a) live?
The gradient lists the n partial derivatives, one for each input direction, so it is a vector in the domain Rn. On a contour map it is an arrow drawn in the plane of the map, not a vector sticking out of the surface.
Quick checkYou walk along a contour line (a level curve) of a hill. What is your rate of climb, and how does the gradient sit relative to your path?
Along a level curve f does not change, so the rate of climb is 0. Since the rate in a direction u is ∇f⋅u, that means u⊥∇f. The gradient points straight up the slope, across the contour lines.
Quick checkSuppose f′(a;y) exists for every direction y. Which conclusion is justified?
The example above has all the directional derivatives and is discontinuous. What guarantees continuity is a stronger property, differentiability, which is the topic of 5.3.
Quick checkWhich of these is a correct implication for a scalar field at an interior point a?
Differentiable implies continuous, and implies that all directional derivatives exist: that is the theorem. 'Continuous implies differentiable' fails for ∥x∥ at the origin, and 'all directional derivatives exist implies continuous' fails for the field x2+y4xy2 of 5.2.
Quick checkWhich field is differentiable at the origin but has partial derivatives that are not continuous there?
Its error is at most ∥v∥2, so the total derivative is 0 and the field is differentiable. Its partials oscillate with growing amplitude near the origin, so they are not continuous. The other two are not differentiable at the origin: the cone has a corner, and x2+y2xy is not even continuous.
Quick checkFor f(x,y)=xy, the level curve through (1,1) is xy=1. In which direction does it run at (1,1)?
The gradient (1,1) points away from the origin, and the hyperbola xy=1 crosses the diagonal at a right angle at (1,1), so its direction is (1,−1) (slope −1: from y=1/x, y′=−1/x2=−1).
Your answerThe Jacobian determinant of the polar-coordinate map is r. At the point r=3, by what factor are small areas multiplied?
detJP=r=3. A tiny square of side ϵ in the (r,θ) plane has area ϵ2; its image in the (x,y) plane is nearly a rectangle with sides ϵ and 3ϵ, of area 3ϵ2.
Quick checkF(x)=x3 is a differentiable bijection of R onto R. What does the theorem say about its inverse G(y)=y1/3 at y=0?
If G were differentiable at 0, the chain rule applied to G(F(x))=x at x=0 would give G′(0)⋅F′(0)=1, impossible since F′(0)=0. Indeed y1/3 has a vertical tangent at 0. A bijection that is differentiable need not have a differentiable inverse; the theorem assumes it does.
Quick checkFor g(t)=f(X(t),Y(t)), what is dtd[fx(X(t),Y(t))]?
fx(X(t),Y(t)) is a composite field: it depends on t through the point. Its derivative is its gradient (fxx,fxy) dotted with the velocity (X′,Y′). Forgetting this is the most common error in second-derivative chain rule problems.
Quick checkIn the polar formula for hθθ there are terms −rcosθfx−rsinθfy with no second derivative. Where do they come from?
hθ=−rsinθfx+rcosθfy is a sum of products. The product rule differentiates each factor: the coefficients give the first-order terms, the partials fx, fy give the second-order ones.
Your answerHow many different third-order partial derivatives does a C3 function of three variables have, once the order of differentiation does not matter?
Count the ways to write 3 as a sum of three non-negative whole numbers.
A third-order partial is determined by how many of the three differentiations are in x, in y, in z: the non-negative solutions of a+b+c=3. There are (33+3−1)=(35)=10: fxxx,fyyy,fzzz,fxxy,fxxz,fyyx,fyyz,fzzx,fzzy,fxyz.
Your answerFor the same f, what is the limit of fxy(0,y) as y→0?
On the y-axis fxy(0,y)=(y2)3(−y2)(y4)=−1, whereas along the x-axis it is +1. The values of fxy and fyx at the origin (−1 and +1) are each the limit along one of the axes.
Quick checkBoth mixed partials of f=x2+y2xy(x2−y2) exist at the origin and are different. What does this tell us?
The theorem proved below needs continuity of the mixed partials at the point. This f is even C1, so it is differentiable at the origin, but it is not C2.
Quick checkWhich hypothesis at (a,b) guarantees fxy(a,b)=fyx(a,b)?
That is Schwarz's theorem. Existence of the mixed partials is not enough (Peano's function), and differentiability of f says nothing about its second partials: the Peano function is even C1, hence differentiable at 0.
Your answerPractice Final 2013, problem 2(b): what is the second-order estimate of f(34,35)? (Give a decimal or fraction.)
First find v=(1/3,−1/3), then vTHv=fxxv12+2fxyv1v2+fyyv22.
The step is v=(31,−31). The linear part is f(a)+∇f⋅v=1+32+31=2. The quadratic form is vTHv=3⋅91+2(−1)⋅31⋅(−31)+(−2)⋅91=31, half of it is 61, so the total is 2+61=613.
Quick checkTrue or false (a question of the Fall 2025 final): if the level sets of a scalar field f are not smooth curves, then f is not differentiable everywhere.
The gradient is perpendicular to the level set only where ∇f=O, and the level set is a smooth curve only under that same condition (the implicit function theorem, which comes later). For f=g(x)g(y) the gradient at the origin is O, so nothing forces the zero level set to be smooth there, even though f has derivatives of every order. Differentiability of f and smoothness of its level sets are different things.
Quick checkAt a critical point the Hessian has eigenvalues 5 and 0. What does the second-derivative test conclude?
A zero eigenvalue means the quadratic term vanishes in that direction, and then the cubic and quartic terms decide. x2+y4 has a minimum at the origin and x2−y4 a saddle, both with Hessian diag(2,0).
Quick checkWhich result of this section lets you say that a point is a saddle even if one eigenvalue of the Hessian is 0?
Part (c) only asks for one eigenvalue of each sign. The remaining eigenvalues, even 0, do not matter, because the proof walks along the two eigenvectors. For example x2−y2+z3 has eigenvalues 2,−2,0 and is a saddle.
Your answerWhat is the absolute maximum of f(x,y)=x2−2xy+2y on the rectangle [0,3]×[0,2]?
Check all four edges, including the corners, and the interior critical point.
The only interior critical point (1,1) has f=1. On the boundary, the bottom edge gives f=x2 up to 9 at (3,0), and no other edge exceeds it (the right edge starts at 9 and falls; the others stay at most 4).
Quick checkf is continuous on a closed disc and has no critical points in the open disc. Where are its maximum and minimum?
The disc is compact, so the extrema exist (4.3). If one were at an interior point it would be a critical point (5.2), but there are none. So both are on the boundary.
Quick checkWhich step of the inverse function theorem's proof uses completeness of Rn?
The mean value inequality and the invertibility of DF(x) are statements about derivatives. The existence of the solution is the fixed point, and a Cauchy sequence of iterates only has a limit because the closed ball is complete. In the rational numbers the iterates could converge to a hole.
Your answerOn the circle x2+y2=25, what is dxdy at (3,4)?
Use −Fx/Fy, and check the sign against the picture: at the top right of a circle the curve falls.
F=x2+y2−25, Fx=6, Fy=8 at (3,4), and dy/dx=−Fx/Fy=−86=−43. The tangent is perpendicular to the radius (3,4) (slope 34), and −43 is the negative reciprocal.
Quick checkF(x,y)=x−y3 has Fy(0,0)=0. Does the equation F=0 define y as a function of x near the origin?
The equation y3=x has exactly one real solution for each x, so a function exists. Its derivative 31x−2/3 blows up at 0. The theorem gives a differentiable function when Fy=0; when Fy=0 anything can happen.
Quick checkThe two equations F=0 and G=0 in the unknowns u,v (with x,y as parameters) can be solved for u,v near a solution when:
The block of the Jacobian for the unknowns must be invertible, that is its determinant is nonzero. The determinant with respect to the parameters x,y is irrelevant. Separate nonzero entries are not enough: [1111] has nonzero entries and determinant 0.
Quick checkYou solve ∇f=λ∇g with g=c and find exactly one solution. What else must you do before calling it the minimum?
The theorem is a necessary condition under the hypothesis ∇g=O. Points with ∇g=O are separate candidates (the cusp). A single candidate can be a maximum, a saddle of f on the constraint, or the only candidate of a problem with no minimum. The sign of λ has no meaning here.
Your answerWhat is the greatest distance from the origin to the curve 5x2+6xy+5y2=8?
On the ellipse xTAx=8, so ∥x∥2=8/(eigenvalue) along an eigenvector.
Along the eigenvector (1,−1) with eigenvalue 2: 2⋅∥(x,y)∥2=8 on the curve, so the squared distance is 4 and the distance 2. Along (1,1) with eigenvalue 8 it is 8/8=1.
Quick checkAt a candidate for the problem 'maximise f on g=c' the bordered determinant is detB=−6 (two variables, one constraint). What is the candidate?
By the corollary, vTHv=−detB=6>0 on the tangent line, so f increases in both directions along the constraint: a strict local minimum. The sign convention to remember: detB>0 maximum, detB<0 minimum.
Quick checkMinimise ∥x∥2 on the set Mx=c (an affine subspace). You solve 2x=MTλ, Mx=c and find one solution. What does the corollary say?
The Lagrangian ∥x∥2−λT(Mx−c) is convex in x, so the Lagrange point is an absolute minimum, with no existence argument and no Hessian. This minimum-norm solution is the pseudoinverse solution x=M+c of 3.4.
Quick checkWhich of these functions solves ut+3ux=0?
The general solution is g(x−3t), a profile moving right at speed 3. cos(x−3t) is of this form. ex+3t has ut+3ux=6u=0 (it moves left), and cosxcos3t is a standing wave, which solves utt=9uxx but not this first-order equation.
Quick checkA pulse travelling to the right along a string reaches a fixed end. What does the reflected pulse look like?
The solution is the odd extension, so the reflected pulse is the mirror image with the sign reversed, since the wall holds the string at height 0 and the incoming and outgoing pulses must cancel there. At a free end (no fixed height) the reflection would keep the sign.
Quick checkWhy can the heat equation not be run backwards in time?
Running time backwards reverses the sign of every decay rate, so the wiggly modes, which are the ones damped fastest forward in time, are amplified fastest backward. A measurement error of size 10−6 in mode n=10 becomes huge in a fraction of a second. The problem is ill-posed: the answer does not depend continuously on the data.
Quick checkA bounded function u is harmonic on the open unit disc, with boundary values tending to 1 on the upper half of the boundary circle and to 0 on the lower half (except at the two points where the data jumps). Which statement does the maximum principle give?
A non-constant harmonic function cannot have an interior maximum or minimum, so its values inside lie strictly between the smallest and largest boundary values. At the centre the mean value property on circles of radius close to 1 gives a value close to the average of the boundary values, 21.
Your answerFor gradient descent on f=21(x2+10y2), what is the largest learning rate η for which the iteration converges from every start?
The condition is η<2/L.
The Hessian is diag(1,10) with largest eigenvalue L=10, and the iteration converges if and only if η<2/L=0.2 (at η=0.2 the y-coordinate only flips sign forever).
Your answerA quadratic has Hessian eigenvalues 1 and 100. What is the best convergence factor per step (κ−1)/(κ+1) of gradient descent with a fixed step? (Give a decimal.)
κ=100, so ρ∗=10199≈0.9802. Each step removes only about 2% of the error.
Your answerWith the factor ρ=99/101 per step, about how many steps shrink the error by a factor of 106? (Give a decimal.)
We need ρk≤10−6, so k≥ln(101/99)ln106=0.02000113.8155≈690.8; the simulation in the lab below stops at step 691. For large κ, lnκ−1κ+1≈κ2, so the count is about 2κlnε1: proportional to the condition number.
Quick checkGradient descent on f=21(x2+100y2) uses η=0.025. What happens?
Smallness is relative to the curvature. The stability limit is 2/L with L=100, i.e. 0.02. At η=0.025 the y-coordinate is multiplied by −1.5 each step, so it grows without bound while flipping sign. Meanwhile x is multiplied by 0.975 and shrinks.
Quick checkWhich describes the zig-zag of gradient descent in a narrow valley?
At the best fixed step the multiplier along the steepest direction is −κ+1κ−1: exactly the same size as along the valley but with the opposite sign. The oscillation is the method working as designed, and the only cures are to change the geometry (precondition, momentum, or Newton's method).
Quick checkWhy does SGD with a constant learning rate not converge exactly to the minimiser?
The stochastic gradient is unbiased, so the average step is right. But at the minimiser ∇ℓ=O while the individual ∇ℓi are not, so each step adds a random kick of size η× (spread of the ∇ℓi). The theorem computes the resulting spread: ησ2/(2−η), proportional to η for small η.
Quick checkNewton's method is applied to f(x)=−x2+3 starting at x0=5. Where does it go?
f′=−2x, f′′=−2, so the Newton step is x−−2−2x=0. Newton solves f′=0 and does not care whether the solution is a minimum or a maximum. This is why it is combined with safeguards that check that the Hessian is positive definite.
Your answerIn the saddle example (ηγ=0.001, y0=10−6), about how many steps does gradient descent take for ∣y∣ to grow from 10−6 to 1? (Give a decimal.)
Quick checkAt a critical point of a loss with 106 parameters, the Hessian has 999,999 positive eigenvalues and one eigenvalue equal to −0.001. What is it, and what does gradient descent do near it?
A local minimum needs all eigenvalues non-negative (5.6). One negative eigenvalue makes it a saddle. The escape direction grows like (1+0.001η)k, which is slow because the curvature is small, so the loss curve plateaus, as in the saddle example.