Multivariable calculus

Second Partials of x sin(y) + y cos(x)

For f(x,y) = x sin(y) + y cos(x) the second partials are f_xx = -y cos(x), f_yy = -x sin(y), and the mixed partial f_xy = cos(y) - sin(x). Every term of f contributes to the mixed partial, one piece from each, while the pure second partials pick up only one term apiece. Both mixed orders agree.

f(x,y)=xsiny+ycosxf(x,y) = x\sin y + y\cos x
fx=sinyysinx\frac{\partial f}{\partial x} = \sin y - y\sin x
fy=xcosy+cosx\frac{\partial f}{\partial y} = x\cos y + \cos x

Second and mixed partials

2fx2=ycosx\frac{\partial^{2} f}{\partial x^{2}} = -y\cos x
2fyx=cosysinx\frac{\partial^{2} f}{\partial y\,\partial x} = \cos y - \sin x
2fy2=xsiny\frac{\partial^{2} f}{\partial y^{2}} = -x\sin y

Handle the sum one term at a time

Differentiation is linear, so treat xsinyx\sin y and ycosxy\cos x separately and add. For the xx partial, siny\sin y is a constant multiplier on xx, and yy is a constant multiplier on cosx\cos x.

fx=sinyysinx,fy=xcosy+cosx\frac{\partial f}{\partial x} = \sin y - y\sin x, \qquad \frac{\partial f}{\partial y} = x\cos y + \cos x

For fxxf_{xx}, the term siny\sin y has no xx and dies, leaving only the derivative of ysinx-y\sin x.

2fx2=ycosx,2fy2=xsiny\frac{\partial^{2} f}{\partial x^{2}} = -y\cos x, \qquad \frac{\partial^{2} f}{\partial y^{2}} = -x\sin y

The mixed partial is where both original terms survive. Differentiating sinyysinx\sin y - y\sin x in yy keeps a piece from each.

2fyx=cosysinx\frac{\partial^{2} f}{\partial y\,\partial x} = \cos y - \sin x

Why this is a good Clairaut test case

The two orders take completely different routes here. Going yy first gives xcosy+cosxx\cos y + \cos x, and differentiating that in xx gives cosysinx\cos y - \sin x: the first term keeps its cosine and loses the xx, the second loses nothing but its sign.

2fxy=cosysinx=2fyx\frac{\partial^{2} f}{\partial x\,\partial y} = \cos y - \sin x = \frac{\partial^{2} f}{\partial y\,\partial x}

Both routes land on the same expression because sines, cosines, and products of them with polynomials are continuous everywhere, which is the hypothesis Clairaut's theorem needs.

The mixed partial is also the entry that makes the Hessian symmetric, so the second derivative test only needs D=fxxfyy(fxy)2=xysinycosx(cosysinx)2D = f_{xx}f_{yy} - \left(f_{xy}\right)^{2} = xy\sin y\cos x - \left(\cos y - \sin x\right)^{2}. That number classifies critical points only, and the origin is not one: fy(0,0)=0cos0+cos0=1f_y(0,0) = 0\cdot\cos 0 + \cos 0 = 1, so the surface is still sloping in the yy direction there and D(0,0)=1D(0,0) = -1 classifies nothing.

The mistake students make

The usual error is deciding that a term which vanished from fxxf_{xx} must also vanish from fxyf_{xy}. The term xsinyx\sin y contributes nothing to fxxf_{xx}, since it is linear in xx, but it contributes the cosy\cos y in the mixed partial. Each second partial has to be built from the correct first partial, not guessed from the others.

The second error is a sign slip on xcosx=sinx\frac{\partial}{\partial x}\cos x = -\sin x, and then again on x(sinx)=cosx\frac{\partial}{\partial x}\left(-\sin x\right) = -\cos x. Two derivatives of cosine give one minus sign in total, not two.

Check at x=0x = 0, y=0y = 0. There fxx=0f_{xx} = 0, fyy=0f_{yy} = 0, and fxy=1f_{xy} = 1, which you can also read straight off the function: near the origin fxy+yf \approx xy + y, whose only curvature is the twist term xyxy.

Frequently asked questions

Why does f_xx contain y but no x term from x sin y?

Because xsinyx\sin y is linear in xx. Its first xx derivative is the constant siny\sin y, and the second is zero. Only ycosxy\cos x survives two xx derivatives, giving ycosx-y\cos x.

How do I use these to build the quadratic approximation at a point?

The second order Taylor polynomial at (a,b)(a,b) uses ff, both first partials, and all three second partials: f+fxh+fyk+12(fxxh2+2fxyhk+fyyk2)f + f_x h + f_y k + \frac{1}{2}\left(f_{xx}h^{2} + 2f_{xy}hk + f_{yy}k^{2}\right). The factor 2 on the cross term is exactly Clairaut symmetry, since fxyf_{xy} and fyxf_{yx} each contribute once.