Skip to main content

Multivariable Calculus

1. Partial Derivatives

1.1 Definition

Let f:DRnRf : D \subseteq \mathbb{R}^n \to \mathbb{R}. The partial derivative of ff with respect to xix_i at a=(a1,,an)\mathbf{a} = (a_1, \ldots, a_n) is

fxi(a)=limh0f(a1,,ai+h,,an)f(a1,,an)h\frac{\partial f}{\partial x_i}(\mathbf{a}) = \lim_{h \to 0} \frac{f(a_1, \ldots, a_i + h, \ldots, a_n) - f(a_1, \ldots, a_n)}{h}

provided the limit exists. This is the rate of change of ff in the direction of the xix_i-axis, holding all other variables fixed.

1.2 Clairaut's Theorem

Theorem 1.1 (Clairaut's Theorem / Schwarz's Theorem). If fxyf_{xy} and fyxf_{yx} are continuous on an open set containing (a,b)(a, b), then

2fxy(a,b)=2fyx(a,b)\frac{\partial^2 f}{\partial x \partial y}(a,b) = \frac{\partial^2 f}{\partial y \partial x}(a,b)

1.3 Differentiability

Definition. f:DRnRf : D \subseteq \mathbb{R}^n \to \mathbb{R} is differentiable at a\mathbf{a} if there exists a linear map L:RnRL : \mathbb{R}^n \to \mathbb{R} such that

limh0f(a+h)f(a)L(h)h=0\lim_{\mathbf{h} \to \mathbf{0}} \frac{f(\mathbf{a} + \mathbf{h}) - f(\mathbf{a}) - L(\mathbf{h})}{\lVert \mathbf{h} \rVert} = 0

When ff is differentiable at a\mathbf{a}, the linear map LL is given by the gradient.

1.4 The Gradient

The gradient of ff at a\mathbf{a} is

f(a)=(fx1(a),,fxn(a))\nabla f(\mathbf{a}) = \left(\frac{\partial f}{\partial x_1}(\mathbf{a}), \ldots, \frac{\partial f}{\partial x_n}(\mathbf{a})\right)

The linear approximation of ff near a\mathbf{a} is

f(a+h)f(a)+f(a)hf(\mathbf{a} + \mathbf{h}) \approx f(\mathbf{a}) + \nabla f(\mathbf{a}) \cdot \mathbf{h}

Theorem 1.2. If all partial derivatives of ff exist and are continuous in a neighbourhood of a\mathbf{a}, then ff is differentiable at a\mathbf{a}.

1.5 Directional Derivatives

The directional derivative of ff at a\mathbf{a} in the direction of a unit vector u\mathbf{u} is

Duf(a)=limh0f(a+hu)f(a)hD_{\mathbf{u}} f(\mathbf{a}) = \lim_{h \to 0} \frac{f(\mathbf{a} + h\mathbf{u}) - f(\mathbf{a})}{h}

Theorem 1.3. If ff is differentiable at a\mathbf{a}, then

Duf(a)=f(a)uD_{\mathbf{u}} f(\mathbf{a}) = \nabla f(\mathbf{a}) \cdot \mathbf{u}

Corollary 1.4. The gradient points in the direction of steepest ascent, and f\lVert \nabla f \rVert is the rate of steepest ascent.

1.6 Chain Rule

Theorem 1.5 (Multivariable Chain Rule). If g:RmRn\mathbf{g} : \mathbb{R}^m \to \mathbb{R}^n is differentiable at a\mathbf{a} and f:RnRf : \mathbb{R}^n \to \mathbb{R} is differentiable at g(a)\mathbf{g}(\mathbf{a}), then

(fg)(a)=Jg(a)Tf(g(a))\nabla (f \circ \mathbf{g})(\mathbf{a}) = J\mathbf{g}(\mathbf{a})^T \nabla f(\mathbf{g}(\mathbf{a}))

where JgJ\mathbf{g} is the Jacobian matrix of g\mathbf{g}.

1.7 Worked Example

Problem. Let f(x,y)=x2y+sin(xy)f(x, y) = x^2 y + \sin(xy). Compute f\nabla f and find the directional derivative at (1,π)(1, \pi) in the direction u=(1/2,1/2)\mathbf{u} = (1/\sqrt{2}, 1/\sqrt{2}).

Solution.

fx=2xy+ycos(xy)\frac{\partial f}{\partial x} = 2xy + y\cos(xy)

fy=x2+xcos(xy)\frac{\partial f}{\partial y} = x^2 + x\cos(xy)

f(1,π)=(2π+πcos(π),1+cos(π))=(2ππ,11)=(π,0)\nabla f(1, \pi) = (2\pi + \pi\cos(\pi), 1 + \cos(\pi)) = (2\pi - \pi, 1 - 1) = (\pi, 0)

Duf(1,π)=f(1,π)u=π12+0=π2D_{\mathbf{u}} f(1, \pi) = \nabla f(1, \pi) \cdot \mathbf{u} = \pi \cdot \frac{1}{\sqrt{2}} + 0 = \frac{\pi}{\sqrt{2}} \blacksquare

2. Multiple Integrals

2.1 Double Integrals

The double integral of ff over a rectangle R=[a,b]×[c,d]R = [a,b] \times [c,d] is defined as the limit of Riemann sums:

Rf(x,y)dA=limP0i,jf(xij,yij)ΔAij\iint_R f(x,y)\, dA = \lim_{\lVert P \rVert \to 0} \sum_{i,j} f(x_{ij}^*, y_{ij}^*) \Delta A_{ij}

Theorem 2.1 (Fubini's Theorem). If ff is continuous on R=[a,b]×[c,d]R = [a,b] \times [c,d], then

Rf(x,y)dA=ab(cdf(x,y)dy)dx=cd(abf(x,y)dx)dy\iint_R f(x,y)\, dA = \int_a^b \left(\int_c^d f(x,y)\, dy\right) dx = \int_c^d \left(\int_a^b f(x,y)\, dx\right) dy

2.2 General Regions

For a general region DD in R2\mathbb{R}^2:

  • Type I region: D={(x,y):axb,g1(x)yg2(x)}D = \{(x,y) : a \leq x \leq b,\, g_1(x) \leq y \leq g_2(x)\}

DfdA=abg1(x)g2(x)f(x,y)dydx\iint_D f\, dA = \int_a^b \int_{g_1(x)}^{g_2(x)} f(x,y)\, dy\, dx

  • Type II region: D={(x,y):cyd,h1(y)xh2(y)}D = \{(x,y) : c \leq y \leq d,\, h_1(y) \leq x \leq h_2(y)\}

DfdA=cdh1(y)h2(y)f(x,y)dxdy\iint_D f\, dA = \int_c^d \int_{h_1(y)}^{h_2(y)} f(x,y)\, dx\, dy

2.3 Triple Integrals

Triple integrals extend naturally to R3\mathbb{R}^3:

Ef(x,y,z)dV=D(g1(x,y)g2(x,y)f(x,y,z)dz)dA\iiint_E f(x,y,z)\, dV = \iint_D \left(\int_{g_1(x,y)}^{g_2(x,y)} f(x,y,z)\, dz\right) dA

2.4 Change of Variables

Theorem 2.2 (Change of Variables). Let T:DRnRnT : D \subseteq \mathbb{R}^n \to \mathbb{R}^n be a C1C^1 diffeomorphism with Jacobian determinant JTJ_T. Then

T(D)f(u)du=Df(T(x))JT(x)dx\int_{T(D)} f(\mathbf{u})\, d\mathbf{u} = \int_D f(T(\mathbf{x})) |J_T(\mathbf{x})|\, d\mathbf{x}

Polar coordinates: x=rcosθx = r\cos\theta, y=rsinθy = r\sin\theta, J=r|J| = r.

Df(x,y)dA=Df(rcosθ,rsinθ)rdrdθ\iint_D f(x,y)\, dA = \iint_{D'} f(r\cos\theta, r\sin\theta)\, r\, dr\, d\theta

Cylindrical coordinates: x=rcosθx = r\cos\theta, y=rsinθy = r\sin\theta, z=zz = z, J=r|J| = r.

Spherical coordinates: x=ρsinϕcosθx = \rho\sin\phi\cos\theta, y=ρsinϕsinθy = \rho\sin\phi\sin\theta, z=ρcosϕz = \rho\cos\phi, J=ρ2sinϕ|J| = \rho^2 \sin\phi.

2.5 Worked Example

Problem. Compute D(x2+y2)dA\iint_D (x^2 + y^2)\, dA where DD is the region bounded by x2+y2=4x^2 + y^2 = 4.

Solution. Use polar coordinates. The region DD' is 0r20 \leq r \leq 2, 0θ2π0 \leq \theta \leq 2\pi.

D(x2+y2)dA=02π02r2rdrdθ=02π02r3drdθ\iint_D (x^2 + y^2)\, dA = \int_0^{2\pi} \int_0^2 r^2 \cdot r\, dr\, d\theta = \int_0^{2\pi} \int_0^2 r^3\, dr\, d\theta

=02π[r44]02dθ=02π4dθ=8π= \int_0^{2\pi} \left[\frac{r^4}{4}\right]_0^2 d\theta = \int_0^{2\pi} 4\, d\theta = 8\pi

\blacksquare

3. Vector Calculus

3.1 Vector Fields

A vector field on Rn\mathbb{R}^n is a function F:DRnRn\mathbf{F} : D \subseteq \mathbb{R}^n \to \mathbb{R}^n.

A vector field F=(P,Q,R)\mathbf{F} = (P, Q, R) on R3\mathbb{R}^3 is conservative if there exists a scalar potential ϕ\phi such that F=ϕ\mathbf{F} = \nabla \phi.

Theorem 3.1. F\mathbf{F} is conservative (on a simply connected domain) if and only if ×F=0\nabla \times \mathbf{F} = \mathbf{0}.

3.2 Line Integrals

Definition. The line integral of a vector field F\mathbf{F} along a curve CC parameterised by r(t)\mathbf{r}(t) for atba \leq t \leq b is

CFdr=abF(r(t))r(t)dt\int_C \mathbf{F} \cdot d\mathbf{r} = \int_a^b \mathbf{F}(\mathbf{r}(t)) \cdot \mathbf{r}'(t)\, dt

Theorem 3.2 (Fundamental Theorem for Line Integrals). If F=ϕ\mathbf{F} = \nabla \phi and CC is a piecewise smooth curve from AA to BB, then

CFdr=ϕ(B)ϕ(A)\int_C \mathbf{F} \cdot d\mathbf{r} = \phi(B) - \phi(A)

Corollary 3.3. The line integral of a conservative field around any closed curve is zero.

3.3 Green's Theorem

Theorem 3.4 (Green's Theorem). Let CC be a positively oriented, piecewise smooth, simple closed curve bounding a region DD. If PP and QQ have continuous partial derivatives on an open set containing DD, then

CPdx+Qdy=D(QxPy)dA\oint_C P\, dx + Q\, dy = \iint_D \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right) dA

Worked Example. Evaluate C(x2y)dx+(y2+x)dy\oint_C (x^2 - y)\, dx + (y^2 + x)\, dy where CC is the unit circle traversed counterclockwise.

Solution. By Green's theorem with P=x2yP = x^2 - y and Q=y2+xQ = y^2 + x:

Qx=1,Py=1\frac{\partial Q}{\partial x} = 1, \quad \frac{\partial P}{\partial y} = -1

CPdx+Qdy=D(1(1))dA=2DdA=2π12=2π\oint_C P\, dx + Q\, dy = \iint_D (1 - (-1))\, dA = 2 \iint_D dA = 2 \cdot \pi \cdot 1^2 = 2\pi

\blacksquare

3.4 Stokes' Theorem

Theorem 3.5 (Stokes' Theorem). Let SS be an oriented surface with piecewise smooth boundary curve CC (positively oriented). If F\mathbf{F} has continuous partial derivatives on an open set containing SS, then

CFdr=S(×F)dS\oint_C \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S}

where dS=ndSd\mathbf{S} = \mathbf{n}\, dS is the vector surface element with unit normal n\mathbf{n}.

3.5 Divergence Theorem

Theorem 3.6 (Divergence Theorem / Gauss's Theorem). Let EE be a solid region bounded by a closed surface SS with outward normal n\mathbf{n}. If F\mathbf{F} has continuous partial derivatives on an open set containing EE, then

SFdS=EFdV\iint_S \mathbf{F} \cdot d\mathbf{S} = \iiint_E \nabla \cdot \mathbf{F}\, dV

where F=Px+Qy+Rz\nabla \cdot \mathbf{F} = \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z} is the divergence of F\mathbf{F}.

Worked Example. Compute the flux of F=(x3,y3,z3)\mathbf{F} = (x^3, y^3, z^3) through the unit sphere SS.

Solution. By the divergence theorem:

F=3x2+3y2+3z2=3(x2+y2+z2)=3ρ2\nabla \cdot \mathbf{F} = 3x^2 + 3y^2 + 3z^2 = 3(x^2 + y^2 + z^2) = 3\rho^2

Using spherical coordinates:

E3ρ2ρ2sinϕdρdϕdθ=302π0π01ρ4sinϕdρdϕdθ\iiint_E 3\rho^2 \cdot \rho^2 \sin\phi\, d\rho\, d\phi\, d\theta = 3 \int_0^{2\pi} \int_0^{\pi} \int_0^1 \rho^4 \sin\phi\, d\rho\, d\phi\, d\theta

=32π215=12π5= 3 \cdot 2\pi \cdot 2 \cdot \frac{1}{5} = \frac{12\pi}{5}

\blacksquare

Common Pitfall

When applying Green's, Stokes', or the Divergence theorem, verify that the field has continuous partial derivatives on the region (including interior). If there are singularities inside the region, the theorems do not apply directly; the singularity must be handled separately.

4. Optimization

4.1 Local Extrema

Theorem 4.1 (First Derivative Test). If ff has a local extremum at an interior point a\mathbf{a} and f(a)\nabla f(\mathbf{a}) exists, then f(a)=0\nabla f(\mathbf{a}) = \mathbf{0}.

Points where f=0\nabla f = \mathbf{0} are called critical points (or stationary points).

4.2 Second Derivative Test

Theorem 4.2 (Second Derivative Test). Let ff have continuous second partial derivatives near a critical point (a,b)(a,b) with fx(a,b)=fy(a,b)=0f_x(a,b) = f_y(a,b) = 0. Let

D=fxx(a,b)fyy(a,b)[fxy(a,b)]2D = f_{xx}(a,b) f_{yy}(a,b) - [f_{xy}(a,b)]^2

be the Hessian determinant. Then:

  • If D>0D > 0 and fxx(a,b)>0f_{xx}(a,b) > 0: local minimum.
  • If D>0D > 0 and fxx(a,b)<0f_{xx}(a,b) < 0: local maximum.
  • If D<0D < 0: saddle point.
  • If D=0D = 0: the test is inconclusive.

4.3 Lagrange Multipliers

Theorem 4.3 (Method of Lagrange Multipliers). To find the extrema of f(x,y,z)f(x,y,z) subject to the constraint g(x,y,z)=0g(x,y,z) = 0, solve the system:

f=λg,g=0\nabla f = \lambda \nabla g, \quad g = 0

More generally, for kk constraints g1=0,,gk=0g_1 = 0, \ldots, g_k = 0:

f=λ1g1++λkgk\nabla f = \lambda_1 \nabla g_1 + \cdots + \lambda_k \nabla g_k

4.4 Worked Example

Problem. Find the maximum of f(x,y)=xyf(x,y) = xy subject to x2+y2=1x^2 + y^2 = 1.

Solution. Set g(x,y)=x2+y21g(x,y) = x^2 + y^2 - 1. The Lagrange multiplier equations:

f=λg    (y,x)=λ(2x,2y)\nabla f = \lambda \nabla g \implies (y, x) = \lambda(2x, 2y)

This gives y=2λxy = 2\lambda x and x=2λyx = 2\lambda y. Multiplying: xy=4λ2xyxy = 4\lambda^2 xy.

Case 1: xy0xy \neq 0. Then 4λ2=14\lambda^2 = 1, so λ=±1/2\lambda = \pm 1/2.

  • λ=1/2\lambda = 1/2: y=xy = x, and x2+x2=1x^2 + x^2 = 1, so x=±1/2x = \pm 1/\sqrt{2}. Points: (1/2,1/2)(1/\sqrt{2}, 1/\sqrt{2}) and (1/2,1/2)(-1/\sqrt{2}, -1/\sqrt{2}) with f=1/2f = 1/2.
  • λ=1/2\lambda = -1/2: y=xy = -x, and x2+x2=1x^2 + x^2 = 1, so x=±1/2x = \pm 1/\sqrt{2}. Points: (1/2,1/2)(1/\sqrt{2}, -1/\sqrt{2}) and (1/2,1/2)(-1/\sqrt{2}, 1/\sqrt{2}) with f=1/2f = -1/2.

Case 2: xy=0xy = 0. Then either x=0x = 0 or y=0y = 0. From the constraint: (0,±1)(0, \pm 1) or (±1,0)(\pm 1, 0) with f=0f = 0.

Maximum: f=1/2f = 1/2 at (±1/2,±1/2)(\pm 1/\sqrt{2}, \pm 1/\sqrt{2}). Minimum: f=1/2f = -1/2 at (±1/2,1/2)(\pm 1/\sqrt{2}, \mp 1/\sqrt{2}). \blacksquare

Common Pitfall

The Lagrange multiplier method finds candidates for constrained extrema but does not guarantee they are extrema. Always check which candidate gives the maximum/minimum, or use additional reasoning (e.g., compactness of the constraint set).