Multivariable calculus

Second partial derivatives of sin x cos y

For f(x,y) = sin x cos y the second partials are f_xx = -sin x cos y, f_yy = -sin x cos y, and f_xy = f_yx = -cos x sin y. Both pure second partials return the original function with a minus sign, so f_xx + f_yy = -2f. At the point (pi/2, 0) the Hessian gives a local maximum.

f(x,y)=sin⁡xcos⁡yf(x,y) = \sin x \cos y
∂f∂x=cos⁡xcos⁡y\frac{\partial f}{\partial x} = \cos x \cos y
∂f∂y=−sin⁡xsin⁡y\frac{\partial f}{\partial y} = -\sin x \sin y

Second and mixed partials

∂2f∂x2=−sin⁡xcos⁡y\frac{\partial^2 f}{\partial x^2} = -\sin x \cos y
∂2f∂y ∂x=−cos⁡xsin⁡y\frac{\partial^2 f}{\partial y\,\partial x} = -\cos x \sin y
∂2f∂y2=−sin⁡xcos⁡y\frac{\partial^2 f}{\partial y^2} = -\sin x \cos y

One variable at a time

Treat cos⁡y\cos y as a constant to differentiate in xx, and treat sin⁡x\sin x as a constant to differentiate in yy. That gives the two first partials.

∂f∂x=cos⁡xcos⁡y,∂f∂y=−sin⁡xsin⁡y\frac{\partial f}{\partial x} = \cos x \cos y, \qquad \frac{\partial f}{\partial y} = -\sin x \sin y

Differentiate each of those again. In cos⁡xcos⁡y\cos x \cos y the xx derivative turns cos⁡x\cos x into −sin⁡x-\sin x, and the yy derivative turns cos⁡y\cos y into −sin⁡y-\sin y. In −sin⁡xsin⁡y-\sin x \sin y the yy derivative turns sin⁡y\sin y into cos⁡y\cos y, restoring the original shape with a minus sign.

fxx=−sin⁡xcos⁡y,fxy=−cos⁡xsin⁡y,fyy=−sin⁡xcos⁡yf_{xx} = -\sin x \cos y, \qquad f_{xy} = -\cos x \sin y, \qquad f_{yy} = -\sin x \cos y

Running the mixed partial the other way, starting from fy=−sin⁡xsin⁡yf_y = -\sin x \sin y and differentiating in xx, gives −cos⁡xsin⁡y-\cos x \sin y again. The two routes agree, exactly as Clairaut's theorem promises for a function this smooth.

The mistake: assuming f_xx and f_yy must look different

Here fxxf_{xx} and fyyf_{yy} come out identical, and students who expect two different answers go back and hunt for an error that is not there. The reason they match is structural: each pure second derivative sends its own trig factor through two steps of the cycle, and two steps always produce the factor back times −1-1.

The genuine error to guard against is a sign. fyf_y already carries a minus sign, so differentiating it in yy means differentiating −sin⁡xsin⁡y-\sin x \sin y, not sin⁡xsin⁡y\sin x \sin y. Dropping that leading minus gives fyy=sin⁡xcos⁡yf_{yy} = \sin x \cos y, which has the curvature pointing the wrong way and reverses every conclusion you draw from the Hessian.

Reading the Hessian at a critical point

Both first partials vanish at (π/2,0)(\pi/2, 0), since cos⁡(π/2)=0\cos(\pi/2) = 0 and sin⁡0=0\sin 0 = 0. Evaluate the second partials there: fxx=−1f_{xx} = -1, fyy=−1f_{yy} = -1, and fxy=0f_{xy} = 0.

D=fxxfyy−fxy 2=(−1)(−1)−02=1>0D = f_{xx}f_{yy} - f_{xy}^{\,2} = (-1)(-1) - 0^2 = 1 > 0

With D>0D > 0 and fxx<0f_{xx} < 0, the second derivative test calls this a local maximum, and indeed f(π/2,0)=1f(\pi/2, 0) = 1 is the largest value a product of a sine and a cosine can reach.

Adding the pure second partials gives fxx+fyy=−2sin⁡xcos⁡y=−2ff_{xx} + f_{yy} = -2\sin x \cos y = -2f. A function whose Laplacian is a constant multiple of itself is an eigenfunction of the Laplacian, and this particular one is the shape of a standing wave on a rectangular membrane.

Frequently asked questions

Why do f_xx and f_yy come out equal for this function?

Because each pure second derivative differentiates one trig factor twice, and two derivatives of a sine or a cosine return the same function times −1-1. Both routes therefore rebuild sin⁡xcos⁡y\sin x \cos y with a minus sign in front.

What is the mixed partial of sin x cos y?

It is fxy=−cos⁡xsin⁡yf_{xy} = -\cos x \sin y, and you get the same expression whichever order you differentiate in. It vanishes wherever cos⁡x=0\cos x = 0 or sin⁡y=0\sin y = 0, which is exactly where the critical points of the surface sit.