Multivariable calculus
Gradient of sin(x)cos(y): The Egg Carton Surface
For f(x, y) = sin(x) cos(y) the gradient is (cos x cos y, -sin x sin y). Each partial differentiates only its own factor and leaves the other alone. The gradient is zero on a grid of points: the peaks and pits sit where x is an odd multiple of pi over 2 and y is a multiple of pi.
Each factor is differentiated by its own variable
The variables are already separated: holds all the dependence and holds all the dependence. So each partial derivative touches one factor and copies the other.
The minus appears in the second component only, because only there does a cosine get differentiated. Squaring and adding the two components gives , which never exceeds , so the steepest this surface ever gets is a slope of .
The grid of critical points
Setting both components to zero at once forces a case split, and each case gives a different kind of point.
- If then and , so the second equation needs , that is . At these points : the peaks and the pits of the carton.
- If instead then and , so the second equation needs , that is . There : the saddles between neighbouring bumps.
That interleaved grid of maxima, minima and saddles is why this surface is the standard picture of an egg carton, and why it shows up in every discussion of the second derivative test.
Away from the grid the gradient does real work. At both sine and cosine equal .
So from there the steepest climb runs diagonally, up in and back in .
The mistake: differentiating both factors at once
Because looks like a product, students reach for the product rule and write .
That expression is a real derivative, just not this one. By the angle addition formula it equals , which is the partial of . What it does to is add the two components of together into one answer.
The product rule is not wrong so much as unnecessary. Apply it honestly and the extra term dies on its own, because has zero derivative with respect to .
Test at if you are unsure: the true gradient is , while the mixed version also gives for the first slot, so use , where the truth is and the mixed answer is .
Frequently asked questions
Why is the component negative when and are both small and positive?
Because is a product of two positive numbers with a minus in front. Concretely, for small positive the factor is decreasing, so increasing lowers the surface and the gradient must have a negative component.
How do you tell the peaks from the saddles without the second derivative test?
Read the value of . Where and you get , the extreme values of the whole surface, so those are maxima and minima. Where and you get with higher and lower ground on either side, which is a saddle.