Part 0 · The Toolkit — Chapter 0.6

Multivariable Calculus

One equation from Chapter 0.1, with a vector in it. Everything else is consequences.

Where we are

This entire chapter is one substitution. Take the equation that Chapter 0.1 built the book on,

f(a+h)  =  f(a)+f(a)h+o(h), f(a+h) \;=\; f(a) + f'(a)\,h + o(h),

and let hh be a vector and f(a)f'(a) a linear map (Chapter 0.4). That is it. That is the whole idea.

Partial derivatives, the gradient, the chain rule as a product of matrices, the Hessian, Lagrange multipliers and the Jacobian determinant are all consequences of that one move. This chapter derives them in that order.

This is the promised payoff for a decision made on the first page. Chapter 0.1 insisted, at some cost in apparent pedantry, that the derivative is the coefficient of the best linear approximation and not a slope. Had we defined it as a slope, we would now be stuck. There is no such thing as "the slope" of a function of three variables. There are infinitely many of them, one per direction, and nothing to choose between them. There is exactly one best linear approximation. The general definition costs us nothing extra here, and the special one would have cost us the chapter.

One section, §4, is more important than it looks. It observes that the gradient is not really a vector, and that turning it into one requires an inner product you did not notice yourself using. That quiet step stops being invisible the moment you leave Cartesian coordinates. You will meet your first covector there, and Chapters 2.4, 3.2 and 3.3 are built on it.

Tools you'll need  — Chapter 0.1: the derivative as a linear approximation, the o(h)o(h) bookkeeping, the chain rule as composition. Chapter 0.3: Taylor's theorem with remainder, used once in §6. Chapter 0.4: linear maps, their matrices in a basis, composition as matrix multiplication, and the determinant as a signed volume scaling factor. Chapter 0.5: inner products, Cauchy–Schwarz with its equality condition, orthogonal projection, and the spectral theorem for symmetric matrices. Chapters 0.4 and 0.5 are not decoration here. Sections 3, 6 and 7 each cash a specific theorem from them.

1 · Partial derivatives, and the trap

Let's start with the move everybody makes first. When a function has several inputs, freeze all but one of them and differentiate in the survivor. Let f:RnRf:\R^{n}\to\R and let e1,,en\vv e_{1},\ldots,\vv e_{n} be the standard basis. The partial derivative of ff with respect to xix^{i} at a\vv a is

fxi(a)    if(a)  =  limt0f(a+tei)f(a)t. \pdv{f}{x^{i}}(\vv a) \;\equiv\; \partial_{i}f(\vv a) \;=\; \lim_{t\to0}\frac{f(\vv a + t\,\vv e_{i}) - f(\vv a)}{t}. (0.6.1)

Nothing new is happening here. Restricted to the line a+tei\vv a + t\,\vv e_{i}, the function ff is a function of the single variable tt, and (0.6.1) is Chapter 0.1's definition applied to it. Every rule you already have applies verbatim: product, quotient, chain. The reason is that during the computation the other variables are literally constants. So x(x2y3)=2xy3\partial_{x}(x^{2}y^{3}) = 2xy^{3} and y(x2y3)=3x2y2\partial_{y}(x^{2}y^{3}) = 3x^{2}y^{2}, and there is no technique to learn.

The trap is that this feels like it ought to be the whole story, and it is not. Partial derivatives are a genuinely weaker notion than differentiability, and the gap between the two is not subtle. Here is the example that shows how wide it is.

The counterexample to have permanently

Define

f(x,y)=xyx2+y2for (x,y)(0,0),f(0,0)=0. f(x,y) = \frac{xy}{x^{2}+y^{2}} \quad\text{for }(x,y)\neq(0,0),\qquad f(0,0)=0.

Both partial derivatives exist at the origin, and both are zero. But ff is not continuous at the origin. It does not even have a limit there.

Check the partials first. Along the xx-axis, f(x,0)=0/(x2)=0f(x,0) = 0/(x^{2}) = 0 for every xx, so the function tf(t,0)t\mapsto f(t,0) is identically zero and its derivative at t=0t=0 is 00. Hence xf(0,0)=0\partial_{x}f(0,0)=0, and by the symmetry f(x,y)=f(y,x)f(x,y)=f(y,x) also yf(0,0)=0\partial_{y}f(0,0)=0. Both partials exist, are finite, and are perfectly well behaved.

Now let's do the thing the partial derivatives never do, which is to approach the origin along some other direction. Take the diagonal y=xy=x. For x0x\neq0,

f(x,x)  =  xxx2+x2  =  x22x2  =  12, f(x,x) \;=\; \frac{x\cdot x}{x^{2}+x^{2}} \;=\; \frac{x^{2}}{2x^{2}} \;=\; \tfrac12, (0.6.2)

a constant. So f12f\to\tfrac12 along the diagonal and f0f\to0 along the axes. Two different limits mean there is no limit at all, so ff is not continuous at the origin. And a function that is not continuous at a point certainly does not have a good linear approximation there.

It is worth seeing why the function is so badly behaved, because the reason is geometrical rather than algebraic. We want the distance from the origin and the direction of approach to appear as separate quantities, so switch to polar coordinates. Write x=rcosθx=r\cos\theta and y=rsinθy=r\sin\theta. Then

f  =  rcosθrsinθr2  =  cosθsinθ  =  12sin2θ. f \;=\; \frac{r\cos\theta\cdot r\sin\theta}{r^{2}} \;=\; \cos\theta\sin\theta \;=\; \tfrac12\sin 2\theta. (0.6.3)

Let's look at what that line is actually saying. The radius has cancelled completely, so ff depends only on the direction of approach and never on the distance. Every value in [12,12][-\tfrac12,\tfrac12] is attained arbitrarily close to the origin, on some ray or other.

Now notice where the two coordinate axes sit in that picture. They happen to be rays on which ff vanishes. The partial derivatives look along exactly those two rays, and so they see nothing wrong. They are two samples from a circle's worth of behaviour.

That is the honest indictment. Partial derivatives probe nn lines through a point. A function has infinitely many directions available to it, and it can misbehave in all the ones you didn't check.

So we need a definition that constrains the function's behaviour in every direction at once, and constrains it uniformly. Chapter 0.1 already wrote that definition down. We only have to let the displacement be a vector.

In plain terms 0.6.1

Freezing every input but one and differentiating in the survivor is the obvious opening move, and it behaves exactly as it did with a single variable, since the frozen inputs are literally constants while the calculation is going on. No new technique is required. There is a trap, though, and it is not a subtle one.

Such derivatives look along the coordinate axes and nowhere else. A point in a plane has a whole circle of directions leading away from it, and a function is at liberty to behave one way along the two axes you inspected and quite differently along everything between them. The standard example has a value depending only on the direction of approach and not at all on the distance travelled, so that it is zero along both axes, a different constant along the diagonal, and every intermediate value on some ray or other. It has no limit at the origin and is not continuous there, and its two axis derivatives exist, are finite, and report nothing amiss.

The moral concerns what a definition must achieve rather than what your daily calculations look like. Sampling finitely many lines cannot control a function, so the honest definition has to constrain every direction at once and constrain them uniformly. That definition was written down in the first chapter, and it needs exactly one alteration.

2 · The total derivative

Here is the definition the rest of the chapter runs on. Let f:RnRmf:\R^{n}\to\R^{m}.

Definition — the total derivative

ff is differentiable at a\vv a if there exists a linear map Df(a):RnRm\mathrm{D}f(\vv a):\R^{n}\to\R^{m} such that

f(a+h)  =  f(a)  +  Df(a)h  +  o(h), f(\vv a + \vv h) \;=\; f(\vv a) \;+\; \mathrm{D}f(\vv a)\,\vv h \;+\; o(\abs{\vv h}), (0.6.4)

where, exactly as in Chapter 0.1, "o(h)o(\abs{\vv h})" means a remainder R(h)R(\vv h) with R(h)/h0\abs{R(\vv h)}/\abs{\vv h}\to 0 as h0\vv h\to\vv 0. The map Df(a)\mathrm{D}f(\vv a) is the total derivative, or the differential, of ff at a\vv a.

Compare it with the one-variable equation letter by letter. The point aa became a\vv a, and the displacement hh became h\vv h. The number f(a)f'(a) became the linear map Df(a)\mathrm{D}f(\vv a), and "multiply by f(a)f'(a)" became "apply the linear map". Multiplication by a number is exactly what a linear map RR\R\to\R does, so the old definition is the case n=m=1n=m=1 of the new one rather than an analogy to it.

Notice how much stronger this is than §1. The limit is over h0\vv h\to\vv 0 with no restriction on direction, so the approximation has to hold uniformly as h\vv h approaches zero any way at all. That includes along spirals, and along the diagonal that broke the counterexample.

One consequence is immediate. Differentiability at a\vv a forces continuity at a\vv a: as h0\vv h\to\vv 0 the right-hand side of (0.6.4) tends to f(a)f(\vv a), because a linear map sends 0\vv 0 to 0\vv 0 and is continuous.

2.1 · There is only one such map

The definition says "there exists". It is worth two lines to check that it cannot exist twice, because otherwise "the derivative" would be an abuse of language.

Suppose AA and BB both satisfy (0.6.4). Subtracting the two statements, the function values cancel and we are left with (AB)h=o(h)(A-B)\vv h = o(\abs{\vv h}). Our goal is to show that the map ABA-B kills every vector. So fix any direction u\vv u with u=1\abs{\vv u}=1, put h=tu\vv h = t\vv u for small t>0t\gt0, and see what the oo statement becomes. By linearity (AB)(tu)=t(AB)u(A-B)(t\vv u) = t\,(A-B)\vv u, so

(AB)(tu)tu  =  t(AB)ut  =  (AB)u. \frac{\abs{(A-B)(t\vv u)}}{\abs{t\vv u}} \;=\; \frac{t\,\abs{(A-B)\vv u}}{t} \;=\; \abs{(A-B)\vv u}. (0.6.5)

The left side must tend to 00 as t0t\to0. The right side does not depend on tt at all. A constant that tends to zero is zero, so (AB)u=0(A-B)\vv u = \vv 0 for every u\vv u, and therefore A=BA=B. The derivative, when it exists, is unique.

Note the mechanism, because we will reuse it. The linearity did all the work, by letting us pull the small parameter out in front and cancel it.

2.2 · Its matrix is the Jacobian

Df(a)\mathrm{D}f(\vv a) is a linear map, so by Chapter 0.4 it has a matrix once we fix bases. The recipe for that matrix is worth restating: the jj-th column is the image of the jj-th basis vector. So our goal is to find out what the map does to each ej\vv e_{j}, and the way to find out is to feed basis vectors into the definition. Put h=tej\vv h = t\,\vv e_{j} in (0.6.4):

f(a+tej)  =  f(a)+tDf(a)ej+o(t), f(\vv a + t\,\vv e_{j}) \;=\; f(\vv a) + t\,\mathrm{D}f(\vv a)\vv e_{j} + o(t), (0.6.6)

where we used Df(a)(tej)=tDf(a)ej\mathrm{D}f(\vv a)(t\vv e_{j}) = t\,\mathrm{D}f(\vv a)\vv e_{j} by linearity. We want the column Df(a)ej\mathrm{D}f(\vv a)\vv e_{j} on its own, so rearrange and divide by tt:

f(a+tej)f(a)t  =  Df(a)ej+o(t)t  t0  Df(a)ej. \frac{f(\vv a + t\,\vv e_{j}) - f(\vv a)}{t} \;=\; \mathrm{D}f(\vv a)\vv e_{j} + \frac{o(t)}{t} \;\xrightarrow[t\to0]{}\; \mathrm{D}f(\vv a)\vv e_{j}. (0.6.7)

Look at the left-hand side. Componentwise, it is exactly the definition (0.6.1) of the partial derivative with respect to xjx^{j}. So the jj-th column of the matrix of Df(a)\mathrm{D}f(\vv a) is the column of partials jf1,,jfm\partial_{j}f^{1},\ldots,\partial_{j}f^{m}. Collecting the columns side by side gives the matrix a name, the Jacobian:

Df(a)    (1f1nf11fmnfm),[Df]ij=fixj. \mathrm{D}f(\vv a) \;\longleftrightarrow\; \begin{pmatrix} \partial_{1}f^{1} & \cdots & \partial_{n}f^{1}\\ \vdots & \ddots & \vdots\\ \partial_{1}f^{m} & \cdots & \partial_{n}f^{m}\end{pmatrix}, \qquad \big[\mathrm{D}f\big]^{i}{}_{j} = \pdv{f^{i}}{x^{j}}. (0.6.8)

Read the shape off it. There are mm rows, one per output component, and nn columns, one per input direction. A map R3R2\R^{3}\to\R^{2} therefore has a 2×32\times3 Jacobian. There is never any doubt about which way round it goes, because a matrix acting on a column vector in Rn\R^{n} must have nn columns.

So the partials do reconstruct the derivative, once you know the derivative exists. That qualifier is the entire content of §1. The logic runs one way only:

differentiable at a    all partials exist at a, \text{differentiable at }\vv a \;\Longrightarrow\; \text{all partials exist at }\vv a, (0.6.9)

and the converse is false, by (0.6.3). What rescues the converse is one extra hypothesis. This is the one theorem in the chapter we will quote in the main text rather than prove there:

Theorem — proved in the grind box below

If all the partial derivatives jfi\partial_{j}f^{i} exist in a neighbourhood of a\vv a and are continuous at a\vv a, then ff is differentiable at a\vv a, and Df(a)\mathrm{D}f(\vv a) is the Jacobian (0.6.8).

Here is why it is safe to lean on that theorem. Every function you will differentiate in this book is built from polynomials, exponentials, logarithms and trigonometric functions by arithmetic and composition. The partials of such a thing are again of the same type, and they are continuous wherever they are defined. So in practice you compute the partials, observe that they are continuous, and conclude that the Jacobian really is the derivative.

That tells you how to read the counterexample of §1. It is not a warning about your daily calculations. It is a warning about what the definition has to be if the theorems are going to come out true. As for the proof, we have put it below rather than here because it needs the mean value theorem from Chapter 0.2 and adds nothing to the picture. It is written out in full, because this book does not say "it can be shown".

Grind box — the boundedness lemma, and continuous partials ⇒ differentiable

Lemma (linear maps are bounded). For any linear A:RnRmA:\R^{n}\to\R^{m} there is a constant CC with AvCv\abs{A\vv v}\le C\abs{\vv v} for all v\vv v.

Proof. Write v=iviei\vv v = \sum_{i}v^{i}\vv e_{i}, so Av=iviAeiA\vv v = \sum_{i}v^{i}A\vv e_{i}. By the triangle inequality and then Cauchy–Schwarz (Chapter 0.5) applied to the two lists of numbers vi\abs{v^{i}} and Aei\abs{A\vv e_{i}},

Av    iviAei    (i(vi)2)1/2 ⁣(iAei2)1/2  =  Cv \abs{A\vv v} \;\le\; \sum_{i}\abs{v^{i}}\,\abs{A\vv e_{i}} \;\le\; \left(\sum_{i}(v^{i})^{2}\right)^{1/2}\!\left(\sum_{i}\abs{A\vv e_{i}}^{2}\right)^{1/2} \;=\; C\abs{\vv v}

with C=(iAei2)1/2C=\big(\sum_{i}\abs{A\vv e_{i}}^{2}\big)^{1/2}, a number depending only on AA. ∎

This innocuous fact is used constantly and silently. It is what lets us say Df(o(h))=o(h)\mathrm{D}f\big(o(\abs{\vv h})\big) = o(\abs{\vv h}), meaning that a linear map does not turn a negligible displacement into a non-negligible one. It is also where finite-dimensionality enters. In infinite dimensions (Chapter 4.4) linear maps can be unbounded, ddx\dv{}{x} being the standard offender, and a great deal of quantum mechanics' technical difficulty descends from exactly that.

Theorem. If the partials of ff exist near a\vv a and are continuous at a\vv a, then ff is differentiable at a\vv a.

Proof for n=2n=2, m=1m=1. The general case is the same argument with more terms. Write a=(a,b)\vv a=(a,b) and h=(h,k)\vv h=(h,k). We want to reach a one-variable situation, where the mean value theorem is available, so split the total change into two moves, one along each axis, by adding and subtracting the corner value:

f(a+h,b+k)f(a,b)=[f(a+h,b+k)f(a,b+k)]move in x+[f(a,b+k)f(a,b)]move in y. f(a+h,b+k)-f(a,b) = \underbrace{\big[f(a+h,b+k)-f(a,b+k)\big]}_{\text{move in }x} + \underbrace{\big[f(a,b+k)-f(a,b)\big]}_{\text{move in }y}.

Each bracket changes only one variable, so each is a one-variable increment and the mean value theorem of Chapter 0.2 applies to it. There exist θ1,θ2(0,1)\theta_{1},\theta_{2}\in(0,1) with

f(a+h,b+k)f(a,b)=hxf(a+θ1h,b+k)  +  kyf(a,b+θ2k). f(a+h,b+k)-f(a,b) = h\,\partial_{x}f(a+\theta_{1}h,\,b+k) \;+\; k\,\partial_{y}f(a,\,b+\theta_{2}k).

Now use continuity of the partials at (a,b)(a,b): both evaluation points converge to (a,b)(a,b) as (h,k)(0,0)(h,k)\to(0,0), so we may write xf(a+θ1h,b+k)=xf(a,b)+ε1\partial_{x}f(a+\theta_{1}h,b+k) = \partial_{x}f(a,b)+\varepsilon_{1} and yf(a,b+θ2k)=yf(a,b)+ε2\partial_{y}f(a,b+\theta_{2}k) = \partial_{y}f(a,b)+\varepsilon_{2} with ε1,ε20\varepsilon_{1},\varepsilon_{2}\to0. Then

f(a+h)f(a)=hxf(a)+kyf(a)linear in h  +  hε1+kε2remainder, f(\vv a+\vv h)-f(\vv a) = \underbrace{h\,\partial_{x}f(\vv a) + k\,\partial_{y}f(\vv a)}_{\text{linear in }\vv h} \;+\; \underbrace{h\varepsilon_{1}+k\varepsilon_{2}}_{\text{remainder}},

and since hh\abs{h}\le\abs{\vv h} and kh\abs{k}\le\abs{\vv h},

hε1+kε2h    ε1+ε2    0. \frac{\abs{h\varepsilon_{1}+k\varepsilon_{2}}}{\abs{\vv h}} \;\le\; \abs{\varepsilon_{1}}+\abs{\varepsilon_{2}} \;\longrightarrow\; 0 .

That is exactly (0.6.4) with the Jacobian as the linear map. ∎

Now let's see where the counterexample of §1 fails this test. Its partials do exist away from the origin. But a short computation from (0.6.3) shows that they blow up like 1/r1/r as you approach it, so they are nowhere near continuous at the origin. The hypothesis is not decorative.

⚠ Why this isn't obvious

The symbol fx\pdv{f}{x} hides a choice, and the notation gives you no warning that it has done so. In one variable there is nothing to hold fixed, so dfdx\dv{f}{x} is unambiguous. In several variables the phrase "differentiate with respect to xx" is incomplete until you say along which direction. That is the same as saying what is being held constant, and the symbol does not say it.

Here is the cleanest possible demonstration, with no physics in it. Take the function f=yf = y on the plane, and describe the plane in two ways: by coordinates (x,y)(x,y), and by coordinates (x,z)(x,z) where z=x+yz = x+y. Both are legitimate coordinate systems, and both contain a coordinate called xx. Now differentiate ff with respect to that xx in each of them:

(fx)y=xy=0,while(fx)z=x(zx)=1. \left(\pdv{f}{x}\right)_{y} = \pdv{}{x}\,y = 0, \qquad\text{while}\qquad \left(\pdv{f}{x}\right)_{z} = \pdv{}{x}(z-x) = -1.

Same function, same symbol /x\partial/\partial x, answers 00 and 1-1. Nothing has gone wrong here. The two derivatives are taken along different directions. One runs along the line y=consty=\text{const} and the other along the line z=constz=\text{const}, and there is no reason for them to agree. The subscript is not fussiness. Without it the expression is not defined.

This is why thermodynamics is written the way it is. From the first law dU=TdSpdV\dd U = T\,\dd S - p\,\dd V, holding SS fixed gives (UV)S=p\left(\pdv{U}{V}\right)_{S} = -p. But for an ideal gas the internal energy depends only on temperature, which is what Joule's free-expansion experiment showed, so (UV)T=0\left(\pdv{U}{V}\right)_{T} = 0. For air at atmospheric pressure the first is about 105Jm3-10^{5}\,\mathrm{J\,m^{-3}} and the second is exactly zero. Two genuinely different numbers wear the same-looking symbol, and generations of students have lost marks to the difference.

Now notice what the total derivative does to this problem. It dissolves it. Df(a)\mathrm{D}f(\vv a) is a single object that eats all displacement vectors at once and returns the corresponding first-order change. It does not privilege any direction, so there is nothing to hold fixed and nothing to suppress.

The ambiguity was never in the mathematics. It was in the decision to decompose a directionless object along a basis and then forget which basis. That is a second argument for treating Df\mathrm{D}f rather than the partials as the fundamental object, independent of the first one in §1. The partials are its components, and components always presuppose a basis.

In plain terms 0.6.2

Here a decision taken on the first page pays for itself, and the debt is worth naming as it is settled. The derivative was defined as the coefficient of the best straight-line stand-in for a function rather than as the slope of a graph, at some cost in apparent fussiness. There is no such thing as the slope of a function of three inputs: there are infinitely many, one per direction, and no principle for preferring any. There is exactly one best linear stand-in. Let the displacement be a vector and the coefficient a linear map, and the definition transfers unchanged.

Everything downstream is a consequence of that substitution. The map, where it exists, is unique, and its array is the table of partial derivatives arranged with one row for each output and one column for each input direction. So the partial derivatives do rebuild the whole derivative, but only once its existence is known by some other route, which is what the trap was there to establish.

A second dividend is easy to overlook. The symbol for a partial derivative conceals which quantity was held fixed, and different choices give genuinely different numbers, as anyone who has lost marks in thermodynamics can attest. The total derivative accepts every displacement at once, so it has nothing to hold fixed and the ambiguity never arises.

3 · The gradient

Now let's specialise to a scalar-valued function, meaning m=1m=1. This is the case physics uses most: a temperature field, a potential, an action, a log-likelihood. Here Df(a):RnR\mathrm{D}f(\vv a):\R^{n}\to\R is a linear map into the reals, which is called a linear functional. In Chapter 0.4's terms it is a linear map whose target happens to be one-dimensional. Its matrix is therefore a single row, (1f    nf)\big(\partial_{1}f\;\cdots\;\partial_{n}f\big).

A row of numbers looks like a vector lying on its side, and the temptation to stand it up is irresistible. Give in to it. But notice the step as you take it, because §4 is about what it costs. Standing the row up means pairing it with a column, and pairing needs a dot product, so use the standard inner product of Chapter 0.5 to define the gradient f(a)\nabla f(\vv a) as the unique vector satisfying

Df(a)h  =  f(a)hfor every h. \mathrm{D}f(\vv a)\,\vv h \;=\; \nabla f(\vv a)\cdot\vv h \qquad\text{for every }\vv h. (0.6.10)

That says what f\nabla f does, and now we want its components. They follow by feeding in basis vectors, exactly as in §2.2. Taking h=ei\vv h=\vv e_{i} gives fei=if\nabla f\cdot\vv e_{i} = \partial_{i}f, and the left side of that is the ii-th component of f\nabla f. So

f  =  (1f,  2f,  ,  nf). \nabla f \;=\; \big(\partial_{1}f,\;\partial_{2}f,\;\ldots,\;\partial_{n}f\big). (0.6.11)

3.1 · Steepest ascent, derived from Cauchy–Schwarz

Let's ask the natural question. In which direction does ff increase fastest? To answer it we first have to say what "rate of increase in a direction" means. For a unit vector u^\hat u, the directional derivative is the rate of change of ff along u^\hat u,

Du^f(a)  =  limt0f(a+tu^)f(a)t  =  Df(a)u^  =  fu^, D_{\hat u}f(\vv a) \;=\; \lim_{t\to0}\frac{f(\vv a+t\hat u)-f(\vv a)}{t} \;=\; \mathrm{D}f(\vv a)\hat u \;=\; \nabla f\cdot\hat u, (0.6.12)

The middle equality there is (0.6.4) with h=tu^\vv h = t\hat u, divided by tt, in the limit. It is the same computation as (0.6.7), with an arbitrary direction in place of a basis vector.

So the question has become a question about a dot product: over all unit u^\hat u, which one maximises fu^\nabla f\cdot\hat u? That is precisely the question Cauchy–Schwarz answers, and we proved it in Chapter 0.5. For any two vectors,

pq    pq,with equality iff pq. \abs{\vv p\cdot\vv q} \;\le\; \abs{\vv p}\,\abs{\vv q}, \qquad\text{with equality iff }\vv p\parallel\vv q. (0.6.13)

We want a bound on fu^\nabla f\cdot\hat u, so apply that with p=f\vv p = \nabla f and q=u^\vv q = \hat u, remembering that u^=1\abs{\hat u}=1 makes the right-hand side collapse:

f    fu^    +f. -\abs{\nabla f} \;\le\; \nabla f\cdot\hat u \;\le\; +\abs{\nabla f}. (0.6.14)

A bound is only useful if something reaches it, and the equality clause says both of these are reached. The upper bound is attained at u^=f/f\hat u = \nabla f/\abs{\nabla f}, where fu^=f2/f=f\nabla f\cdot\hat u = \abs{\nabla f}^{2}/\abs{\nabla f} = \abs{\nabla f}. The lower bound is attained at u^=f/f\hat u = -\nabla f/\abs{\nabla f}. So, with nothing assumed and nothing waved at:

Steepest ascent

The direction of fastest increase of ff at a\vv a is f/f\nabla f/\abs{\nabla f}, and the rate of increase in that direction is f\abs{\nabla f}. The direction of fastest decrease is the opposite one, with rate f-\abs{\nabla f}. So the gradient does not merely point uphill. Its length is the steepness.

This is the cleanest single payoff for having proved Cauchy–Schwarz. Now look at the other extreme of the same inequality. If fu^=0\nabla f\cdot\hat u = 0 then ff does not change at all, to first order, along u^\hat u. Those directions are worth a name, and they have a geometric meaning.

3.2 · The gradient is perpendicular to level sets

A level set of ff is a set {x:f(x)=c}\{\vv x : f(\vv x)=c\}. Think of an isotherm, an equipotential, or a contour line on a map. Let x(t)\vv x(t) be any differentiable curve that lies inside one of them, so that f(x(t))=cf(\vv x(t)) = c for all tt. Our plan is to differentiate that identity, since a constant has derivative zero and that will hand us a statement about f\nabla f.

We can do the differentiation straight from the definition, which has the side benefit of proving the special case of the chain rule we will need repeatedly. Expand x\vv x to first order as x(t+s)=x(t)+sx˙(t)+o(s)\vv x(t+s) = \vv x(t) + s\,\dot{\vv x}(t) + o(s), and feed the result into (0.6.4):

f(x(t+s))=f(x(t))+Df[sx˙(t)+o(s)]+o(s)=f(x(t))+sfx˙(t)+o(s), \begin{aligned} f\big(\vv x(t+s)\big) &= f\big(\vv x(t)\big) + \mathrm{D}f\big[s\,\dot{\vv x}(t)+o(s)\big] + o(s)\\[3pt] &= f\big(\vv x(t)\big) + s\,\nabla f\cdot\dot{\vv x}(t) + o(s), \end{aligned} (0.6.15)

The boundedness lemma of §2 was used there to absorb Df[o(s)]\mathrm{D}f\big[o(s)\big] into o(s)o(s). Now compare that last line with the one-variable definition of a derivative in ss. The coefficient of ss is the derivative, so we can read it straight off:

ddtf(x(t))  =  fx˙(t). \dv{}{t}f\big(\vv x(t)\big) \;=\; \nabla f\cdot\dot{\vv x}(t). (0.6.16)

That holds for any curve at all. Now impose the extra condition that our curve lies in a level set. Then f(x(t))f(\vv x(t)) is the constant cc, so the left side is dcdt=0\dv{c}{t}=0, and we are left with

fx˙  =  0for every curve inside a level set. \nabla f\cdot\dot{\vv x} \;=\; 0 \qquad\text{for every curve inside a level set.} (0.6.17)

The velocity x˙\dot{\vv x} of such a curve is exactly what we mean by a vector tangent to the level set. So f\nabla f is orthogonal to every tangent direction of the level set through a\vv a. The gradient is perpendicular to the level surface, and points across it in the direction of increase.

The two facts fit together into one picture. Contours are the lines along which nothing changes. The gradient is perpendicular to them. And it is longest where the contours are closest together, because that is where a small step changes ff the most. The figure below is that picture, with the arithmetic exposed so you can check it rather than believe it.

∇f = (2.80, 5.60), |∇f| = 6.261
∇f · t̂ = -2.8e-12 (zero)
One figure, three sections. Grey ellipses are level sets of f(x,y)=x2+2y2f(x,y)=x^{2}+2y^{2}; green arrows are the gradient field, all drawn the same length so that only their direction is being claimed. Drag the point (or use the sliders). The blue curve is the level set through it, the dashed grey line is that curve's tangent, and the thick blue arrow is f\nabla f there, drawn to scale. The readout reports ft^\nabla f\cdot\hat t, computed by taking a numerical tangent from the contour and dotting it with the analytic gradient: it stays around 101210^{-12}, which is machine roundoff and nothing else — (0.6.17) measured rather than asserted. Watch the blue arrow lengthen as you move outward, where the contours crowd — that is §3.1's claim that f\abs{\nabla f} is the steepness — and shrink to nothing at the origin, where the level sets degenerate to a point and the gradient vanishes. Now press the button. The orange line is the constraint g(x,y)=x+y=3g(x,y)=x+y=3. Its lowest-ff point is marked, and there the purple level curve of ff is tangent to the constraint line, so the two gradients are parallel: f=(4,4)=4g\nabla f = (4,4) = 4\,\nabla g. That number 44 is the Lagrange multiplier of §7, and it is also dfdc\dv{f^{*}}{c}. Slide the point along the orange line and watch the blue contour cut across it everywhere except at the marked point — which is the whole proof of §7 in one image.
In plain terms 0.6.3

For a function returning a single number the linear stand-in is a row rather than a square, and a row of numbers is very hard not to stand upright and call a vector. Do so, then ask which direction increases the function fastest, and the question becomes the one the overlap inequality of the previous chapter answers exactly. An overlap with a direction of unit length is largest when the two are parallel, and its size is then the length of the other. So the steepest direction is the gradient's own, and the rate of increase along it is the gradient's length. The arrow does not merely point uphill; how long it is is how steep the hill is.

The complementary statement comes out of the same computation. Travel along a curve on which the function never changes, and its rate of change along that curve is zero, which says the gradient has no overlap with any direction tangent to such a curve. The gradient is therefore perpendicular to the contours and crosses them by the shortest route available.

The two facts assemble into one picture a walker would recognise. Contours are the lines along which nothing happens, the arrow cuts squarely across them, and it is longest precisely where they crowd together, since crowded contours are where a short step buys the largest change.

4 · The gradient is really a one-form — and why you must care

Go back to (0.6.10) and look at what was actually done there. We had a perfectly good object, the linear map Df(a)\mathrm{D}f(\vv a), which eats a displacement vector and returns a number. We converted it into a vector, f\nabla f, by demanding that dotting with that vector reproduce the map. The conversion required a dot product. It could not have been done without one.

So let's separate the two objects and take them one at a time. First the one that came for free. It deserves its usual name, so write

df(h)    Df(a)h  =  hiif, \dd f(\vv h) \;\equiv\; \mathrm{D}f(\vv a)\,\vv h \;=\; h^{i}\,\partial_{i}f, (0.6.18)

with a sum over ii. The object df\dd f is a one-form, also called a covector. It is a linear machine that eats a vector and returns a number. In Chapter 0.4's language it is nothing but a linear map whose target happens to be one-dimensional. Such maps can be added and scaled, and the result is another one, so they form a vector space in their own right. That space is called the dual space VV^{*}, and Chapter 2.4 will treat it properly.

What matters here is that df\dd f is defined by ff alone. No inner product, no notion of length and no notion of angle went into (0.6.18). All that went in was the pairing of a displacement with a rate of change, which is exactly what a physical derivative is. This is also the honest definition of the dx\dd x you have been cancelling since school, and Chapter 0.1's warning callout promised you it would get one here.

The gradient, by contrast, is defined by two things: ff and an inner product. Look at the index positions, which are about to earn their keep. In (0.6.18) the components hih^{i} of a vector carry an upper index. The components if\partial_{i}f of the one-form carry a lower one. And the two are summed against each other to make a number.

Now let's make the inner product explicit, so that we can see it appear in the formula for f\nabla f instead of hiding in it. Given a basis, bilinearity determines an inner product completely by what it does to basis vectors. Write p=piei\vv p = p^{i}\vv e_{i} and q=qjej\vv q = q^{j}\vv e_{j} and expand:

pq  =  piqj(eiej)    gijpiqj,gijeiej. \vv p\cdot\vv q \;=\; p^{i}q^{j}\,\big(\vv e_{i}\cdot\vv e_{j}\big) \;\equiv\; g_{ij}\,p^{i}q^{j}, \qquad g_{ij}\equiv \vv e_{i}\cdot\vv e_{j}. (0.6.19)

The array gijg_{ij} is called the metric in that basis. It is symmetric because the inner product is. It is also invertible, because the inner product is non-degenerate: if some v\vv v had gijvi=0g_{ij}v^{i}=0 for all jj, then v\vv v would be orthogonal to everything, including itself, and so v=0\vv v=\vv 0. Both index positions are down, which matches the fact that the metric eats two vectors.

We now have everything we need to see the cost of the gradient. Our goal is to solve (0.6.10) for the components of f\nabla f, so write that defining relation out in these components:

gij(f)ihj  =  jf  hjfor every h, g_{ij}\,(\nabla f)^{i}\,h^{j} \;=\; \partial_{j}f\;h^{j} \qquad\text{for every }\vv h, (0.6.20)

Both sides are sums over jj, and the statement holds for every h\vv h, so the coefficients of each hjh^{j} must agree: gij(f)i=jfg_{ij}(\nabla f)^{i} = \partial_{j}f. That is a linear system for (f)i(\nabla f)^{i}, so solve it by multiplying through by the inverse matrix gijg^{ij}, which exists because the inner product is non-degenerate:

  (f)i  =  gijjf.   \boxed{\;(\nabla f)^{i} \;=\; g^{ij}\,\partial_{j}f.\;} (0.6.21)

There it is, in the open. Converting the one-form jf\partial_{j}f into the vector (f)i(\nabla f)^{i} is exactly the act of contracting with the inverse metric. It is called raising an index, and it is not free.

In Cartesian coordinates on Euclidean space gij=δijg_{ij}=\delta_{ij}, so gij=δijg^{ij}=\delta^{ij} and (0.6.21) reads (f)i=if(\nabla f)^{i}=\partial_{i}f. The components are then numerically identical and the distinction is invisible. That invisibility is why the gradient is usually taught as a vector, and why the whole issue can seem like pedantry. It is not pedantry. Here are three places where it stops being invisible:

  • Non-Cartesian coordinates, immediately. In plane polar coordinates the metric is gij=diag(1,r2)g_{ij}=\mathrm{diag}(1,r^{2}), so gij=diag(1,r2)g^{ij}=\mathrm{diag}(1,r^{-2}) and the gradient's angular component is r2θfr^{-2}\partial_{\theta}f rather than θf\partial_{\theta}f. If you have ever wondered where the stray 1/r1/r in the polar gradient formula comes from, it comes from here. The grind box does the calculation.
  • Relativity, permanently. The Minkowski metric has signature (+,,,)(+,-,-,-) (Chapter 2.3), so raising a spatial index flips its sign: (f)i=if(\nabla f)^{i} = -\partial_{i}f. No coordinate choice makes this go away, because no coordinate choice makes the metric the identity. From Chapter 2.4 onward, upper and lower indices are different objects, and mixing them is an error rather than a style preference.
  • Curved space, structurally. On a manifold (Chapter 3.2) there is no inner product at all until you supply one, and supplying one is the gravitational field (Chapter 3.3). So on a manifold df\dd f exists always, and f\nabla f exists only once gravity has been specified. That is a statement about physics rather than about notation.

You have just met your first covector, and it was hiding inside the most familiar object in vector calculus. The rule to carry forward is short. Differentiation naturally produces lower indices. Vectors naturally carry upper ones. The metric is what converts between them, and when the metric is the identity you cannot see the conversion happening. Chapter 2.4 makes this a formal convention, and Chapter 3.2 makes it unavoidable. Nothing more is needed here.

Grind box — the polar gradient, derived rather than memorised

In plane polar coordinates (r,θ)(r,\theta) the squared length of a small displacement is, by Pythagoras on a radial step dr\dd r and a perpendicular arc rdθr\,\dd\theta,

ds2=dr2+r2dθ2gij=(100r2). \dd s^{2} = \dd r^{2} + r^{2}\dd\theta^{2} \qquad\Longrightarrow\qquad g_{ij} = \begin{pmatrix}1&0\\0&r^{2}\end{pmatrix}.

Inverting a diagonal matrix is easy: gij=diag(1,r2)g^{ij}=\mathrm{diag}(1,\,r^{-2}). So by (0.6.21) the gradient's components in the coordinate basis {r,θ}\{\partial_{r},\partial_{\theta}\} are

(f)r=rf,(f)θ=1r2θf. (\nabla f)^{r} = \partial_{r}f, \qquad (\nabla f)^{\theta} = \frac{1}{r^{2}}\,\partial_{\theta}f.

Those are components in the coordinate basis, and the formula in the textbooks is written in the unit basis, so one more step is needed. The coordinate basis vector θ\partial_{\theta} is not a unit vector, because moving one unit of θ\theta moves you a distance rr. Its normalised version is therefore θ^=r1θ\hat{\boldsymbol\theta} = r^{-1}\partial_{\theta}, which we can rearrange to θ=rθ^\partial_\theta = r\,\hat{\boldsymbol\theta}. Substituting that in,

f=(f)rr^+(f)θrθ^=frr^+1rfθθ^. \nabla f = (\nabla f)^{r}\,\hat{\vv r} + (\nabla f)^{\theta}\,r\,\hat{\boldsymbol\theta} = \pdv{f}{r}\,\hat{\vv r} + \frac{1}{r}\pdv{f}{\theta}\,\hat{\boldsymbol\theta}.

That is the formula printed on the inside cover of every vector-calculus text, and you have just derived it. There are two morals. First, the notorious 1/r1/r is not a quirk of polar coordinates. It is one factor of r2r^{-2} from raising the index and one factor of rr from normalising the basis vector. Second, and this is the part that matters later, the "hih_{i} scale factors" that vector-calculus books ask you to memorise for cylindrical and spherical coordinates are nothing but the diagonal entries gii\sqrt{g_{ii}} of the metric. Chapter 3.3 replaces the table with the metric and never mentions scale factors again.

Two sanity checks. For f=rf=r we get f=r^\nabla f = \hat{\vv r}, which is right: the fastest way to increase your distance from the origin is to move directly away from it, at unit rate. For f=θf=\theta we get f=θ^/r\nabla f = \hat{\boldsymbol\theta}/r, which correctly says that far from the origin you must travel a long way to change your bearing.

In plain terms 0.6.4

Look again at the step where the row was stood upright, because something was spent unnoticed. What differentiation naturally produces is a measuring device: it accepts a displacement and returns the resulting change, needing no notion of length or angle to do so. This is also the honest account of the symbols people have been cancelling since school. Turning it into an arrow required a rule for converting one into the other, and that rule is extra structure, assumed rather than derived. In square coordinates on flat space it is the identity, so device and arrow carry identical numbers and the conversion cannot be seen.

Step outside them and it becomes visible at once. In polar coordinates the conversion divides the angular part by the square of the radius, which is where the notorious reciprocal in the memorised polar formula comes from, one factor from the conversion and one from the angular basis direction not being of unit length. In relativity the conversion reverses the sign of every spatial part, and no coordinates remove it.

The rule to carry forward is short. Differentiation produces measuring devices, arrows are a different species, and the metric converts between them. On a curved space no such object exists until somebody supplies one, and supplying it is what specifying a gravitational field means. The measuring device is always there; the arrow is not.

5 · The chain rule in several variables

Chapter 0.1 derived the chain rule by composing two linear approximations and observing that linear maps compose by multiplication. In one dimension "multiplication" meant multiplying two numbers. Here it means composing two linear maps, which by Chapter 0.4 means multiplying two matrices. The derivation is word-for-word the same, so let's do it and watch the matrices appear.

Let g:RnRpg:\R^{n}\to\R^{p} be differentiable at a\vv a and f:RpRmf:\R^{p}\to\R^{m} differentiable at b=g(a)\vv b = g(\vv a). We want the derivative of the composition, so nudge the input by h\vv h and follow the nudge through both maps in turn. First, gg moves its output by

k    g(a+h)g(a)  =  Dg(a)h  +  o(h). \vv k \;\equiv\; g(\vv a+\vv h)-g(\vv a) \;=\; \mathrm{D}g(\vv a)\,\vv h \;+\; o(\abs{\vv h}). (0.6.22)

That displacement k\vv k is what arrives at the input of ff, so the next step is to feed it in there, using ff's own linear approximation at b\vv b and then substituting for k\vv k:

f(b+k)=f(b)+Df(b)k+o(k)=f(b)+Df(b)[Dg(a)h+o(h)]+o(k)=f(b)+Df(b)Dg(a)h+o(h). \begin{aligned} f(\vv b+\vv k) &= f(\vv b) + \mathrm{D}f(\vv b)\,\vv k + o(\abs{\vv k})\\[3pt] &= f(\vv b) + \mathrm{D}f(\vv b)\Big[\mathrm{D}g(\vv a)\,\vv h + o(\abs{\vv h})\Big] + o(\abs{\vv k})\\[3pt] &= f(\vv b) + \mathrm{D}f(\vv b)\,\mathrm{D}g(\vv a)\,\vv h + o(\abs{\vv h}). \end{aligned} (0.6.23)

Two small steps hide in that last line, and both are the boundedness lemma. First, Df(b)\mathrm{D}f(\vv b) applied to something o(h)o(\abs{\vv h}) is again o(h)o(\abs{\vv h}). Second, kCh\abs{\vv k}\le C\abs{\vv h} for small h\vv h by (0.6.22), so anything that is o(k)o(\abs{\vv k}) is also o(h)o(\abs{\vv h}).

The last line now has the exact shape of the definition (0.6.4), with a linear map sitting where the derivative belongs. Uniqueness (§2.1) says that map has no choice but to be the derivative, so we can read the coefficient off:

  D(fg)(a)  =  Df(g(a))  Dg(a).   \boxed{\;\mathrm{D}(f\circ g)(\vv a) \;=\; \mathrm{D}f\big(g(\vv a)\big)\;\mathrm{D}g(\vv a).\;} (0.6.24)

In matrices that reads: an (m×p)(m\times p) Jacobian times a (p×n)(p\times n) Jacobian gives an (m×n)(m\times n) Jacobian. The inner dimensions match automatically, because the output space of gg is the input space of ff, so the shapes cannot be wrong. This is one of the reasons to think of the derivative as a map rather than as a table of numbers. The bookkeeping is enforced by the structure.

5.1 · The case you will use every day

Let x(t)\vv x(t) be a curve in Rn\R^{n} and ff a scalar field. Then fxf\circ\vv x is a function of one variable, Dx(t)\mathrm{D}\vv x(t) is the column x˙\dot{\vv x}, and Df\mathrm{D}f is the row of partials, so (0.6.24) reduces to a row times a column:

ddtf(x(t))  =  fx˙(t)  =  fxidxidt, \dv{}{t}f\big(\vv x(t)\big) \;=\; \nabla f\cdot\dot{\vv x}(t) \;=\; \pdv{f}{x^{i}}\,\dv{x^{i}}{t}, (0.6.25)

which is (0.6.16), now obtained as a special case rather than from scratch. This is the workhorse of the chapter. It is how you compute the rate of change of a temperature felt by a moving thermometer, or of a potential felt by a moving charge, or of a Lagrangian along a trajectory. Chapter 1.2 opens with it.

5.2 · Changing coordinates, and a convention appearing on its own

Now the case that runs all of tensor analysis. Suppose the xix^{i} are themselves functions of new coordinates uau^{a}. Think of polar coordinates written in terms of Cartesian ones, or of one observer's coordinates written in terms of another's. We want to know how a rate of change looks in the new coordinates, so take (0.6.24) and write it out entry by entry:

fua  =  ifxixiua    fxixiua. \pdv{f}{u^{a}} \;=\; \sum_{i}\pdv{f}{x^{i}}\,\pdv{x^{i}}{u^{a}} \;\equiv\; \pdv{f}{x^{i}}\,\pdv{x^{i}}{u^{a}}. (0.6.26)

Three things about that equation deserve to be noticed now rather than in Chapter 2.4.

It is a matrix product. The object xi/ua\partial x^{i}/\partial u^{a} is the Jacobian of the coordinate change, and (0.6.26) says: to convert the components of df\dd f from one coordinate system to another, hit them with that Jacobian. That single sentence, promoted to a definition, is what a tensor is.

The summation happens by itself. The index ii appears twice on the right and is summed over. The index aa appears once on each side and is not summed. That pattern is not a coincidence of this particular formula. It is what always happens when you compose linear maps, because matrix multiplication sums over the shared index. Chapter 2.4 will therefore drop the \sum entirely and adopt the Einstein summation convention, under which a repeated index is summed. The convention is possible because the pattern is universal, and the pattern is universal because everything in sight is a composition of linear maps.

The index heights are already right. Look at where the repeated index ii sits. It is upstairs in xi/ua\partial x^{i}/\partial u^{a}, in the numerator, and downstairs in f/xi\partial f/\partial x^{i}, in the denominator. The rule of §4 was that differentiation lowers and coordinates raise, so one of the pair is up and the other is down. This is not luck. It is (0.6.21) and (0.6.18) telling you that the only combinations that can be summed to give a coordinate-independent number are one-up-one-down. In Chapter 2.4 that becomes a rule you can use to check your algebra. If you have written down a formula with two indices at the same height summed against each other, you have made a mistake.

In plain terms 0.6.5

Composing two functions near a point amounts to composing their linear stand-ins, and that sentence was already the entire chain rule when one variable was in play. All that changes with several is what composing linear maps means, which the linear algebra chapter settled: their arrays are multiplied. The derivation is the earlier one word for word. As a bonus the bookkeeping can no longer go astray: the output space of the inner function is the input space of the outer, so the shapes are forced into agreement.

Written out with indices for the case that governs everything later, in which the coordinates are themselves functions of new coordinates, the same formula says how the components of a rate of change convert from one coordinate system to another. Promoted to a definition, that single sentence is what a tensor is, and the concept holds nothing else.

Two habits appear here of their own accord rather than by decree. One index is always repeated and summed while the others are not, because that is what composing maps does, which is why the summation sign is eventually dropped as redundant. And the repeated index turns up once as a measuring device and once as an arrow — the only pairing yielding a number that survives a change of description, and later the quickest way to catch an error.

6 · Second derivatives, the Hessian, and what a critical point looks like

So far everything has been first order. Let's go one order further, because that is where the shape of a function near a point lives. Differentiate a partial derivative again and you get a second partial, written ijf\partial_{i}\partial_{j}f or 2f/xixj\partial^{2}f/\partial x^{i}\partial x^{j}. There are n2n^{2} of them, and the first question to settle is whether the order of differentiation matters.

6.1 · Clairaut's theorem, with the hypothesis said out loud

Theorem (Clairaut / Schwarz)

If the second partial derivatives of ff exist in a neighbourhood of a\vv a and are continuous at a\vv a, then

ijf(a)  =  jif(a)for all i,j. \partial_{i}\partial_{j}f(\vv a) \;=\; \partial_{j}\partial_{i}f(\vv a) \qquad\text{for all }i,j.

The continuity hypothesis is real. The grind box below both proves the theorem and exhibits a function for which the two mixed partials at the origin come out as +1+1 and 1-1. But for every function you will meet in this book the hypothesis holds, so second partials commute and the matrix of them is symmetric. That matrix is the one we will work with from here on, and it has a name:

H(a)  =  [ijf(a)],HT=H. H(\vv a) \;=\; \big[\partial_{i}\partial_{j}f(\vv a)\big], \qquad H^{\mathsf T}=H. (0.6.27)

It is the Hessian. Note what it is structurally. The gradient f\nabla f is a map RnRn\R^{n}\to\R^{n}, and HH is its Jacobian. So the second derivative of a scalar field is the derivative of a vector field.

Grind box — proof of Clairaut, and the counterexample when continuity fails

Proof. Work in the two relevant variables and call them x,yx,y. Consider the double difference across a small rectangle of sides h,kh,k:

Δ  =  f(a+h,b+k)f(a+h,b)f(a,b+k)+f(a,b). \Delta \;=\; f(a+h,b+k) - f(a+h,b) - f(a,b+k) + f(a,b).

It is symmetric under swapping the roles of the two variables, and we will evaluate it in the two possible orders. First group it as a difference in xx of the function φ(x)=f(x,b+k)f(x,b)\varphi(x) = f(x,b+k)-f(x,b), so Δ=φ(a+h)φ(a)\Delta=\varphi(a+h)-\varphi(a). By the mean value theorem (Chapter 0.2) there is θ(0,1)\theta\in(0,1) with Δ=hφ(a+θh)\Delta = h\,\varphi'(a+\theta h), i.e.

Δ=h[xf(a+θh,b+k)xf(a+θh,b)]. \Delta = h\Big[\partial_{x}f(a+\theta h,\,b+k) - \partial_{x}f(a+\theta h,\,b)\Big].

We now want a second derivative out of that, so look at the bracket. It is a difference in yy of the function xf(a+θh,)\partial_{x}f(a+\theta h,\cdot), so the mean value theorem applies to it as well, giving θ(0,1)\theta'\in(0,1) with

Δ=hk  yxf(a+θh,  b+θk). \Delta = h\,k\;\partial_{y}\partial_{x}f\big(a+\theta h,\;b+\theta' k\big).

Now group Δ\Delta the other way, as a difference in yy first. The identical argument gives σ,σ(0,1)\sigma,\sigma'\in(0,1) with Δ=hk  xyf(a+σh,b+σk)\Delta = h\,k\;\partial_{x}\partial_{y}f(a+\sigma h, b+\sigma' k). Equate the two, divide by hk0hk\neq0, and let (h,k)(0,0)(h,k)\to(0,0). Both evaluation points converge to (a,b)(a,b), and by the assumed continuity of the two second partials at (a,b)(a,b) both sides converge to their values there. Hence yxf(a,b)=xyf(a,b)\partial_{y}\partial_{x}f(a,b)=\partial_{x}\partial_{y}f(a,b). ∎

The counterexample. Continuity was used in the very last step of that argument, so removing it ought to break the theorem, and it does. Take

f(x,y)=xy(x2y2)x2+y2  for (x,y)(0,0),f(0,0)=0. f(x,y) = \frac{xy\,(x^{2}-y^{2})}{x^{2}+y^{2}} \ \ \text{for }(x,y)\neq(0,0), \qquad f(0,0)=0.

This one is continuous, and differentiable, and has second partials everywhere. Compute xf\partial_{x}f in general and then restrict it to the yy-axis: a short calculation gives xf(0,y)=y\partial_{x}f(0,y) = -y. Restricting yf\partial_{y}f to the xx-axis gives yf(x,0)=+x\partial_{y}f(x,0) = +x. Therefore

yxf(0,0)=ddy(y)=1,xyf(0,0)=ddx(+x)=+1. \partial_{y}\partial_{x}f(0,0) = \dv{}{y}(-y) = -1, \qquad \partial_{x}\partial_{y}f(0,0) = \dv{}{x}(+x) = +1.

The mixed partials at the origin differ. What fails is precisely the hypothesis. Away from the origin the second mixed partial is a bounded but direction-dependent function of θ\theta, which is the same pathology as §1's counterexample one derivative further up. So it has no limit at the origin and is not continuous there. The theorem is not true for free. It is true under a condition, and the condition is exactly what stops direction-dependence from surviving to the limit.

6.2 · Taylor to second order

We already have all the machinery for this, and the trick is to turn the several-variable problem into a one-variable one. Fix a\vv a and h\vv h and define the one-variable function φ(t)=f(a+th)\varphi(t) = f(\vv a + t\vv h), which traces ff along the straight line through a\vv a in the direction h\vv h. Our goal is φ\varphi's first two derivatives, since Chapter 0.3's Taylor theorem will then do the rest. Differentiate it with the chain rule (0.6.25), noting that the "velocity" of the line is the constant vector h\vv h:

φ(t)=f(a+th)h=hiif(a+th). \varphi'(t) = \nabla f(\vv a + t\vv h)\cdot\vv h = h^{i}\,\partial_{i}f(\vv a+t\vv h). (0.6.28)

That is the first derivative, and we want the second. Each if\partial_{i}f in it is itself a scalar field evaluated along the same line, so apply the same chain rule to each of them in turn:

φ(t)=hihjjif(a+th)=hTH(a+th)h. \varphi''(t) = h^{i}h^{j}\,\partial_{j}\partial_{i}f(\vv a+t\vv h) = \vv h^{\mathsf T}H(\vv a+t\vv h)\,\vv h. (0.6.29)

We have φ(0)=f(a)\varphi(0)=f(\vv a) and both derivatives at t=0t=0, which is everything Taylor needs. So apply the one-variable Taylor theorem of Chapter 0.3 to φ\varphi about t=0t=0, and then evaluate the result at t=1t=1, which lands exactly on f(a+h)f(\vv a+\vv h):

  f(a+h)  =  f(a)  +  f(a)h  +  12hTH(a)h  +  o(h2).   \boxed{\;f(\vv a+\vv h) \;=\; f(\vv a) \;+\; \nabla f(\vv a)\cdot\vv h \;+\; \tfrac12\,\vv h^{\mathsf T}H(\vv a)\,\vv h \;+\; o(\abs{\vv h}^{2}).\;} (0.6.30)

Look at what that boxed line contains. Three terms: a constant, a linear form, and a quadratic form. That is the general shape of a smooth function near a point. It is also why quadratic forms, which were Chapter 0.5's whole subject, are not an algebraic curiosity. They are the universal local model of everything.

6.3 · Critical points, classified by eigenvalues

A critical point is a point where f=0\nabla f=\vv 0, meaning that no direction changes ff to first order. Every maximum, minimum and saddle is one. The reason is that if f0\nabla f\neq\vv 0 you can increase ff by stepping along it and decrease ff by stepping the other way, so you are not at an extremum. Now put f=0\nabla f=\vv 0 into (0.6.30). The linear term drops out, and what is left is

f(a+h)f(a)  =  12hTHh  +  o(h2). f(\vv a+\vv h) - f(\vv a) \;=\; \tfrac12\,\vv h^{\mathsf T}H\,\vv h \;+\; o(\abs{\vv h}^{2}). (0.6.31)

So the local behaviour is decided by the sign of the quadratic form hTHh\vv h^{\mathsf T}H\vv h. A quadratic form with cross terms in it is hard to read a sign off, so we want a basis in which the cross terms disappear. Clairaut has already given us one: HH is symmetric, which is exactly the hypothesis of the spectral theorem of Chapter 0.5. That theorem supplies an orthonormal basis e1,,en\vv e_{1},\ldots,\vv e_{n} of eigenvectors of HH, with real eigenvalues μ1,,μn\mu_{1},\ldots,\mu_{n}. Expand the displacement in that basis as h=kckek\vv h=\sum_{k}c_{k}\vv e_{k}, and the quadratic form collapses to a sum of squares:

hTHh  =  kμkck2,h2=kck2. \vv h^{\mathsf T}H\vv h \;=\; \sum_{k}\mu_{k}c_{k}^{2}, \qquad \abs{\vv h}^{2}=\sum_{k}c_{k}^{2}. (0.6.32)

All cross terms are gone. The classification now reads itself off:

  • All μk>0\mu_{k}\gt0: then μkck2μminh2\sum\mu_{k}c_{k}^{2}\ge\mu_{\min}\abs{\vv h}^{2} with μmin>0\mu_{\min}\gt0, so the quadratic term is positive and of order h2\abs{\vv h}^{2}, while the remainder is o(h2)o(\abs{\vv h}^{2}) and therefore eventually smaller. For small enough h\abs{\vv h} the difference in (0.6.31) is positive in every direction: a strict local minimum.
  • All μk<0\mu_{k}\lt0: the same argument with the signs reversed, giving a strict local maximum.
  • Mixed signs: a saddle. Along an eigenvector with μk>0\mu_{k}\gt0 the function rises, and along one with μk<0\mu_{k}\lt0 it falls. It is a maximum and a minimum at the same point, depending on which way you look.
  • Some μk=0\mu_{k}=0: the test is silent. The quadratic term vanishes in that direction, so the o(h2)o(\abs{\vv h}^{2}) remainder decides, and we have no control over it. You need higher order. Chapter 6.6's Higgs potential is exactly such a case at its minimum, where the potential is flat along the direction the vacuum is free to rotate in, and what happens in that flat direction is the entire physics. (At the symmetric point ϕ=0\phi=0 the Hessian is strictly negative, so that point is an ordinary maximum and the test is not silent there.)

The eigenvectors are not bystanders in this, and here is the calculation that shows what they mean. Take a displacement along one of them by setting h=tek\vv h = t\vv e_{k} in (0.6.31). Since ekTHek=μk\vv e_{k}^{\mathsf T}H\vv e_{k}=\mu_{k}, we get

f(a+tek)f(a)  =  12μkt2+o(t2). f(\vv a + t\,\vv e_{k}) - f(\vv a) \;=\; \tfrac12\mu_{k}t^{2} + o(t^{2}). (0.6.33)

Along the kk-th eigenvector, then, ff is a one-dimensional parabola whose second derivative is μk\mu_{k}. The eigenvalues of the Hessian are the curvatures of ff along the principal directions, and the eigenvectors are those directions.

Near a minimum this makes the level sets ellipsoids. Setting 12μkck2=δ\tfrac12\sum\mu_{k}c_{k}^{2}=\delta gives semi-axes ck=2δ/μkc_{k}=\sqrt{2\delta/\mu_{k}}, so a small eigenvalue means a long axis, which is a shallow and extended valley in that direction. Hold onto the picture of a long thin valley. The next callout is about nothing else.

Familiar ground

You already read Hessians for a living. When a model is fitted by maximum likelihood, the software finds θ^\hat{\boldsymbol\theta} where the gradient of the log-likelihood (θ)\ell(\boldsymbol\theta) vanishes, and then reports standard errors. Those standard errors are §6.3, exactly.

At the maximum, H=[ij(θ^)]H=\big[\partial_{i}\partial_{j}\ell(\hat{\boldsymbol\theta})\big] has all eigenvalues 0\le0, since that is what "maximum" means by §6.3. So H-H is positive semi-definite, and it gets its own name: the observed Fisher information, J(θ^)=H(θ^)J(\hat{\boldsymbol\theta}) = -H(\hat{\boldsymbol\theta}). The estimated covariance matrix of the estimate is its inverse, and the reported standard errors are

Cov^(θ^)=J1,SEj=(J1)jj. \widehat{\mathrm{Cov}}\big(\hat{\boldsymbol\theta}\big) = J^{-1}, \qquad \mathrm{SE}_{j} = \sqrt{\big(J^{-1}\big)_{jj}}.

Read that as geometry and it says something you can feel. The curvature of the log-likelihood surface at its peak is the precision of the estimate. A sharp peak means large curvature, so large JJ and small J1J^{-1}, and that is a tight confidence interval. A flat peak is a wide one. The data's ability to distinguish parameter values is the steepness with which the likelihood falls away from the best fit.

The one-parameter case, checkable by hand. For nn exponentially distributed survival times with rate λ\lambda and no censoring, (λ)=nlnλλiti\ell(\lambda) = n\ln\lambda - \lambda\sum_{i}t_{i}. Setting =0\ell'=0 gives λ^=n/ti=1/tˉ\hat\lambda = n/\sum t_{i} = 1/\bar t, and (λ)=n/λ2\ell''(\lambda) = -n/\lambda^{2}, so J=n/λ^2J = n/\hat\lambda^{2} and

SE(λ^)=J1/2=λ^/n. \mathrm{SE}(\hat\lambda) = J^{-1/2} = \hat\lambda/\sqrt{n}.

The familiar 1/n1/\sqrt n is the statement that doubling the sample doubles the curvature.

Observed versus expected, and the distinction is not cosmetic. The expected Fisher information is I(θ)=Eθ ⁣[H]I(\boldsymbol\theta) = \mathbb{E}_{\boldsymbol\theta}\!\left[-H\right], an average of the curvature over all datasets the model could have produced. The observed information is H-H evaluated on the dataset you actually have, at the estimate you actually got. They agree in expectation, and both are consistent. In the exponential example above they happen to be identically equal, because =n/λ2\ell''=-n/\lambda^{2} contains no data. In general they differ. Efron and Hinkley's argument, which has held up, is that the observed information is the better variance estimate for the sample in hand, because it conditions on what you actually saw rather than averaging over what you might have seen. Most software reports the observed version by default. It is worth knowing which one you are quoting.

The spectral reading, which is where Chapter 0.5 earns its place. Diagonalise J=kμkekekTJ=\sum_{k}\mu_{k}\vv e_{k}\vv e_{k}^{\mathsf T}. Then J1=kμk1ekekTJ^{-1}=\sum_{k}\mu_{k}^{-1}\vv e_{k}\vv e_{k}^{\mathsf T}, and the variance of the linear combination ekθ^\vv e_{k}\cdot\hat{\boldsymbol\theta} is exactly ekTJ1ek=1/μk\vv e_{k}^{\mathsf T}J^{-1}\vv e_{k} = 1/\mu_{k}. So the eigenvectors of the Hessian are the directions in parameter space along which the data constrain you best and worst, and the reciprocal eigenvalues are how badly.

Two collinear covariates make this concrete. Fit y=β1x1+β2x2+εy = \beta_{1}x_{1}+\beta_{2}x_{2}+\varepsilon with Gaussian noise of known variance σ2\sigma^{2}. Then \ell is 12σ2-\tfrac1{2\sigma^{2}} times a sum of squares, and J=H=XTX/σ2J=-H = X^{\mathsf T}X/\sigma^{2}. To see the effect at its starkest, suppose σ=1\sigma=1 and the two columns are nearly identical, so that

J=(1009999100),J1=1199(1009999100). J = \begin{pmatrix} 100 & 99\\ 99 & 100\end{pmatrix}, \qquad J^{-1} = \frac{1}{199}\begin{pmatrix}100 & -99\\ -99 & 100\end{pmatrix}.

The eigenvalues are 199199, with eigenvector (1,1)/2(1,1)/\sqrt2, and 11, with eigenvector (1,1)/2(1,-1)/\sqrt2. So the sum (β1+β2)/2(\beta_{1}+\beta_{2})/\sqrt2 is pinned down with variance 1/1991/199, while the difference (β1β2)/2(\beta_{1}-\beta_{2})/\sqrt2 is known only with variance 11, two hundred times worse. The normalisation matters here: the eigenvector is a unit vector, and it is the variance along it that is 1/μk1/\mu_k.

That is the long thin valley of §6.3, and it is what "the two predictors are collinear" means geometrically. The likelihood has a nearly flat direction. The reported standard errors are 100/199=0.709\sqrt{100/199}=0.709 each, which is seven times larger than the naive 1/100=0.11/\sqrt{100}=0.1 you would get by inverting the diagonal instead of taking the diagonal of the inverse. That factor of seven is 1/1ρ21/\sqrt{1-\rho^{2}}, where ρ\rho is the correlation between the two estimates. Here ρ=99/100=0.99\rho=-99/100=-0.99, and 1/10.992=7.091/\sqrt{1-0.99^{2}}=7.09. Inverting first and taking the diagonal second is not a convention. It is the only way the off-diagonal curvature can reach the answer.

In plain terms 0.6.6

One order further in the approximation and every smooth function near a point becomes the same three things: a constant, a linear part, and a quadratic part built from the array of second derivatives. That array is symmetric whenever those derivatives are continuous, and symmetric is exactly the hypothesis the previous chapter spent its length on. So the quadratic part falls apart into independent pieces: along each of a set of mutually perpendicular directions the function is an ordinary parabola, and the numbers belonging to those directions are its curvatures.

The classification then reads itself off. Curving upward in every direction is a minimum, downward in every direction a maximum, and mixed signs a saddle, which is a maximum and a minimum at once, depending on where you stand. A curvature of zero leaves the matter unsettled and hands it to higher order, no idle case: it is where a mechanism for breaking a symmetry eventually lives.

Read curvature as information and it says something you can feel. A sharp peak means its location is well determined and a flat one means it is not, so the curvature of a likelihood surface at its maximum is the precision of an estimate, and the width of a confidence interval is the shallowness of a hill. A long shallow valley is what two nearly redundant predictors look like from the inside.

7 · Lagrange multipliers

Now the constrained problem. We want to extremise f(x)f(\vv x) subject to g(x)=cg(\vv x)=c. The recipe for doing that is famous, and it is usually handed over as a recipe. We are going to derive it instead, in three sentences of geometry, and then extract something from it that the recipe hides.

Let a\vv a be a point on the constraint surface S={g=c}S=\{g=c\} at which ff is extremal among points of SS, and assume g(a)0\nabla g(\vv a)\neq\vv 0. We need two facts, and both of them have already been proved.

Which directions are tangent to SS. If x(t)\vv x(t) is a curve lying in SS then g(x(t))=cg(\vv x(t))=c, so (0.6.16) gives gx˙=0\nabla g\cdot\dot{\vv x}=0. Every tangent vector to SS is therefore orthogonal to g\nabla g. The converse says that every vector orthogonal to g\nabla g is the velocity of some curve in SS, and that is the implicit function theorem, ⚑ which we quote. It is guaranteed by the assumption g0\nabla g\neq\vv 0, which is what says the constraint really does cut down the dimension by one near a\vv a. So the tangent space to SS at a\vv a is exactly (spang)(\mathrm{span}\,\nabla g)^{\perp}.

What extremality says. If x(t)\vv x(t) is a curve in SS through a\vv a, then tf(x(t))t\mapsto f(\vv x(t)) has an extremum at that point, so its derivative vanishes and fx˙=0\nabla f\cdot\dot{\vv x}=0. Moving along the constraint surface cannot change ff to first order, because that is what being extremal on SS means. So f(a)\nabla f(\vv a) is orthogonal to every tangent vector of SS.

Now let's put the two facts together. The plan is to show that f\nabla f has nothing left over once you remove its component along g\nabla g, and Chapter 0.5's orthogonal projection is the tool for separating those two pieces. Write n=g(a)\vv n = \nabla g(\vv a) and split f\nabla f into its component along n\vv n and whatever remains:

f  =  λn  +  w,λ    fnnn,w    fλn. \nabla f \;=\; \lambda\,\vv n \;+\; \vv w, \qquad \lambda \;\equiv\; \frac{\nabla f\cdot\vv n}{\vv n\cdot\vv n}, \qquad \vv w \;\equiv\; \nabla f - \lambda\vv n. (0.6.34)

The residual is orthogonal to n\vv n by construction, since wn=fnλn2=0\vv w\cdot\vv n = \nabla f\cdot\vv n - \lambda\abs{\vv n}^{2} = 0. So by the first fact, w\vv w is a tangent vector to SS. But the second fact says f\nabla f is orthogonal to every tangent vector, and that includes w\vv w itself. Dot the split with w\vv w and see what happens:

0  =  fw  =  (λn+w)w  =  λnw0+w2  =  w2. 0 \;=\; \nabla f\cdot\vv w \;=\; \big(\lambda\vv n + \vv w\big)\cdot\vv w \;=\; \lambda\,\underbrace{\vv n\cdot\vv w}_{0} + \abs{\vv w}^{2} \;=\; \abs{\vv w}^{2}. (0.6.35)

A vector of zero length is the zero vector, so w=0\vv w=\vv 0. Feeding that back into the split leaves f\nabla f with only its component along n\vv n, which is the result we were after:

  f(a)  =  λg(a),g(a)=c.   \boxed{\;\nabla f(\vv a) \;=\; \lambda\,\nabla g(\vv a),\qquad g(\vv a)=c.\;} (0.6.36)

Notice that the argument even handed us the multiplier explicitly, as λ=fg/g2\lambda = \nabla f\cdot\nabla g/\abs{\nabla g}^{2}. That is worth remembering when you want to check a solution rather than find one.

The geometric statement is the one to carry away. At a constrained extremum the level set of ff is tangent to the constraint surface, since both have the same normal direction. Suppose instead that they crossed. Then you could slide along the constraint from one side of the ff-contour to the other and change ff, so you were not at an extremum after all. Press the button in the §3 figure and this is exactly what you are looking at.

The mechanical version everyone quotes follows immediately, and it comes from packaging the two conditions f=λg\nabla f=\lambda\nabla g and g=cg=c as the critical-point equations of a single function. Define

L(x,λ)  =  f(x)    λ(g(x)c) \mathcal{L}(\vv x,\lambda) \;=\; f(\vv x) \;-\; \lambda\big(g(\vv x)-c\big) (0.6.37)

and look for its unconstrained critical points. Setting L/xi=0\partial\mathcal{L}/\partial x^{i}=0 gives f=λg\nabla f=\lambda\nabla g. Setting L/λ=0\partial\mathcal{L}/\partial\lambda=0 gives back g=cg=c. So the constraint has been converted from a restriction on the search space into one more equation to solve, at the price of one more unknown.

That trade is worth pausing on. You may restrict the space, or you may enlarge it and add a multiplier. It is one of the deepest moves in theoretical physics. It returns in Chapter 1.2 as the way to handle a bead on a wire, and again, much later, as the way gauge symmetry is imposed.

7.1 · The multiplier means something

λ\lambda looks like a bookkeeping device you introduce and then discard. It is not, and here is how to see what it measures. Let x(c)\vv x^{*}(c) be the constrained optimum as a function of the constraint level cc, and let f(c)=f(x(c))f^{*}(c) = f(\vv x^{*}(c)) be the optimal value. Assume x\vv x^{*} varies differentiably with cc, which it does under the same non-degeneracy that made the multiplier exist. We want to know how the best achievable value responds to a change in cc, so differentiate ff^{*} using the chain rule (0.6.25):

dfdc  =  fdxdc  =  λgdxdc, \dv{f^{*}}{c} \;=\; \nabla f\cdot\dv{\vv x^{*}}{c} \;=\; \lambda\,\nabla g\cdot\dv{\vv x^{*}}{c}, (0.6.38)

where the second step used (0.6.36). That has left us needing the quantity gdxdc\nabla g\cdot\dv{\vv x^{*}}{c}, and the constraint itself will supply it. Differentiate g(x(c))=cg(\vv x^{*}(c)) = c with respect to cc, which is the same chain rule applied to an identity holding for all cc:

gdxdc  =  1. \nabla g\cdot\dv{\vv x^{*}}{c} \;=\; 1. (0.6.39)

The awkward factor is exactly 11. So substitute (0.6.39) into (0.6.38), and everything on the right except the multiplier disappears:

  dfdc  =  λ.   \boxed{\;\dv{f^{*}}{c} \;=\; \lambda.\;} (0.6.40)

So the multiplier is a sensitivity. It is the rate at which the best achievable value improves when you relax the constraint by one unit. Economists call it a shadow price. In mechanics it is the constraint force, and in thermodynamics, as Worked example 1 will show, it is the temperature. A large λ\lambda says the constraint is expensive and worth negotiating, and λ=0\lambda=0 says the constraint is not binding at all.

Let's check that on a case small enough to do by hand, which is also the figure's setup. Minimise f=x2+2y2f=x^{2}+2y^{2} subject to x+y=cx+y=c. Then (0.6.36) reads (2x,4y)=λ(1,1)(2x,4y)=\lambda(1,1), so x=λ/2x=\lambda/2 and y=λ/4y=\lambda/4. Putting those into the constraint gives 3λ/4=c3\lambda/4=c, hence λ=4c/3\lambda=4c/3 and x=(2c/3,c/3)\vv x^{*}=(2c/3,\,c/3). The optimal value and its derivative are then

f(c)=4c29+2c29=2c23,dfdc=4c3=λ.   f^{*}(c) = \frac{4c^{2}}{9}+\frac{2c^{2}}{9} = \frac{2c^{2}}{3}, \qquad \dv{f^{*}}{c} = \frac{4c}{3} = \lambda. \;\checkmark (0.6.41)

Take c=3c=3 for a specific number. The optimum is (2,1)(2,1), with f=6f^{*}=6 and λ=4\lambda=4. That 44 is the number printed in the figure when the constraint is showing.

Grind box — when Lagrange fails, and why the fine print is the interesting part

The derivation used g(a)0\nabla g(\vv a)\neq\vv 0 twice: to know the tangent space is a genuine hyperplane, and to invoke the implicit function theorem. Drop it and the method can be wrong. Minimise f(x,y)=xf(x,y)=x subject to

g(x,y)=x3y2=0. g(x,y) = x^{3}-y^{2} = 0.

The constraint set is the curve y2=x3y^{2}=x^{3}, a cusp at the origin, defined only for x0x\ge0. The minimum of xx on it is at the origin. But there g=(3x2,2y)=(0,0)\nabla g = (3x^{2},-2y) = (0,0), while f=(1,0)\nabla f = (1,0) everywhere, and no λ\lambda satisfies (1,0)=λ(0,0)(1,0)=\lambda(0,0). The method returns nothing, and the answer it failed to find was sitting at the origin all along.

The condition g0\nabla g\neq\vv 0 is called a constraint qualification. The moral is that the multiplier exists because the constraint surface is smooth and non-degenerate there, rather than because algebra says so. Where constraints are degenerate, the multiplier framework needs repair. That is not an exotic case. In gauge theories the constraints are degenerate by design, because a gauge symmetry means several different field configurations describe the same physics. Handling that properly is what Dirac's constrained-Hamiltonian machinery and the Faddeev–Popov procedure exist to do, and every one of those is a descendant of (0.6.36) plus an honest accounting of when it breaks.

Several constraints. With g1=c1,,gr=crg_{1}=c_{1},\ldots,g_{r}=c_{r} the argument is identical word for word, with n\vv n replaced by the subspace W=span{g1,,gr}W=\mathrm{span}\{\nabla g_{1},\ldots,\nabla g_{r}\} and the one-line split (0.6.34) replaced by Chapter 0.5's orthogonal projection onto WW. Tangent vectors are those orthogonal to every gα\nabla g_{\alpha}. The residual w=fPf\vv w = \nabla f - P\nabla f is one of them, and extremality kills it exactly as before. What survives is

f=α=1rλαgα, \nabla f = \sum_{\alpha=1}^{r}\lambda_{\alpha}\nabla g_{\alpha},

with the qualification now reading "the gα\nabla g_{\alpha} are linearly independent at a\vv a", which is Chapter 0.4's notion of independence doing real work. Worked example 1 uses two constraints and therefore two multipliers, one of which turns out to be the temperature.

In plain terms 0.6.7

The rule for optimising under a constraint is famous as a recipe and is not a recipe at all. Being extremal along a surface means that no motion within the surface changes the function to first order, which says the gradient has no component in any direction you are still permitted to move. What remains of it must point straight out of the surface, and pointing straight out of the surface is exactly what the constraint's own gradient does. So the two are parallel, and the number relating them is the multiplier. There is nowhere left to go, and the equation is that sentence written down.

Put geometrically it stops being clever and becomes obvious. At the answer, the contour of the function touches the constraint rather than crossing it. Anywhere the two cross you can slide along the constraint from one side of the contour to the other and change the function, so you were not yet at the answer.

The multiplier is not a device introduced and then discarded. It measures how much the best achievable value improves when the constraint is relaxed by one unit, which makes it a price. Economists call it a shadow price, mechanics the force the constraint exerts, and thermodynamics, in one celebrated instance, the temperature. A multiplier of zero says the constraint was never binding.

8 · Change of variables and the Jacobian determinant

Here is the last consequence, and it is the one that pays a debt from Chapter 0.2. Let Φ:URn\Phi:U\to\R^{n} be a differentiable, injective change of coordinates with detDΦ0\det\mathrm{D}\Phi\neq0. The question is: how does an integral transform under it?

That last condition earns a name, because two later chapters lean on it directly and it is worth having stated rather than assumed. If DΦ(a)\mathrm{D}\Phi(\vv a) is invertible then Φ\Phi itself is invertible on some neighbourhood of a\vv a, with a differentiable inverse whose derivative there is (DΦ(a))1\big(\mathrm{D}\Phi(\vv a)\big)^{-1}. That is the inverse function theorem, and it says the obvious thing: near a point, the map is its linear part, and a linear part you can undo is an undoable map. ⚑ The proof is a contraction-mapping argument that belongs to a real analysis course, so it is quoted here. It is equivalent to the implicit function theorem quoted in §7, and Chapter 1.3 spends it twice — once to ask when velocities can be traded for momenta, and once to identify the Hessian that decides it.

The answer is forced by two things we already have, so let's set them side by side. First, from §2, near any point u\vv u the map Φ\Phi is a linear map, up to an error that dies faster than the displacement:

Φ(u+h)=Φ(u)+DΦ(u)h+o(h). \Phi(\vv u+\vv h) = \Phi(\vv u) + \mathrm{D}\Phi(\vv u)\,\vv h + o(\abs{\vv h}). (0.6.42)

Second, from Chapter 0.4, a linear map AA takes a region of volume VV to a region of volume detAV\abs{\det A}\,V. That is what the determinant is: the signed factor by which a linear map scales volume. The absolute value is there because volume does not care about orientation.

Now put the two together. Chop UU into tiny cubes of side ϵ\epsilon. The cube at u\vv u is a set of displacements h\vv h of size at most ϵn\epsilon\sqrt n, so (0.6.42) says its image under Φ\Phi is a parallelepiped, namely the image of the cube under the linear map DΦ(u)\mathrm{D}\Phi(\vv u), translated to Φ(u)\Phi(\vv u), with a distortion that is small compared to ϵ\epsilon. Apply the second fact to that parallelepiped and its volume is

vol(Φ(cube))  =  detDΦ(u)  ϵn(1+o(1)). \mathrm{vol}\big(\Phi(\text{cube})\big) \;=\; \abs{\det \mathrm{D}\Phi(\vv u)}\;\epsilon^{n}\,\big(1+o(1)\big). (0.6.43)

That is the statement about one cell, and an integral is a sum over cells. So sum f(Φ(u))f(\Phi(\vv u)) times that volume over all the cubes and let ϵ0\epsilon\to0. Doing so turns the Riemann sums of Chapter 0.2 on one side into the Riemann sums on the other, and what comes out is

  Φ(U)f(x)dnx  =  Uf(Φ(u))  detDΦ(u)  dnu.   \boxed{\;\int_{\Phi(U)} f(\vv x)\,\dd^{n}x \;=\; \int_{U} f\big(\Phi(\vv u)\big)\;\abs{\det\mathrm{D}\Phi(\vv u)}\;\dd^{n}u.\;} (0.6.44)

Check it against the one-dimensional case you already know. There detDΦ=Φ\det\mathrm{D}\Phi = \Phi', and the formula is the substitution rule of Chapter 0.2, with the absolute value doing the job that reversing the limits of integration does there. The factor detDΦ\abs{\det \mathrm{D}\Phi} is called the Jacobian determinant. It is the local volume-magnification of the coordinate change, and it is nothing more mysterious than that.

Grind box — what that argument does and doesn't establish

The chop-and-sum argument is the right picture and it is how every physicist thinks about the Jacobian, but it is not a proof, and it is worth being clear about where the gap is.

Two things were glossed. (i) Uniformity. The o(1)o(1) in (0.6.43) must shrink at a rate that does not depend on which cube you are looking at. Otherwise summing a large number of small errors need not give a small total. This is delivered by continuity of DΦ\mathrm{D}\Phi on a compact region, which is the usual hypothesis. (ii) The boundary. Cubes that straddle the edge of UU are only partly inside, and one must show their total contribution vanishes. It does, because the boundary of a reasonable region has nn-dimensional volume zero. But "reasonable" needs defining, and doing that properly is where measure theory enters and where the theorem is genuinely a theorem.

What the argument does establish, and what you should take from it, is the mechanism. The det\abs{\det} appears because differentiability means local linearity, and because determinants are what linear maps do to volume. Change either fact and the formula changes with it.

8.1 · Polar coordinates — paying Chapter 0.2's debt

In Chapter 0.2, deriving the Gaussian integral, we needed the polar area element and obtained it geometrically, by differencing two circular sectors. It was an honest argument, but it was special to the plane and to circles, and the chapter explicitly said that Chapter 0.6 would produce the same factor mechanically. Here is that promise kept.

The plan is to write down the map, take its Jacobian, and take the determinant of that. So take Φ(r,θ)=(rcosθ,  rsinθ)\Phi(r,\theta) = (r\cos\theta,\;r\sin\theta). Its Jacobian is a 2×22\times2 matrix of partials, computed by the rules of §1, which is to say by differentiating each output with respect to each input:

DΦ=(xrxθyryθ)=(cosθrsinθsinθrcosθ). \mathrm{D}\Phi = \begin{pmatrix} \pdv{x}{r} & \pdv{x}{\theta}\\[6pt] \pdv{y}{r} & \pdv{y}{\theta}\end{pmatrix} = \begin{pmatrix} \cos\theta & -r\sin\theta\\ \sin\theta & \phantom{-}r\cos\theta\end{pmatrix}. (0.6.45)

What we want from that matrix is the volume factor, which means its determinant. Take it by the 2×22\times2 rule adbcad-bc of Chapter 0.4, and use cos2θ+sin2θ=1\cos^{2}\theta+\sin^{2}\theta=1 at the end:

detDΦ=rcos2θ+rsin2θ=r, \det\mathrm{D}\Phi = r\cos^{2}\theta + r\sin^{2}\theta = r, (0.6.46)

The general formula (0.6.44) asks for the absolute value of that, and r0r\ge0 makes the absolute value do nothing. So the area element in polar coordinates is

dxdy  =  rdrdθ. \dd x\,\dd y \;=\; r\,\dd r\,\dd\theta. (0.6.47)

That is the factor Chapter 0.2 used on faith, now derived from the definition of the determinant. The debt is paid, and the derivation cost three lines instead of a picture.

Notice that it also explains the geometric argument rather than replacing it. The columns of (0.6.45) are the displacement produced by a unit change in rr, which has length 11 and points radially, and the displacement produced by a unit change in θ\theta, which has length rr and points tangentially. Those two are perpendicular, so the parallelogram they span has area 1×r=r1\times r = r. The determinant computed the area of the little polar cell, which is precisely what the sector argument computed by hand.

8.2 · Spherical coordinates

The same procedure works in three dimensions, and it is worth doing once because the answer is one you will use constantly. Take x=rsinθcosϕx=r\sin\theta\cos\phi, y=rsinθsinϕy=r\sin\theta\sin\phi and z=rcosθz=r\cos\theta, with θ\theta measured from the zz-axis as physics always does. Differentiating each output with respect to each input gives

DΦ=(sinθcosϕrcosθcosϕrsinθsinϕsinθsinϕrcosθsinϕrsinθcosϕcosθrsinθ0). \mathrm{D}\Phi = \begin{pmatrix} \sin\theta\cos\phi & r\cos\theta\cos\phi & -r\sin\theta\sin\phi\\ \sin\theta\sin\phi & r\cos\theta\sin\phi & \phantom{-}r\sin\theta\cos\phi\\ \cos\theta & -r\sin\theta & 0 \end{pmatrix}. (0.6.48)

We want that matrix's determinant, and we may expand along whichever row or column is cheapest. The bottom row has a zero in it, so expanding along it costs only two cofactors instead of three. Start with the cosθ\cos\theta entry, which multiplies

det(rcosθcosϕrsinθsinϕrcosθsinϕrsinθcosϕ)=r2sinθcosθ, \det\begin{pmatrix} r\cos\theta\cos\phi & -r\sin\theta\sin\phi\\ r\cos\theta\sin\phi & \phantom{-}r\sin\theta\cos\phi\end{pmatrix} = r^{2}\sin\theta\cos\theta, (0.6.49)

after using cos2ϕ+sin2ϕ=1\cos^{2}\phi+\sin^{2}\phi=1. The other surviving entry is rsinθ-r\sin\theta, and with the alternating sign (1)3+2=1(-1)^{3+2}=-1 it multiplies (rsin2θ)-\big(r\sin^{2}\theta\big). That is both cofactors, so add the two contributions to get the determinant:

detDΦ=r2sinθcos2θ+r2sin3θ=r2sinθ, \det\mathrm{D}\Phi = r^{2}\sin\theta\cos^{2}\theta + r^{2}\sin^{3}\theta = r^{2}\sin\theta, (0.6.50)

using cos2θ+sin2θ=1\cos^{2}\theta+\sin^{2}\theta=1 once more. Feed that determinant into (0.6.44) and the volume element in spherical coordinates is

dV=r2sinθ  drdθdϕ, \dd V = r^{2}\sin\theta\;\dd r\,\dd\theta\,\dd\phi, (0.6.51)

This is positive for θ(0,π)\theta\in(0,\pi), so once again the absolute value takes care of itself. Problem 1 uses this to compute the volume of a sphere, which is the cheapest possible check that the factor is right.

8.3 · The same factor, in general relativity

One forward glance, because the connection is exact rather than analogical. In curved spacetime the invariant volume element is written g  d4x\sqrt{-g}\;\dd^{4}x, where g=detgμνg=\det g_{\mu\nu} is the determinant of the metric. It is negative because of the Lorentzian signature, which is why there is a minus sign under the root. That g\sqrt{-g} is (0.6.44) wearing different clothes.

You can see that without any relativity at all, using the flat-space metrics of §4 and comparing them with the two determinants we just computed. In plane polar coordinates gij=diag(1,r2)g_{ij}=\mathrm{diag}(1,r^{2}), so

detgij=1r2=r, \sqrt{\det g_{ij}} = \sqrt{1\cdot r^{2}} = r, (0.6.52)

which is exactly the factor in (0.6.47). Now try the same thing one dimension up. In spherical coordinates the metric is ds2=dr2+r2dθ2+r2sin2θdϕ2\dd s^{2}=\dd r^{2}+r^{2}\dd\theta^{2}+r^{2}\sin^{2}\theta\,\dd\phi^{2}, so gij=diag(1,r2,r2sin2θ)g_{ij}=\mathrm{diag}(1,\,r^{2},\,r^{2}\sin^{2}\theta), and its determinant gives

detgij=r4sin2θ=r2sinθ, \sqrt{\det g_{ij}} = \sqrt{r^{4}\sin^{2}\theta} = r^{2}\sin\theta, (0.6.53)

which is exactly (0.6.51). The agreement is not a coincidence of these two examples. The reason is structural, and Chapter 3.5 §6.2 will show it. Under a coordinate change the metric picks up two factors of the Jacobian matrix, so its determinant picks up (detJ)2(\det J)^{2} and g\sqrt{\abs{g}} picks up detJ\abs{\det J}. That is precisely what cancels the detJ1\abs{\det J}^{-1} that dnx\dd^{n}x acquires. The combination gdnx\sqrt{\abs{g}}\,\dd^{n}x is therefore the same in every coordinate system, which is what "invariant volume element" means. The Einstein–Hilbert action of Chapter 3.6 carries that factor for this reason and no other.

The same det\abs{\det} turns up every time you change variables in a path integral (Chapter 5.7). There it is no longer a nuisance factor but the whole story. The Faddeev–Popov ghosts of non-abelian gauge theory are the Jacobian determinant of a change of variables, promoted to a field.

In plain terms 0.6.8

Near any point a differentiable map is a linear map, to within an error dying faster than the step you took; and a linear map multiplies every volume by its determinant. Those two facts settle the last question. Chop a region into cells small enough for the first to hold, apply the second to each cell, and the factor appearing in every change of variables is the size of that determinant, which is a local volume magnification and nothing more mysterious.

Two familiar weights thereby stop being items to memorise. The radial factor in plane polar coordinates and the more elaborate one in spherical coordinates both fall out of a short calculation, and the first repays a debt taken out several chapters ago, where it had to be got by cutting up a circle by hand. The same quantity returns in curved spacetime as the square root of the metric's determinant, which is why the volume element of general relativity looks as it does.

That closes the toolkit's account of change. A rate of change is a linear approximation; the description worth having is the one in which a problem separates into pieces that ignore each other; and changing description costs a determinant. What is missing is any account of accumulating a quantity across a region rather than at a point, and that is where the next chapters go.

9 · Worked examples

Worked example 1 — the Boltzmann distribution, from two constraints

A system can be in states 1,,N1,\ldots,N with energies EiE_{i}. All you know is that the probabilities sum to one and that the mean energy is Eˉ\bar E. What distribution should you assign?

The principle to use is due to Gibbs and was sharpened by Jaynes. Choose the distribution that maximises the entropy S=ipilnpiS=-\sum_{i}p_{i}\ln p_{i}, which is the distribution that is maximally noncommittal about everything you were not told. That is a constrained maximisation, exactly what §7 handles. So maximise SS subject to

g1=ipi=1,g2=ipiEi=Eˉ. g_{1}=\sum_{i}p_{i}=1, \qquad g_{2}=\sum_{i}p_{i}E_{i}=\bar E.

Two constraints, two multipliers. Form the Lagrangian of the grind box in §7, calling the multipliers α\alpha and β\beta:

L=ipilnpi    α(ipi1)    β(ipiEiEˉ). \mathcal{L} = -\sum_{i}p_{i}\ln p_{i} \;-\;\alpha\Big(\sum_{i}p_{i}-1\Big)\;-\;\beta\Big(\sum_{i}p_{i}E_{i}-\bar E\Big).

The variables are the NN numbers pip_{i}, so take NN partial derivatives. Using pi(pilnpi)=lnpi+1\pdv{}{p_{i}}\big(p_{i}\ln p_{i}\big)=\ln p_{i}+1:

Lpi=lnpi1αβEi=0pi=e1αeβEi. \pdv{\mathcal{L}}{p_{i}} = -\ln p_{i} - 1 - \alpha - \beta E_{i} = 0 \qquad\Longrightarrow\qquad p_{i} = \ee^{-1-\alpha}\,\ee^{-\beta E_{i}}.

Look at the two factors separately. The first carries no ii, so it is the same for every state, which means normalisation alone will fix it. Imposing ipi=1\sum_{i}p_{i}=1 gives e1α=1/Z\ee^{-1-\alpha}=1/Z with

  pi=eβEiZ,Z(β)=ieβEi.   \boxed{\;p_{i} = \frac{\ee^{-\beta E_{i}}}{Z},\qquad Z(\beta)=\sum_{i}\ee^{-\beta E_{i}}.\;}

That is the Boltzmann distribution. The quantity ZZ arrived as nothing more grand than a normalisation constant, and it is the partition function, from which all of equilibrium thermodynamics is extracted by differentiation. For instance Eˉ=βlnZ\bar E = -\partial_{\beta}\ln Z, which is the second constraint restated and is what implicitly determines β\beta.

Is it a maximum? §6 answers this without any extra work. The Hessian of SS with respect to the pip_{i} is ijS=δij/pi\partial_{i}\partial_{j}S = -\delta_{ij}/p_{i}, a diagonal matrix with all entries negative, so all its eigenvalues are negative and the critical point is a genuine maximum. Being diagonal, it leaves the spectral theorem with nothing to do, since the eigenvalues are the diagonal entries. It is still §6.3 doing the work.

What β\beta is. It arrived as a multiplier on the energy constraint. By (0.6.40), a multiplier is the sensitivity of the optimum to its constraint level, so here

β=dSdEˉ, \beta = \dv{S^{*}}{\bar E},

That is the rate at which the maximum attainable entropy rises when you feed the system more energy. We now want to know what that rate is in physical terms, so compare it with the thermodynamic definition of temperature, 1/T=SthermoU1/T = \pdv{S_{\text{thermo}}}{U}. Thermodynamic entropy is kBk_{B} times the information entropy used above, so 1/T=kBβ1/T = k_{B}\beta, giving

β=1kBT. \beta = \frac{1}{k_{B}T}.

This is the honest route to that identification. We did not define β\beta as 1/kBT1/k_{B}T and then justify the choice. It emerged as a Lagrange multiplier, and it is identified with inverse temperature because §7.1 says multipliers are sensitivities and thermodynamics says S/U\partial S/\partial U is one over the temperature. Temperature is a shadow price.

Two remarks are worth carrying away from this. First, that calculation is most of statistical mechanics. Everything else is evaluating ZZ for particular energy spectra and differentiating it.

Second, look at the shape of the answer. It is a probability proportional to eβ(something)\ee^{-\beta(\text{something})}, normalised by a sum over all possibilities. In Chapter 5.6 the path integral assigns to each history a weight eiS/\ee^{\ii S/\hbar}, normalised by a sum over all histories. The structures are the same down to the last symbol, with iS/\ii S/\hbar in place of βE-\beta E. And the substitution tiτt\to-\ii\tau that converts one into the other is the reason a quantum field theory at finite temperature and a statistical mechanics problem in one extra dimension are the same computation.

Worked example 2 — classifying every critical point of a double well

Find and classify all critical points of f(x,y)=x4+y44xyf(x,y)=x^{4}+y^{4}-4xy.

Locate them. A critical point is where the gradient vanishes, so set both partials to zero and solve:

xf=4x34y=0,yf=4y34x=0y=x3,    x=y3. \partial_{x}f = 4x^{3}-4y = 0, \qquad \partial_{y}f = 4y^{3}-4x = 0 \qquad\Longrightarrow\qquad y=x^{3},\;\; x=y^{3}.

Substituting the first of those into the second gives x=x9x = x^{9}, so x(x81)=0x\big(x^{8}-1\big)=0, and over the reals that means x=0x=0 or x=±1x=\pm1. Reading off the matching y=x3y=x^{3}, the critical points are

(0,0),(1,1),(1,1), (0,0), \qquad (1,1), \qquad (-1,-1),

with f(0,0)=0f(0,0)=0 and f(±1,±1)=1+14=2f(\pm1,\pm1)=1+1-4=-2.

The Hessian. To classify those three points we need the matrix of second derivatives, so differentiate the gradient again:

H(x,y)=(12x24412y2), H(x,y) = \begin{pmatrix} 12x^{2} & -4\\ -4 & 12y^{2}\end{pmatrix},

It is symmetric, as Clairaut promised. We may as well check that directly: yxf=y(4x34y)=4\partial_{y}\partial_{x}f = \partial_{y}(4x^{3}-4y) = -4 and xyf=x(4y34x)=4\partial_{x}\partial_{y}f = \partial_{x}(4y^{3}-4x) = -4. ✓

At the origin. H=(0440)H=\begin{pmatrix}0&-4\\-4&0\end{pmatrix}. Its eigenvalues solve det(HμI)=μ216=0\det(H-\mu I) = \mu^{2}-16=0, so μ=±4\mu=\pm4. The eigenvectors can be found by inspection, since H(1,1)T=(4,4)TH(1,-1)^{\mathsf T} = (4,-4)^{\mathsf T} and H(1,1)T=(4,4)TH(1,1)^{\mathsf T}=(-4,-4)^{\mathsf T}. So

μ+=+4  along  12(1,1),μ=4  along  12(1,1). \mu_{+}=+4 \ \text{ along } \ \tfrac{1}{\sqrt2}(1,-1), \qquad \mu_{-}=-4 \ \text{ along } \ \tfrac{1}{\sqrt2}(1,1).

Mixed signs: a saddle. And (0.6.33) says exactly what it should look like. Check it against the function directly. Along the displacement (t,t)(t,t),

f(t,t)=t4+t44tt=2t44t2, f(t,t) = t^{4}+t^{4}-4t\cdot t = 2t^{4}-4t^{2},

which falls for small tt. Along (t,t)(t,-t) we get f=2t4+4t2f = 2t^{4}+4t^{2}, which rises. The quadratic terms match the prediction as well. The displacement (t,t)(t,t) has component c=h12(1,1)=t2c = \vv h\cdot\tfrac1{\sqrt2}(1,1) = t\sqrt2 along the unit eigenvector, so (0.6.31) predicts 12μc2=12(4)(2t2)=4t2\tfrac12\mu_{-}c^{2} = \tfrac12(-4)(2t^{2}) = -4t^{2}, which is exactly the 4t2-4t^{2} above. ✓ Likewise 12(+4)(2t2)=+4t2\tfrac12(+4)(2t^{2}) = +4t^{2} in the other direction.

At (1,1)(1,1). H=(124412)H=\begin{pmatrix}12&-4\\-4&12\end{pmatrix}. The eigenvectors are the same as before, because any matrix of the form aI+bJaI+bJ with J=(0110)J=\begin{pmatrix}0&1\\1&0\end{pmatrix} has eigenvectors (1,1)(1,1) and (1,1)(1,-1). Only the eigenvalues have changed:

μ=124:μ1=8  along  12(1,1),μ2=16  along  12(1,1). \mu = 12\mp4: \qquad \mu_{1}=8 \ \text{ along } \ \tfrac1{\sqrt2}(1,1), \qquad \mu_{2}=16 \ \text{ along } \ \tfrac1{\sqrt2}(1,-1).

Both are positive, so this is a local minimum. The principal curvatures are 88 and 1616, so the valley floor is twice as stiff across the diagonal as along it. The elliptical contours around the minimum therefore have semi-axis ratio 16/8=2\sqrt{16/8}=\sqrt2, and the long axis runs along (1,1)(1,1), which is the soft direction. By the symmetry f(x,y)=f(x,y)f(-x,-y)=f(x,y) the point (1,1)(-1,-1) is an identical minimum.

What you have just drawn. Two degenerate minima of equal depth, related by a symmetry, with a saddle sitting at the symmetric point between them. That is the double well, and it is the entire mechanism of spontaneous symmetry breaking. The potential respects the symmetry (x,y)(x,y)(x,y)\to(-x,-y), but the system must sit in one minimum or the other, and so the system does not.

Now look once more at the soft direction along (1,1)(1,1) at the minimum, the one belonging to the small eigenvalue. It is the direction along which the system is easiest to excite. In Chapter 0.8 that becomes the lowest normal mode. In Chapter 6.6, where the symmetry is continuous rather than discrete and the soft direction becomes exactly flat, it becomes a massless Goldstone boson. The eigenvalues of a Hessian are, quite literally, masses squared.

10 · Your turn

Problem 1 — the spherical volume element, and a check

Verify the Jacobian determinant r2sinθr^{2}\sin\theta for spherical coordinates by expanding (0.6.48) along its first column instead of its last row (you should get the same answer). Then use (0.6.51) to compute the volume of a ball of radius RR, and the surface area of a sphere of radius RR.

Solution

The determinant. Expanding along the first column, with entries sinθcosϕ\sin\theta\cos\phi, sinθsinϕ\sin\theta\sin\phi, cosθ\cos\theta and signs +,,++,-,+:

det=  sinθcosϕ(0+r2sin2θcosϕ)sinθsinϕ(0r2sin2θsinϕ)+cosθ(r2sinθcosθcos2ϕ+r2sinθcosθsin2ϕ). \begin{aligned} \det = \;&\sin\theta\cos\phi\,\big(0 + r^{2}\sin^{2}\theta\cos\phi\big)\\ &-\sin\theta\sin\phi\,\big(0 - r^{2}\sin^{2}\theta\sin\phi\big)\\ &+\cos\theta\,\big(r^{2}\sin\theta\cos\theta\cos^{2}\phi + r^{2}\sin\theta\cos\theta\sin^{2}\phi\big). \end{aligned}

The first two lines give r2sin3θ(cos2ϕ+sin2ϕ)=r2sin3θr^{2}\sin^{3}\theta(\cos^{2}\phi+\sin^{2}\phi)=r^{2}\sin^{3}\theta, and the third gives r2sinθcos2θr^{2}\sin\theta\cos^{2}\theta. Adding them, det=r2sinθ(sin2θ+cos2θ)=r2sinθ\det = r^{2}\sin\theta(\sin^{2}\theta+\cos^{2}\theta) = r^{2}\sin\theta. ✓ Same answer, as it must be, since the determinant does not know which row you expanded along.

Volume. Now integrate that element over the ball. The integrand factorises completely, so the triple integral is a product of three one-dimensional ones:

V=0R ⁣ ⁣0π ⁣ ⁣02πr2sinθ  dϕdθdr=(0R ⁣r2dr) ⁣(0π ⁣sinθdθ) ⁣(02π ⁣dϕ). V = \int_{0}^{R}\!\!\int_{0}^{\pi}\!\!\int_{0}^{2\pi} r^{2}\sin\theta\;\dd\phi\,\dd\theta\,\dd r = \left(\int_{0}^{R}\!r^{2}\dd r\right)\!\left(\int_{0}^{\pi}\!\sin\theta\,\dd\theta\right)\!\left(\int_{0}^{2\pi}\!\dd\phi\right).

Those three factors are R3/3R^{3}/3, then [cosθ]0π=2\big[-\cos\theta\big]_{0}^{\pi}=2, and then 2π2\pi. Multiplying them together,

V=R3322π=43πR3.   V = \frac{R^{3}}{3}\cdot 2\cdot 2\pi = \frac{4}{3}\pi R^{3}. \;\checkmark

Area. Fix r=Rr=R; the surface element is what remains after dropping dr\dd r and setting r=Rr=R, namely dA=R2sinθdθdϕ\dd A = R^{2}\sin\theta\,\dd\theta\,\dd\phi, so A=R222π=4πR2A = R^{2}\cdot2\cdot2\pi=4\pi R^{2}. Note that dVdR=4πR2=A\dv{V}{R}=4\pi R^{2}=A, which is not a coincidence: growing the ball by dR\dd R adds a shell of area AA and thickness dR\dd R. That is the fundamental theorem of Chapter 0.2 in three dimensions, and Chapter 0.7 turns the observation into the divergence theorem.

The sinθ\sin\theta is doing something physical, incidentally. It says that a patch of dθ×dϕ\dd\theta\times\dd\phi near the pole covers less area than the same patch at the equator, because the circles of constant θ\theta shrink to points there. Any map projection you have ever complained about is a fight with this factor.

Problem 2 — the Coulomb field as a gradient

Let ϕ(r)=1/r\phi(\vv r) = 1/r where r=r=x2+y2+z2r = \abs{\vv r} = \sqrt{x^{2}+y^{2}+z^{2}}, defined for r0\vv r\neq\vv 0. (a) Compute ϕ\nabla\phi. (b) Verify that it is perpendicular to the level sets of ϕ\phi. (c) At the point (1,2,2)(1,2,2), give the direction of steepest ascent of ϕ\phi and the rate of increase in that direction. (d) Interpret ϕ-\nabla\phi.

Solution

(a) Since ϕ\phi depends on the coordinates only through rr, the useful first step is rx\pdv{r}{x}. From r2=x2+y2+z2r^{2}=x^{2}+y^{2}+z^{2}, differentiate both sides with respect to xx to get 2rrx=2x2r\,\pdv{r}{x} = 2x, so rx=x/r\pdv{r}{x}=x/r, and likewise for yy and zz. Compactly, r=r/r=r^\nabla r = \vv r/r = \hat{\vv r}. That is reassuring: the direction of fastest increase of distance from the origin is straight outward, at unit rate. Now apply the chain rule of §5.1 with ϕ=r1\phi = r^{-1}:

ϕ=dϕdrr=1r2r^=rr3. \nabla\phi = \dv{\phi}{r}\,\nabla r = -\frac{1}{r^{2}}\,\hat{\vv r} = -\frac{\vv r}{r^{3}}.

(b) The level sets 1/r=c1/r=c are the spheres r=1/cr=1/c. A curve on such a sphere has x(t)\abs{\vv x(t)} constant, so differentiating xx=const\vv x\cdot\vv x = \text{const} gives 2xx˙=02\,\vv x\cdot\dot{\vv x}=0, so tangent vectors to a sphere are perpendicular to the radius. And ϕ\nabla\phi is parallel to the radius. Hence ϕx˙=0\nabla\phi\cdot\dot{\vv x}=0. ✓ That is (0.6.17) confirmed in a case where you can see both objects at once.

(c) Evaluate the gradient at the given point. At (1,2,2)(1,2,2) we have r=1+4+4=3r=\sqrt{1+4+4}=3, so

ϕ=(1,2,2)27,ϕ=327=19=1r2. \nabla\phi = -\frac{(1,2,2)}{27}, \qquad \abs{\nabla\phi} = \frac{3}{27} = \frac19 = \frac{1}{r^{2}}.

By §3.1 the steepest-ascent direction is ϕ/ϕ=13(1,2,2)\nabla\phi/\abs{\nabla\phi} = -\tfrac13(1,2,2), which is a unit vector pointing directly at the origin, and the rate is ϕ=1/9\abs{\nabla\phi}=1/9. That makes sense in hindsight, since 1/r1/r increases fastest when you head straight for the singularity.

(d) ϕ=r/r3=r^/r2-\nabla\phi = \vv r/r^{3} = \hat{\vv r}/r^{2}. That is an inverse-square field pointing radially outward. It is the electric field of a positive point charge, in units with q/4πϵ0=1q/4\pi\epsilon_{0}=1, or minus the gravitational field of a point mass. The relation E=ϕ\vv E = -\nabla\phi is the definition of the potential, and the minus sign is the statement that things fall down the gradient. Forces point in the direction of steepest descent of the potential energy, which by §3.1 is the direction ϕ/ϕ-\nabla\phi/\abs{\nabla\phi}. Chapter 0.7 takes this field and computes its flux, and Chapter 1.2 takes the same ϕ\phi and derives the orbit.

Problem 3 — maximum entropy with nothing to go on

Repeat Worked example 1 with only the normalisation constraint ipi=1\sum_{i}p_{i}=1: maximise S=ipilnpiS=-\sum_{i}p_{i}\ln p_{i} over NN states. Show that the answer is the uniform distribution and find the maximum entropy. Then obtain the same result as a limit of the Boltzmann distribution, and say what physical situation that limit describes.

Solution

One constraint, one multiplier:

L=ipilnpiα(ipi1),Lpi=lnpi1α=0. \mathcal{L} = -\sum_{i}p_{i}\ln p_{i} - \alpha\Big(\sum_{i}p_{i}-1\Big), \qquad \pdv{\mathcal{L}}{p_{i}} = -\ln p_{i}-1-\alpha = 0.

So pi=e1αp_{i} = \ee^{-1-\alpha}, which is the same value for every ii, because the right-hand side carries no ii at all. That single observation is the whole result. Normalising gives Ne1α=1N\ee^{-1-\alpha}=1, so

pi=1N,Smax=i=1N1Nln1N=lnN. p_{i} = \frac{1}{N}, \qquad S_{\max} = -\sum_{i=1}^{N}\frac1N\ln\frac1N = \ln N.

The Hessian is again diag(1/pi)=diag(N)\mathrm{diag}(-1/p_{i}) = \mathrm{diag}(-N), negative definite, so it is a maximum (§6.3). "Maximum entropy = uniform" is thus a one-line consequence of §7, not a separate principle.

As a limit. Boltzmann gives pi=eβEi/Zp_{i}=\ee^{-\beta E_{i}}/Z. As β0\beta\to0 every exponential tends to 11 and ZNZ\to N, so pi1/Np_{i}\to1/N. Since β=1/kBT\beta=1/k_{B}T, the limit β0\beta\to0 is TT\to\infty: at infinite temperature every state is equally likely, because the energy constraint has stopped costing anything. Consistently, (0.6.40) reads β=dSdEˉ\beta = \dv{S^{*}}{\bar E}, and at the unconstrained maximum SS^{*} is stationary in Eˉ\bar E, so β=0\beta=0. The two statements are the same statement.

Why this matters beyond the algebra. The result pi=1/Np_{i}=1/N is the "equal a priori probabilities" postulate of the microcanonical ensemble. That assumption is usually placed at the very foundation of statistical mechanics and defended with hand-waving about ergodicity. Here it is a theorem: given only that the probabilities sum to one, the least presumptuous distribution is the flat one. And Smax=lnNS_{\max}=\ln N is Boltzmann's S=kBlnWS=k_{B}\ln W carved on his headstone, with W=NW=N the number of accessible states.

Problem 4 — mixed partials and a full classification

(a) Verify Clairaut's theorem explicitly for f(x,y)=x3y2+exyf(x,y) = x^{3}y^{2} + \ee^{xy} by computing yxf\partial_{y}\partial_{x}f and xyf\partial_{x}\partial_{y}f separately. (b) Find all critical points of h(x,y)=x3+y33xyh(x,y) = x^{3}+y^{3}-3xy and classify each one using the eigenvalues of its Hessian, stating the principal curvature directions.

Solution

(a) Treating yy as constant, xf=3x2y2+yexy\partial_{x}f = 3x^{2}y^{2} + y\,\ee^{xy}. Now differentiate that in yy, using the product rule on both terms:

yxf=6x2y+exy+xyexy. \partial_{y}\partial_{x}f = 6x^{2}y + \ee^{xy} + xy\,\ee^{xy}.

The other order: yf=2x3y+xexy\partial_{y}f = 2x^{3}y + x\,\ee^{xy}, and differentiating in xx,

xyf=6x2y+exy+xyexy. \partial_{x}\partial_{y}f = 6x^{2}y + \ee^{xy} + xy\,\ee^{xy}.

Identical. ✓ Both second partials are continuous everywhere (they are polynomials and exponentials), so Clairaut's hypothesis holds and the agreement was guaranteed in advance.

(b) Critical points. xh=3x23y=0\partial_{x}h = 3x^{2}-3y=0 and yh=3y23x=0\partial_{y}h=3y^{2}-3x=0 give y=x2y=x^{2} and x=y2x=y^{2}. Substituting, x=x4x = x^{4}, so x(x31)=0x(x^{3}-1)=0 and x{0,1}x\in\{0,1\} over the reals. The critical points are (0,0)(0,0) with h=0h=0, and (1,1)(1,1) with h=1+13=1h=1+1-3=-1.

The Hessian. H(x,y)=(6x336y)H(x,y) = \begin{pmatrix}6x & -3\\ -3 & 6y\end{pmatrix}.

At (0,0)(0,0): H=(0330)H=\begin{pmatrix}0&-3\\-3&0\end{pmatrix}, characteristic equation μ29=0\mu^{2}-9=0, so μ=±3\mu=\pm3. The eigenvector for μ=+3\mu=+3 is (1,1)/2(1,-1)/\sqrt2 and for μ=3\mu=-3 is (1,1)/2(1,1)/\sqrt2 (check: H(1,1)T=(3,3)TH(1,-1)^{\mathsf T}=(3,-3)^{\mathsf T} ✓). Mixed signs, so a saddle: hh curves upward along (1,1)(1,-1) and downward along (1,1)(1,1), each with curvature 33.

At (1,1)(1,1): H=(6336)H=\begin{pmatrix}6&-3\\-3&6\end{pmatrix}, eigenvalues 636\mp3, i.e. μ=3\mu=3 along (1,1)/2(1,1)/\sqrt2 and μ=9\mu=9 along (1,1)/2(1,-1)/\sqrt2. Both positive, so a local minimum, three times stiffer across the diagonal than along it. The contours near it are ellipses elongated by 9/3=3\sqrt{9/3}=\sqrt3 in the (1,1)(1,1) direction.

Sanity checks worth doing. The determinant of HH is 36xy936xy-9, which is 9<0-9\lt0 at the origin and +27>0+27\gt0 at (1,1)(1,1). Since detH=μ1μ2\det H = \mu_{1}\mu_{2} (Chapter 0.5), a negative determinant in two dimensions immediately signals opposite signs and hence a saddle, with no eigenvector computation at all. That is the standard "second derivative test" for two variables: detH<0\det H\lt0 means saddle, and detH>0\det H\gt0 with x2h>0\partial_{x}^{2}h\gt0 means minimum. It is not a separate rule. It is §6.3 plus the fact that the determinant is the product of the eigenvalues. Notice too that it stops being usable in three dimensions, where a positive determinant is compatible with two negative eigenvalues. The eigenvalue formulation is the one that generalises.

Note also that hh is unbounded below (take y=0y=0, xx\to-\infty), so the local minimum at (1,1)(1,1) is emphatically not global. §6 is a local theory: the Hessian is a statement about a neighbourhood and knows nothing about what happens far away.

The brick you just laid

You took one equation from Chapter 0.1 and let the displacement be a vector. Out of that came the total derivative Df(a)\mathrm{D}f(\vv a), a unique linear map whose matrix is the Jacobian. With it came the recognition that partial derivatives are its components, and that they can exist without it.

You derived the steepest-ascent property of the gradient from Cauchy–Schwarz, and its perpendicularity to level sets from the chain rule. You saw that turning df\dd f into f\nabla f requires a metric, and you met your first covector doing it.

The chain rule became a product of Jacobians and quietly produced the summation convention. The Hessian, symmetric by Clairaut and therefore diagonalisable by the spectral theorem, classified critical points by its eigenvalues and told you the principal curvatures. Lagrange multipliers came from a picture, that of a level set tangent to a constraint, and turned out to be sensitivities. And the Jacobian determinant converted local linearity plus the determinant-as-volume into every change-of-variables formula there is.

Where this gets spent.

  • The total derivative → Chapter 1.2, where the same definition applied to a functional gives the Euler–Lagrange equations; Chapter 3.2, where Df\mathrm{D}f becomes the pushforward between tangent spaces on a manifold.
  • The gradient as a one-form → Chapter 2.4 (upper and lower indices, made a convention), Chapter 3.2 (the cotangent space), Chapter 3.3 (raising and lowering with gμνg^{\mu\nu}), Chapter 3.5 (where df\dd f becomes the exterior derivative and d2=0\dd^{2}=0 starts doing work).
  • The chain rule as a matrix product → Chapter 2.4, where (0.6.26), promoted from a computation to a definition, is what a tensor is; Chapter 3.2, where it is how you change charts on a manifold.
  • Hessian + spectral theorem → Chapter 0.8 (normal modes: eigenvalues of the Hessian of the potential are the squared frequencies), Chapter 1.3 (stability of equilibria in phase space), Chapter 6.6 (the Higgs potential, where a zero eigenvalue is a massless particle).
  • Lagrange multipliers → Chapters 1.2 and 1.3 (constraint forces are multipliers, and now you know why they have units of force: they are sensitivities of an energy to a displacement), and later the constrained-Hamiltonian treatment of gauge theories, where the multipliers enforce Gauss's law.
  • The Jacobian determinant → Chapter 0.2's debt, now paid; Chapter 3.5's gd4x\sqrt{-g}\,\dd^{4}x; Chapter 5.7, where changing variables inside a path integral produces a determinant that is not a nuisance but a new field.

One thing to carry away above all others. Every result in this chapter came from replacing a number by a linear map. That is the only idea here. Chapter 0.7 replaces the linear map by something that varies from point to point, and asks what happens when you integrate it over a surface. The answer is Stokes' theorem, which is the fundamental theorem of calculus with the same substitution applied.