Unit 3
Partial Derivatives
Real quantities depend on more than one thing. The power in a resistor depends on voltage and resistance; the potential around a charge depends on all three coordinates; a transistor's collector current depends on two voltages. This unit extends the derivative to such functions. The central idea is embarrassingly simple — hold everything else still and differentiate as usual — and the central object it produces, the gradient, is the vector every field in electromagnetics is built from. Two labs let you see the surface, its contour map and its gradient at once, and watch what a saddle point really is.
1 · Functions of several variables
\(z = f(x,y)\) takes a point in the plane and returns a height. Its graph is a surface over the \(xy\)-plane — the paraboloids and saddles of Unit 1 are graphs of \(x^2+y^2\) and \(x^2-y^2\). A function of three variables \(w = f(x,y,z)\) has no drawable graph (it would need four dimensions), so it is pictured differently.
- Concentric closed curves → a peak or a pit. Look at the values to tell which.
- Curves that cross in an X → a saddle. The level curve through a saddle point is a pair of crossing lines (compare the hyperbolic paraboloid's \(z=0\) trace).
- Parallel straight lines → a plane. Equally spaced means constant slope.
- The gradient is always perpendicular to the contour and points toward higher values. Section 6 proves it; the lab shows it.
For three variables, level surfaces of \(x^2+y^2+z^2\) are spheres; of \(x^2+y^2-z^2\) they are the whole family cone / one-sheet / two-sheet hyperboloids as \(k\) moves through zero. Equipotential surfaces around a point charge are the spheres \(kq/\rho = V_0\).
2 · Limits and continuity
That gives the standard tool for proving a limit does not exist — the two-path test: find two paths into \((a,b)\) along which \(f\) approaches different values. Try the axes first (\(y = 0\), then \(x = 0\)), then lines \(y = mx\), then parabolas \(y = mx^2\).
\(f(x,y) = \dfrac{xy^2}{x^2+y^4}\) approaches 0 along every straight line through the origin — but along the parabola \(x = y^2\) it equals \(\tfrac12\) everywhere. The limit does not exist. Two paths agreeing proves nothing; two paths disagreeing proves everything.
To prove a limit does exist, the usual trick is polar coordinates: substitute \(x = r\cos\theta, y = r\sin\theta\), and if the result goes to \(L\) as \(r\to0\) regardless of \(\theta\), the limit is \(L\). Example: \(\dfrac{x^3}{x^2+y^2} = \dfrac{r^3\cos^3\theta}{r^2} = r\cos^3\theta \to 0\).
\(f\) is continuous at \((a,b)\) if the limit equals \(f(a,b)\). Polynomials, rational functions (where the denominator is nonzero), and compositions of continuous functions are continuous — so in practice you only worry at points where a denominator vanishes.
3 · Partial derivatives
Geometrically, \(f_x(a,b)\) is the slope of the surface in the \(x\)-direction at \((a,b)\): slice the surface with the vertical plane \(y = b\), get a curve, and \(f_x\) is that curve's slope. Likewise \(f_y\) slices with \(x = a\). Two directions, two slopes. (The gradient in Section 6 gives the slope in every direction from just these two.)
Notation you will meet, all meaning the same thing:
Higher-order partials
A transistor's small-signal parameters are partial derivatives at the operating point: transconductance \(g_m = \partial I_C/\partial V_{BE}\) with \(V_{CE}\) held fixed, output conductance \(g_o = \partial I_C/\partial V_{CE}\) with \(V_{BE}\) held fixed. The phrase “with … held fixed” is the partial derivative, and data-sheet graphs of \(I_C\) versus \(V_{CE}\) at several \(V_{BE}\) values are literally the traces of the surface \(I_C(V_{BE}, V_{CE})\).
4 · Tangent planes and differentials
The right-hand side, viewed as a function, is the linearisation:
The total differential
Two resistors \(R_1 = R_2 = 100\ \Omega\), each \(\pm 5\%\), in parallel: \(R = \dfrac{R_1R_2}{R_1+R_2}\). Then \(\partial R/\partial R_1 = \dfrac{R_2^2}{(R_1+R_2)^2} = \tfrac14\), same for \(R_2\), so \(\Delta R \approx \tfrac14(5) + \tfrac14(5) = 2.5\ \Omega\) on a nominal \(50\ \Omega\) — still \(5\%\). The worst case adds the absolute contributions; for independent random tolerances you would add them in quadrature, \(\sqrt{1.25^2 + 1.25^2} \approx 1.8\ \Omega\).
A function is differentiable at a point when the linearisation is a good approximation there — formally, when the error goes to zero faster than the distance. The practical test: if \(f_x\) and \(f_y\) exist and are continuous near the point, \(f\) is differentiable there. Having partials alone is not enough (there are functions with both partials at the origin that are not even continuous there), but continuous partials always suffice.
5 · The chain rule
Implicit differentiation, done properly
6 · The gradient and directional derivatives
\(f_x\) and \(f_y\) are slopes in two special directions. What is the slope in the direction of an arbitrary unit vector \(\mathbf{u} = \langle a, b\rangle\)?
The right-hand side is a dot product, and naming the other factor is the key idea of the unit:
| Fact | Why | Consequence |
|---|---|---|
| The maximum rate of increase is \(|\nabla f|\), in the direction of \(\nabla f\). | \(\cos\theta = 1\) when \(\mathbf{u}\parallel\nabla f\). | \(\nabla f\) points uphill, steepest way. Gradient descent follows \(-\nabla f\). |
| The rate of change is zero perpendicular to \(\nabla f\). | \(\cos\theta = 0\). | Moving along a level curve does not change \(f\) — so \(\nabla f\perp\) the level curve through the point. |
| The minimum rate is \(-|\nabla f|\), opposite to \(\nabla f\). | \(\cos\theta = -1\). | Steepest descent is exactly opposite steepest ascent. |
The electric field is minus the gradient of the potential. Everything in the table translates: field lines are perpendicular to equipotentials; the field is strongest where equipotentials are closest; a positive charge is pushed down the potential, along \(-\nabla V\). If \(V = kq/\rho\) for a point charge, then \(\mathbf{E} = -\nabla V = kq\,\hat{\boldsymbol\rho}/\rho^2\) — Coulomb's law falls out of one gradient. This single equation is the reason engineers learn Section 6.
Level surfaces
Surface, contour map & gradient
The same function drawn twice: as a surface on the left and as a contour map on the right. Drag the point on the map (or use the sliders). The orange arrow is \(\nabla f\) at that point — watch it stay perpendicular to the contour and point uphill. The blue arrow is a direction \(\mathbf{u}\) you control with the angle slider; the tilted blue line on the surface has slope \(D_{\mathbf{u}}f\). Rotate \(\mathbf{u}\) to line up with the gradient and the slope hits its maximum, \(|\nabla f|\); rotate it along the contour and the slope goes to zero.
Drag to orbit. The contour through \(P\) is drawn on the surface; \(\nabla f\) and \(\mathbf{u}\) are drawn on the floor beneath \(P\).
Drag the point. Orange: \(\nabla f\). Blue: \(\mathbf{u}\). Contours every fixed step of \(f\); the bold one passes through \(P\).
7 · Maxima, minima and saddle points
At a local maximum or minimum of a smooth surface the tangent plane is horizontal: both slopes are zero. Points where that happens are critical points.
The second-derivative test
| \(D\) | \(f_{xx}\) | Verdict | Picture |
|---|---|---|---|
| \(D > 0\) | \(f_{xx} > 0\) | Local minimum | Bowl. Curves up in every direction. |
| \(D > 0\) | \(f_{xx} < 0\) | Local maximum | Dome. Curves down in every direction. |
| \(D < 0\) | any | Saddle point | Curves up one way, down the other. Not an extremum. |
| \(D = 0\) | any | Inconclusive | Could be anything; look at the function directly. |
Critical points & the second-derivative test
The translucent square is the tangent plane at \(P\). Move \(P\) around and watch it tilt; at a critical point it goes flat. Then read the Hessian: on the bowl, \(D > 0\) with \(f_{xx} > 0\); on the saddle, \(D < 0\), and the flat tangent plane cuts through the surface. The cubic preset has one minimum and one saddle side by side — use Next critical point to jump between them and compare the numbers. The monkey saddle is the \(D = 0\) case the test cannot decide.
Drag to orbit. Tangent plane at \(P\) in violet; contours of \(f\) on the floor below.
Absolute extrema on a closed, bounded region
- Find the critical points inside the region and evaluate \(f\) there.
- Find the extreme values of \(f\) on the boundary. Parametrise each boundary piece (a one-variable problem), including its endpoints/corners.
- The largest value collected is the absolute max, the smallest the absolute min.
Step 2 is where the marks are lost. On a rectangle there are four edges and four corners; every one must be checked. On a disk, substitute \(x = r\cos t\), \(y = r\sin t\) with \(r\) fixed and optimise in \(t\) — or use Lagrange multipliers.
8 · Lagrange multipliers
To maximise or minimise \(f(x,y,z)\) subject to a constraint \(g(x,y,z) = k\): at the optimum, the level surface of \(f\) is tangent to the constraint surface, so their normals — their gradients — are parallel.
Do not solve for \(\lambda\) first unless it is obvious. Instead, divide pairs of equations to eliminate \(\lambda\) — but watch for the case where the thing you divide by is zero, and handle it separately. Symmetric problems usually give \(x = y = z\) as one family of solutions; check whether any variable being zero gives another.
With two constraints \(g = k\) and \(h = c\), use \(\nabla f = \lambda\nabla g + \mu\nabla h\): the gradient of \(f\) must lie in the plane spanned by the two constraint normals.
A total current \(I\) splits into \(I_1 + I_2 = I\) through \(R_1\) and \(R_2\). Nature minimises the dissipated power \(P = I_1^2R_1 + I_2^2R_2\) subject to that constraint. Lagrange: \(\langle 2I_1R_1, 2I_2R_2\rangle = \lambda\langle 1, 1\rangle\), so \(I_1R_1 = I_2R_2\) — the voltages across the two branches are equal. That is Kirchhoff's voltage law, derived from a minimum-power principle. (The full statement is Thomson's / Maxwell's minimum heat theorem.)
9 · Worked examples
1. Partials, Clairaut check, and a tangent plane
For \(f(x,y) = x^2 e^{y} + \sin(xy)\): find \(f_x, f_y, f_{xy}, f_{yx}\), and the tangent plane at \((1, 0)\).
At \((1,0)\): \(f = 1\), \(f_x = 2 + 0 = 2\), \(f_y = 1 + 1 = 2\).
Linear approximation check: \(f(1.1, 0.05) \approx 2(1.1) + 2(0.05) - 1 = 1.3\). Actual: \(1.21e^{0.05} + \sin(0.055) \approx 1.272 + 0.055 = 1.327\). Close, and closer the nearer you stay to \((1,0)\).
2. Chain rule with a tree
\(z = x^2y\), where \(x = s\cos t\) and \(y = s\sin t\). Find \(\partial z/\partial t\).
Substitute back so the answer is in \(s, t\):
Check by substituting first: \(z = s^3\cos^2 t\sin t\), so \(\partial z/\partial t = s^3(-2\cos t\sin^2 t + \cos^3 t)\). Same. ✓ When substitution is easy, it is a fine check — but for implicit or numerical dependencies only the chain rule is available.
3. Directional derivative and steepest ascent
The temperature on a plate is \(T(x,y) = 20 + x^2 - y^2\) (°C, metres). At \((1, 2)\): (a) the rate of change toward \((4, 6)\); (b) the direction and rate of fastest increase.
\(\nabla T = \langle 2x, -2y\rangle = \langle 2, -4\rangle\) at \((1,2)\).
(a) Direction vector \(\langle 3, 4\rangle\), length 5, so \(\mathbf{u} = \langle 3/5, 4/5\rangle\).
Temperature drops at 2 °C per metre heading that way.
(b) Fastest increase is along \(\nabla T\), at rate \(|\nabla T| = \sqrt{4 + 16} = 2\sqrt5 \approx 4.47\) °C/m. Unit direction \(\langle 1, -2\rangle/\sqrt5\).
Sanity: \(-2\) lies between \(-4.47\) and \(+4.47\), as any directional derivative must. ✓
4. Tangent plane to a level surface
Find the tangent plane to the ellipsoid \(x^2 + 2y^2 + 3z^2 = 6\) at \((1, 1, 1)\).
Let \(F = x^2 + 2y^2 + 3z^2\). \(\nabla F = \langle 2x, 4y, 6z\rangle = \langle 2, 4, 6\rangle\) at the point. (Check the point is on the surface: \(1 + 2 + 3 = 6\) ✓.)
No need to solve for \(z\) first — the gradient of the level-surface function is the normal directly. Compare the labour of writing \(z = \sqrt{(6 - x^2 - 2y^2)/3}\) and computing \(f_x, f_y\).
5. Classify the critical points
Find and classify the critical points of \(f(x,y) = x^3 - 3x + y^2\).
Critical points: \((1, 0)\) and \((-1, 0)\).
- At \((1,0)\): \(D = 12 > 0\), \(f_{xx} = 6 > 0\) → local minimum, \(f = -2\).
- At \((-1,0)\): \(D = -12 < 0\) → saddle point, \(f = 2\).
This is the Cubic preset in the lab. Look at it from the side: along \(y = 0\) the surface is the familiar cubic \(x^3 - 3x\) with its local max at \(x = -1\) — but in the \(y\)-direction the surface curves up there. Max one way, min the other: a saddle.
6. Lagrange multipliers: closest point on a plane
Find the point on the plane \(x + 2y + 3z = 14\) closest to the origin.
Minimise \(f = x^2 + y^2 + z^2\) (the squared distance — same minimiser as the distance, easier derivatives) subject to \(g = x + 2y + 3z = 14\).
Point: \((1, 2, 3)\). Distance \(\sqrt{14}\).
Check against Unit 1: distance from the origin to \(ax+by+cz = d\) is \(|d|/|\mathbf{n}| = 14/\sqrt{14} = \sqrt{14}\). ✓ And the closest point is along the normal, \(\langle1,2,3\rangle\) — exactly what \(\nabla f\parallel\nabla g\) says.
Checklist
- I can read a contour map: crowded curves are steep, closed loops are peaks or pits, crossing curves are saddles.
- I compute partials by freezing the other variables, and I check \(f_{xy} = f_{yx}\).
- I can write the tangent plane and linearisation at a point, and use \(dz = f_x\,dx + f_y\,dy\) for tolerance propagation.
- I draw a tree diagram for any chain-rule problem and sum over paths.
- I know \(D_{\mathbf{u}}f = \nabla f\cdot\mathbf{u}\) needs a unit \(\mathbf{u}\).
- I know \(\nabla f\) points uphill, has length equal to the max slope, and is perpendicular to level curves and surfaces.
- I can state \(\mathbf{E} = -\nabla V\) and what each part of that means geometrically.
- I find critical points from \(\nabla f = \mathbf{0}\) and classify them with \(D\); and I check the boundary for absolute extrema.
- I can set up and solve \(\nabla f = \lambda\nabla g\).