wiki / math

multivariable calculus

Partial derivatives & chain rule, gradient, optimization & Lagrange multipliers, multiple integrals, line & surface integrals, Green, Stokes & divergence theorems.

functions & partials · gradient & chain rule · optimization · multiple integrals · mass & moments · line & surface integrals · flux & divergence · green & stokes

Functions, partials & tangent planes

Functions of several variables. Any rule \((x,y)\mapsto f(x,y)\); the domain is the set of points where it is defined — e.g. \(\sqrt{1-x^2-y^2}\) needs \(x^2+y^2\le1\) (the unit disk; in three variables, the unit ball). Physical laws supply examples: \(E=\frac12mv^2\) is a function of \(m\) and \(v\); the ideal gas law \(PV=nRT\) makes each quantity a function of the other three.

Graphs & contour plots. The graph of \(f(x,y)\) is the surface \(z=f(x,y)\). Slicing with \(x=x_0\) or \(y=y_0\) gives single-variable graphs that assemble into the surface; horizontal slices \(z=c\) are the level curves (contours). Projecting all level curves onto the \(xy\)-plane gives the contour plot (temperature maps, topographic maps): distinct contours never cross, and tightly bunched contours mean a steep graph. A function of three variables has no drawable graph — visualize its level surfaces \(h(x,y,z)=c\) instead (for \(x^2+y^2+z^2\): nested spheres).

Partial derivatives. \(\dfrac{\partial f}{\partial x}\) (also \(f_x\), \(\left(\partial f/\partial x\right)_y\)): differentiate treating every other variable as a constant. Geometrically, \(f_x(x_0,y_0)\) is the slope of the graph in the \(x\) direction — the slope of the tangent line to the slice \(y=y_0\). Iterating gives higher partials \(f_{xx},f_{xy},\dots\); mixed partials are equal, \(f_{xy}=f_{yx}\) (true for any function with a multivariable Taylor expansion).

Tangent plane & linearization. \(z=f(x_0,y_0)+f_x(x_0,y_0)(x-x_0)+f_y(x_0,y_0)(y-y_0)\); a normal vector is \(\langle f_x,f_y,-1\rangle\). Equivalently the first-order Taylor approximation \(\Delta f\approx f_x\,\Delta x+f_y\,\Delta y\): the response of \(f\) to small changes in its inputs, written with differentials as the total differential \(\dd f=f_x\dd x+f_y\dd y\).

Taylor expansions. \(f(x,y)=\sum_{i,j}c_{ij}(x-x_0)^i(y-y_0)^j\) with \(c_{ij}=\dfrac{1}{i!\,j!}\dfrac{\partial^{\,i+j}f}{\partial x^i\partial y^j}\Big|_{(x_0,y_0)}\) (derived by differentiating the series repeatedly); anything built from polynomials, exponentials, trig and logs satisfies this multivariable Taylor hypothesis. Second order: \(\Delta f\approx f_x\Delta x+f_y\Delta y+\frac12f_{xx}\Delta x^2+f_{xy}\Delta x\Delta y+\frac12f_{yy}\Delta y^2\) — the quadratic terms measure how the graph deviates from its tangent plane.

Chain rule, gradient & directional derivatives

Chain rule. For \(z=f(x,y)\) with \(x(t),y(t)\): \(\dfrac{dz}{dt}=\dfrac{\partial f}{\partial x}\dfrac{dx}{dt}+\dfrac{\partial f}{\partial y}\dfrac{dy}{dt}\); with \(n\) variables, one term per variable. Through intermediate variables \(x(u,v),y(u,v)\): \(\dfrac{\partial z}{\partial u}=\dfrac{\partial z}{\partial x}\dfrac{\partial x}{\partial u}+\dfrac{\partial z}{\partial y}\dfrac{\partial y}{\partial u}\) — one term per route from \(z\) to \(u\). Justified by dividing \(\dd f=f_x\dd x+f_y\dd y\) by \(\dd t\) (or termwise from the Taylor series).

Parameterized curves. A vector-valued \(\vv{r}(t)=\langle x(t),y(t),z(t)\rangle\) describes motion along a curve. Velocity \(\vv{v}=\vv{r}'(t)\) is tangent to the curve; speed \(|\vv{r}'(t)|\); acceleration \(\vv{r}''(t)\). \(\vv{r}''=\vv{0}\Rightarrow\vv{r}=\vv{r}_0+t\vv{v}\): force-free motion is a straight line (lines & planes: see vectors).

Gradient. \(\nabla f=\langle f_x,f_y,\dots\rangle\) collects the partials; the chain rule becomes \(\dfrac{df}{dt}=\nabla f\cdot\vv{r}'(t)\) — the derivative of \(f\) along the curve.

Directional derivatives. For a unit vector \(\uvec{u}\), \(D_{\uvec{u}}f=\nabla f\cdot\uvec{u}=|\nabla f|\cos\theta\): the slope of the graph in direction \(\uvec{u}\). It vanishes perpendicular to \(\nabla f\) and is maximal (value \(|\nabla f|\)) along \(\nabla f\) — the graph is steepest perpendicular to its level curves. Following \(\pm\nabla f\) numerically is steepest ascent/descent, the engine of gradient methods in machine learning.

Gradient ⊥ level sets. Along a contour \(f=\text{const}\), \(0=\frac{d}{dt}f(\vv{r}(t))=\nabla f\cdot\vv{r}'\): the gradient is perpendicular to level curves and level surfaces. This gives the tangent plane to any surface \(g(x,y,z)=c\) at \(P\): \(\nabla g|_P\cdot(\vv{r}-\vv{r}_P)=0\) — far quicker than solving for \(z\) and using the graph formula.

Optimization & Lagrange multipliers

Quadratic forms. \(q(\vv{x})=\vv{x}^{\mathsf T}A\vv{x}\) with \(A\) symmetric: diagonal entries are the coefficients of \(x_i^2\), off-diagonal entries half the cross coefficients. Orthogonally diagonalizing \(A=UDU^{\mathsf T}\) rotates axes onto the orthonormal eigenvectors: \(q=\lambda_1q_1^2+\lambda_2q_2^2+\cdots\) in eigen-coordinates \(q_i=\uvec{u}_i\cdot\vv{x}\); the eigenvector directions are the principal axes. Level curves are ellipses when the eigenvalues share a sign, hyperbolas when signs are mixed.

Definiteness. All \(\lambda_i\gt0\): positive definite (absolute minimum at the origin); all \(\lambda_i\lt0\): negative definite (maximum); mixed signs: indefinite (saddle-shaped graph); some \(\lambda_i=0\): degenerate, detected by \(\det A=0\).

Critical points. At a local max/min every directional derivative vanishes, so \(\nabla f=\vv{0}\) (multivariable first-derivative test). Critical points are local minima, local maxima, or saddle points — and a local extremum need not be global.

Hessian & second-derivative test. \(H_f\) = symmetric matrix of second partials \((H_f)_{ij}=f_{x_ix_j}\); the second derivative in direction \(\uvec{u}\) is \(\uvec{u}^{\mathsf T}H_f\,\uvec{u}\), and near a critical point \(\Delta f\approx\frac12\,\Delta\vv{x}^{\mathsf T}H_f\,\Delta\vv{x}\). Classify by the definiteness of \(H_f\), checked without eigenvalues via determinants of the leading principal minors \(A_1,A_2,\dots\) ("upper-left corners"):

\(H_f\) at critical pointdeterminant testnature
positive definite\(\det A_k\gt0\) for all \(k\)local minimum
negative definitesigns alternate \(-,+,-,+,\dots\)local maximum
indefinite\(\det H_f\ne0\), fails both patternssaddle point
degenerate\(\det H_f=0\)inconclusive — higher-order Taylor terms decide (e.g. monkey saddle)

Two variables: local min if \(f_{xx}\gt0\) and \(f_{xx}f_{yy}-f_{xy}^2\gt0\); local max if \(f_{xx}\lt0\) and \(f_{xx}f_{yy}-f_{xy}^2\gt0\); saddle if \(f_{xx}f_{yy}-f_{xy}^2\lt0\).

Constrained optimization — Lagrange multipliers. On a closed domain, compare interior critical points against the boundary (the first-derivative test misses boundary extremes). On a constraint \(g=c\), extremes of \(f\) occur where a level curve of \(f\) just touches the constraint curve — the gradients are parallel: \(\nabla f=\lambda\nabla g\) (\(\lambda\) the Lagrange multiplier), solved simultaneously with \(g=c\). Check separately points where \(\nabla g=\vv{0}\) (singular points of the constraint, e.g. self-crossings) and corners where boundary pieces meet.

Double & triple integrals

Double integrals. \(\iint_Rf\dd A\) = signed volume between the graph of \(f\) and the region \(R\) (below-region volume counts negatively): the limit of \(\sum f\,\Delta A\) over a division of \(R\) into small pieces. \(\iint_R1\dd A=\operatorname{Area}(R)\); with \(f\) a density it is a mass (below).

Iterated integrals. Summing by vertical strips: \(\iint_Rf\dd A=\int_{x_{\min}}^{x_{\max}}\!\Big(\int_{y_{\min}(x)}^{y_{\max}(x)}f\dd y\Big)\dd x\), the inner limits tracing the strip endpoints; or integrate in \(x\) first. Each inner integral is an ordinary single-variable integral (calculus). Reversing the order means re-describing \(R\) — the new limits come from the region, not from swapping symbols — and may split the integral; choose the order that keeps \(R\) in one piece. If both limits are constants and \(f=g(x)h(y)\), the iterated integral factors into a product of two single integrals.

Polar coordinates. \(x=r\cos\theta\), \(y=r\sin\theta\), \(\dd A=r\dd r\dd\theta\) — a wedge with sides \(\Delta r\), \(\Delta\theta\) has area \(\approx r\,\Delta r\,\Delta\theta\), so the factor \(r\) is not optional. Natural for regions bounded by circles and rays; usually integrate radially first.

Triple integrals. \(\iiint_Bf\dd V\), with \(\iiint_B1\dd V=\operatorname{Volume}(B)\). Set up by projection — outer double integral over the shadow of \(B\), inner integral from \(z_{\min}(x,y)\) to \(z_{\max}(x,y)\) — or by slicing — outer single integral, inner double integral over each cross-section. In curvilinear coordinates the same choices reappear as vertical, axial, or radial projections; pick the one adapted to the region.

Coordinate systems. Physics convention: \(\theta\) is measured from the \(+z\) axis, \(\phi\) is the angle around it, \(\rho\) is distance to the \(z\) axis.

systemcoordinatesconversionelement
polar (2D)\((r,\theta)\)\(x=r\cos\theta,\; y=r\sin\theta\)\(\dd A=r\dd r\dd\theta\)
cylindrical\((\rho,\phi,z)\)\(x=\rho\cos\phi,\; y=\rho\sin\phi,\; z=z\)\(\dd V=\rho\dd\rho\dd\phi\dd z\)
spherical\((r,\theta,\phi)\)\(x=r\sin\theta\cos\phi,\; y=r\sin\theta\sin\phi,\; z=r\cos\theta\)\(\dd V=r^2\sin\theta\dd r\dd\theta\dd\phi\)

Inverses: \(\rho=\sqrt{x^2+y^2}\), \(r=\sqrt{x^2+y^2+z^2}\), \(\theta=\cos^{-1}(z/r)\) (valid everywhere), \(\phi=\tan^{-1}(y/x)\) (only for \(x\gt0\)); the systems link by \(\rho=r\sin\theta\), \(z=r\cos\theta\). Constant-coordinate surfaces: cylinders, half-planes, horizontal planes (cylindrical); spheres, cones, half-planes (spherical).

Change of variables. Under a one-to-one \((x,y)=(x(u,v),y(u,v))\) mapping a domain \(D\) onto \(R\): \(\iint_Rf\dd A=\iint_Df\,\Big|\dfrac{\partial(x,y)}{\partial(u,v)}\Big|\dd u\dd v\), where the Jacobian determinant \(\dfrac{\partial(x,y)}{\partial(u,v)}=\det\begin{pmatrix}x_u&x_v\\y_u&y_v\end{pmatrix}\) is the area-expansion factor of the map — multivariable \(u\)-substitution, always with absolute value. Jacobian matrices of inverse maps are inverse matrices (chain rule), so \(\dfrac{\partial(x,y)}{\partial(u,v)}=\Big(\dfrac{\partial(u,v)}{\partial(x,y)}\Big)^{-1}\) — a shortcut when the inverse map is the easy one to differentiate. In 3D the \(3\times3\) Jacobian \(\dfrac{\partial(x,y,z)}{\partial(u,v,w)}\) is a volume-expansion factor; it reproduces \(\dd V=\rho\dd\rho\dd\phi\dd z\) and \(r^2\sin\theta\dd r\dd\theta\dd\phi\). Choose \((u,v)\) so the boundary curves become \(u=\text{const}\), \(v=\text{const}\) — the region becomes a rectangle.

Mass, centres of mass & moments of inertia

Density integrals. For a mass density \(f\), \(\dd M=f\dd A\) (lamina) or \(f\dd V\) (solid), so \(M=\iint_Rf\dd A\) or \(\iiint_Bf\dd V\). A signed density (charge) integrates to net charge — the interpretation that makes sense of integrating sign-changing functions.

Centre of mass. The balance point, where net torque vanishes: \(\int(\vv{r}-\vv{r}_{\mathrm{cm}})\dd M=\vv{0}\), giving \(x_{\mathrm{cm}}=\frac1M\int x\dd M\) and likewise per coordinate (double or triple integrals as appropriate). Constant density gives the centroid, \(\bar x=\frac{1}{\operatorname{Area}}\iint x\dd A\); a quarter disk of radius \(R\) has centroid \(\left(\frac{4R}{3\pi},\frac{4R}{3\pi}\right)\). In a uniform force field an object's centre of mass follows the trajectory of a point mass.

Moments of inertia. About a line \(L\): \(I_L=\int\rho_L^2\dd M\) with \(\rho_L\) the distance to \(L\); e.g. \(I_z=\iiint(x^2+y^2)f\dd V\). For an axis through the origin with unit direction \(\uvec{u}\): \(\rho^2=|\vv{r}|^2-(\vv{r}\cdot\uvec{u})^2\), and expanding makes \(I_L=\uvec{u}^{\mathsf T}I\,\uvec{u}\) a quadratic form — \(I\) is the inertia tensor, \(I_{xx}=\iiint(y^2+z^2)\dd M\), \(I_{xy}=-\iiint xy\dd M\), etc. Its eigenvectors are the object's principal axes (orthogonal, since \(I\) is symmetric): the natural axes of rotation.

Line & surface integrals

Arc length. \(L=\int_C\dd s\) with \(\dd s=\sqrt{\dd x^2+\dd y^2+\dd z^2}=|\vv{r}'(t)|\dd t\): parameterize the curve, integrate the speed. The value is independent of the parameterization chosen (any two are related by a \(u\)-substitution). Segments: \(\vv{r}=\vv{a}+t(\vv{b}-\vv{a})\), \(0\le t\le1\); circles: \((R\cos t,R\sin t)\). The square root usually makes the antiderivative the hard part.

Scalar line integrals. \(\int_Cf\dd s\), computed the same way: the mass of a wire with density \(f\), its centre of mass \(\frac1M\int_Cx\dd M,\dots\), its moment of inertia \(\int_C\rho^2\dd M\).

Surface parameterizations. \(\vv{r}(u,v)=\langle x(u,v),y(u,v),z(u,v)\rangle\), with a domain \(D\) in the \(uv\)-plane chosen so each surface point is covered exactly once (angles need a stated range, e.g. \(0\le\phi\lt2\pi\)). Graphs: parameters \((x,y)\); cylinders \(\rho=\text{const}\): \((\phi,z)\); spheres \(r=\text{const}\): \((\theta,\phi)\). Any surface admits many parameterizations.

Surface area & scalar surface integrals. A \(\Delta u\times\Delta v\) rectangle maps to approximately the parallelogram spanned by \(\vv{r}_u\Delta u\) and \(\vv{r}_v\Delta v\), so \(\dd A=|\vv{r}_u\times\vv{r}_v|\dd u\dd v\) — the area-expansion factor (cross products: see vectors). Hence \(\operatorname{Area}(S)=\iint_D|\vv{r}_u\times\vv{r}_v|\dd u\dd v\), and \(\iint_Sf\dd A\) integrates any function over the surface by the same substitution.

Vector fields, flux & divergence

Vector fields. \(\vv{F}(x,y,z)\) assigns a vector to every point. Velocity fields model fluid flow — flow lines are the trajectories everywhere tangent to the field; force fields model gravity and electrostatics, e.g. the inverse-square field \(\vv{F}=-\uvec{r}/r^2\), and many derive from a potential energy, \(\vv{F}=-\nabla U\).

Flux across a curve (2D). \(\int_C\vv{F}\cdot\uvec{n}\dd s\): the net rate at which fluid crosses \(C\) in the direction of the unit normal \(\uvec{n}\); reversing \(\uvec{n}\) flips the sign. With \(\vv{F}=P\vv{i}+Q\vv{j}\) and \(\uvec{n}\) pointing to the right of the direction of travel, \(\vv{F}\cdot\uvec{n}\dd s=P\dd y-Q\dd x\), so flux \(=\int_CP\dd y-Q\dd x\); the symbol \(\oint\) marks integration around a closed curve.

Flux through a surface (3D). \(\iint_S\vv{F}\cdot\uvec{n}\dd A\). With a parameterization, \(\uvec{n}\dd A=\pm(\vv{r}_u\times\vv{r}_v)\dd u\dd v\) — the normalization of \(\uvec{n}=\pm\vv{r}_u\times\vv{r}_v/|\vv{r}_u\times\vv{r}_v|\) cancels against the area factor — so \(\iint_S\vv{F}\cdot\uvec{n}\dd A=\pm\iint_D\vv{F}\cdot(\vv{r}_u\times\vv{r}_v)\dd u\dd v\), the sign fixed by which side of \(S\) the flux is measured toward.

Divergence theorem. With \(\nabla=\big\langle\frac{\partial}{\partial x},\frac{\partial}{\partial y},\frac{\partial}{\partial z}\big\rangle\), the divergence of \(\vv{F}=P\vv{i}+Q\vv{j}+R\vv{k}\) is \(\nabla\cdot\vv{F}=P_x+Q_y+R_z\), and \[\iiint_B\nabla\cdot\vv{F}\dd V=\oiint_S\vv{F}\cdot\uvec{n}\dd A,\] where \(S\) is the boundary of \(B\) with outward normal and \(\vv{F}\) is defined and nonsingular (continuous partials) throughout \(B\). Divergence is flux density — a "source density": an incompressible flow has zero flux through every closed surface, equivalently \(\nabla\cdot\vv{F}=0\). 2D version: \(\iint_R\nabla\cdot\vv{F}\dd A=\oint_C\vv{F}\cdot\uvec{n}\dd s\) with \(\nabla\cdot\vv{F}=P_x+Q_y\).

Singularities & use. \(\vv{F}=\uvec{r}/r^2\) has \(\nabla\cdot\vv{F}=0\) wherever defined, yet outward flux \(4\pi\) through every sphere about the origin — the theorem cannot be applied across a singularity. Legitimate uses: converting a hard flux integral into an easy volume integral; and for an open surface, closing it with a simple cap, applying the theorem, and subtracting the cap's flux.

Conservative fields, Green & Stokes

Work integrals. \(W=\int_C\vv{F}\cdot\dd\vv{r}=\int_CP\dd x+Q\dd y+R\dd z\): the energy a force field transfers to an object moving along \(C\) (from \(\frac{dE}{dt}=\vv{F}\cdot\vv{v}\)). Independent of the parameterization; reversing the direction of \(C\) flips the sign; only the force component along the motion does work.

Conservative fields. Three equivalent properties: (i) \(\vv{F}=\nabla\varphi\) for some primitive \(\varphi\); (ii) \(\int_A^B\vv{F}\cdot\dd\vv{r}\) is path-independent; (iii) \(\oint_C\vv{F}\cdot\dd\vv{r}=0\) for every closed curve — the defining property (a field without it would power perpetual motion around some loop). Physics writes \(\vv{F}=-\nabla U\): potential energy lost equals work done.

Fundamental theorem of line integrals. For any curve \(C\) from \(A\) to \(B\), \[\int_C\nabla\varphi\cdot\dd\vv{r}=\varphi(B)-\varphi(A)\] — the multivariable fundamental theorem of calculus (proof: chain rule reduces it to the single-variable FTC). So every gradient field is conservative. Conversely (second fundamental theorem), if \(\vv{F}\) is conservative then \(\varphi(\vv{x})=\int_A^{\vv{x}}\vv{F}\cdot\dd\vv{r}\) (any path) is a primitive — compute potentials by integrating along coordinate-aligned paths.

Curl & the curl test. \[\nabla\times\vv{F}=\begin{vmatrix}\vv{i}&\vv{j}&\vv{k}\\ \partial_x&\partial_y&\partial_z\\ P&Q&R\end{vmatrix}=(R_y-Q_z)\,\vv{i}+(P_z-R_x)\,\vv{j}+(Q_x-P_y)\,\vv{k};\] in 2D the scalar curl is \(\operatorname{curl}\vv{F}=Q_x-P_y\) (and \(\nabla\times\vv{F}=(\operatorname{curl}\vv{F})\vv{k}\)). If \(\vv{F}=\nabla\varphi\) then \(\nabla\times\vv{F}=\vv{0}\) by equality of mixed partials — so nonzero curl proves a field is not conservative, with no line integral needed. The converse requires \(\vv{F}\) defined and nonsingular everywhere: the vortex field \(\vv{F}=\dfrac{-y\,\vv{i}+x\,\vv{j}}{x^2+y^2}\) (locally \(\nabla\theta\) for the multivalued angle function; physically the magnetic field of a wire) has zero curl away from the origin yet \(\oint\vv{F}\cdot\dd\vv{r}=2\pi\) around it.

Green's theorem. For \(C\) the boundary of a 2D region \(R\), traversed with the region on the left (counterclockwise for an outer boundary), and \(\vv{F}\) nonsingular on all of \(R\): \[\oint_CP\dd x+Q\dd y=\iint_R\Big(\frac{\partial Q}{\partial x}-\frac{\partial P}{\partial y}\Big)\dd A,\qquad\text{i.e.}\qquad\oint_C\vv{F}\cdot\dd\vv{r}=\iint_R\operatorname{curl}\vv{F}\dd A.\] Same mathematical content as the 2D divergence theorem (rename components), but stated for work rather than flux: \(\operatorname{curl}\vv{F}\dd A\) is the work around an infinitesimal rectangle, so curl is circulation density. Uses: closed work integrals become double integrals; an open curve can be closed up with an easy segment and the difference subtracted; and it proves the 2D curl test — \(\operatorname{curl}\vv{F}=0\) with \(\vv{F}\) nonsingular everywhere forces every closed-loop integral to vanish, so \(\vv{F}\) is conservative.

Stokes' theorem. For \(C\) the boundary of a surface \(S\), with \(\vv{F}\) defined and nonsingular on \(S\): \[\oint_C\vv{F}\cdot\dd\vv{r}=\iint_S(\nabla\times\vv{F})\cdot\uvec{n}\dd A,\] orientations matched by the right-hand rule: fingers along \(C\), curling toward \(S\), thumb along \(\uvec{n}\) (equivalently, walking along \(C\) with \(\uvec{n}\) up keeps \(S\) on the left). Green's theorem is the special case of a plane region with \(\uvec{n}=\vv{k}\). Consequences: the 3D curl test — \(\nabla\times\vv{F}=\vv{0}\) with \(\vv{F}\) nonsingular everywhere \(\Rightarrow\) conservative (span any closed curve with a surface); for surfaces with several boundary curves the line integrals add; for a closed surface \(\oiint_S(\nabla\times\vv{F})\cdot\uvec{n}\dd A=0\).

Identities & converses. \(\nabla\times(\nabla\varphi)=\vv{0}\) and \(\nabla\cdot(\nabla\times\vv{F})=0\) — both are equality of mixed partials. Both converses hold: zero circulation around every closed curve gives a scalar potential (\(\vv{F}=\nabla\varphi\), by the second fundamental theorem), and zero flux through every closed surface gives a vector potential (\(\vv{G}=\nabla\times\vv{F}\); harder, beyond the course — used for magnetic vector potentials and vorticity).