Multivariable calculus

Second partial derivatives of sin(xy)

For f(x,y) = sin(xy) the second partials are f_xx = -y^2 sin(xy), f_yy = -x^2 sin(xy), and the mixed partial is f_xy = f_yx = cos(xy) - xy sin(xy). The mixed one needs the product rule, because the first partial y cos(xy) contains y in two places. At the origin the discriminant is -1, a saddle.

f(x,y)=sin(xy)f(x,y) = \sin(xy)
fx=ycos(xy)\frac{\partial f}{\partial x} = y\cos(xy)
fy=xcos(xy)\frac{\partial f}{\partial y} = x\cos(xy)

Second and mixed partials

2fx2=y2sin(xy)\frac{\partial^2 f}{\partial x^2} = -y^2\sin(xy)
2fyx=cos(xy)xysin(xy)\frac{\partial^2 f}{\partial y\,\partial x} = \cos(xy) - xy\sin(xy)
2fy2=x2sin(xy)\frac{\partial^2 f}{\partial y^2} = -x^2\sin(xy)

Chain rule first, then decide whether you also need the product rule

The inside is u=xyu = xy. Differentiating in xx with yy held fixed, the inner derivative is ux=y\frac{\partial u}{\partial x} = y, so fx=ycos(xy)f_x = y\cos(xy). By symmetry fy=xcos(xy)f_y = x\cos(xy).

fx=ycos(xy),fy=xcos(xy)\frac{\partial f}{\partial x} = y\cos(xy), \qquad \frac{\partial f}{\partial y} = x\cos(xy)

For fxxf_{xx}, differentiate ycos(xy)y\cos(xy) in xx again. The factor yy out front is a constant here, so only the chain rule is in play and it contributes a second factor of yy.

2fx2=y2sin(xy)\frac{\partial^2 f}{\partial x^2} = -y^{2}\sin(xy)

The mixed partial is the interesting one. Differentiating ycos(xy)y\cos(xy) in yy hits yy in two separate places, the leading factor and the inside of the cosine, so the product rule is required.

y[ycos(xy)]=1cos(xy)+y(xsin(xy))=cos(xy)xysin(xy)\frac{\partial}{\partial y}\bigl[y\cos(xy)\bigr] = 1\cdot\cos(xy) + y\cdot\bigl(-x\sin(xy)\bigr) = \cos(xy) - xy\sin(xy)

The mistake: dropping the cos(xy) term

By far the most common wrong answer is fxy=xysin(xy)f_{xy} = -xy\sin(xy). It comes from differentiating the inside of the cosine and forgetting that the leading yy also depends on yy. The result fails an easy test: at the origin the correct mixed partial is cos0=1\cos 0 = 1, while the wrong version gives 00.

A quick way to stay honest is to ask, before differentiating, how many times the variable appears in the expression. In ycos(xy)y\cos(xy) the variable yy appears twice, so the answer must have two terms. In ycos(xy)y\cos(xy) the variable xx appears once, so fxxf_{xx} has a single term and no product rule.

Check Clairaut symmetry by taking the other route. Starting from fy=xcos(xy)f_y = x\cos(xy) and differentiating in xx gives cos(xy)+x(ysin(xy))=cos(xy)xysin(xy)\cos(xy) + x(-y\sin(xy)) = \cos(xy) - xy\sin(xy), the same expression.

What the Hessian says at the origin

Both first partials vanish at (0,0)(0,0), so the origin is a critical point. Substituting there gives fxx=0f_{xx} = 0, fyy=0f_{yy} = 0 and fxy=1f_{xy} = 1.

D=fxxfyyfxy2=0012=1<0D = f_{xx}f_{yy} - f_{xy}^{\,2} = 0\cdot 0 - 1^2 = -1 < 0

A negative discriminant means a saddle. That matches the picture: along the line y=xy = x the function is sin(x2)\sin(x^2), which rises away from the origin, while along y=xy = -x it is sin(x2)-\sin(x^2), which falls. The pure second partials being zero is what forces the classification onto the mixed partial.

Frequently asked questions

Why does the mixed partial of sin(xy) have two terms?

Because fx=ycos(xy)f_x = y\cos(xy) contains yy twice, once as the leading factor and once inside the cosine. Differentiating in yy therefore needs the product rule, giving cos(xy)\cos(xy) from the first factor and xysin(xy)-xy\sin(xy) from the second.

Do the two mixed partials of sin(xy) agree?

Yes, both equal cos(xy)xysin(xy)\cos(xy) - xy\sin(xy). Every second partial of sin(xy)\sin(xy) is continuous on the whole plane, so Clairaut's theorem applies and the order of differentiation makes no difference.