Multivariable calculus

Partial Derivatives of x^2 sin(y)

For f(x, y) = x squared times sin(y), the partial derivative with respect to x is 2x sin(y), and the partial derivative with respect to y is x squared times cos(y). Each partial differentiates only its own factor and keeps the other one as a constant multiplier.

f(x,y)=x2sinyf(x,y) = x^2 \sin y
fx=2xsiny\frac{\partial f}{\partial x} = 2x\sin y
fy=x2cosy\frac{\partial f}{\partial y} = x^2\cos y

One factor moves, the other is a number

Hold yy fixed. Then siny\sin y is some number ss, and f=sx2f = s x^2 is a plain parabola in xx with derivative 2sx2sx. Restore s=sinys = \sin y.

fx=2xsiny\frac{\partial f}{\partial x} = 2x\sin y

Hold xx fixed instead. Now x2x^2 is a number and ff is a sine wave in yy scaled by that number, so the derivative is x2cosyx^2\cos y.

fy=x2cosy\frac{\partial f}{\partial y} = x^2\cos y

Read them at (1,π2)\left(1, \frac{\pi}{2}\right): fx=2sinπ2=2\frac{\partial f}{\partial x} = 2\sin\frac{\pi}{2} = 2 and fy=cosπ2=0\frac{\partial f}{\partial y} = \cos\frac{\pi}{2} = 0. The surface is at a crest in the yy direction there, so moving in yy costs nothing to first order.

The mistake: mixing the two rules together

A frequent wrong answer is 2xcosy2x\cos y, which differentiates both factors in the same step. Another is 2xsiny+x2cosy2x\sin y + x^2\cos y, which is the full product rule as if xx and yy were the same variable. Both come from not deciding which variable is moving.

  • 2xsiny2x\sin y differentiates x2x^2 only, correct for fx\frac{\partial f}{\partial x}.
  • x2cosyx^2\cos y differentiates siny\sin y only, correct for fy\frac{\partial f}{\partial y}.
  • The sum of the two is the rate of change along the direction (1,1)(1,1), not a partial derivative at all.

If you ever need that sum, it has a name: it is f(1,1)\nabla f\cdot(1,1), the rate at which ff changes along a path that moves one unit in yy for every unit in xx. Divide it by 2\sqrt{2} if you want the directional derivative in the unit direction, since (1,1)(1,1) has length 2\sqrt{2}.

Second derivatives and the shape

Differentiate again to see the curvature. 2fx2=2siny\frac{\partial^2 f}{\partial x^2} = 2\sin y and 2fy2=x2siny\frac{\partial^2 f}{\partial y^2} = -x^2\sin y. Off the line x=0x = 0, wherever siny>0\sin y > 0 the surface curves upward in xx and downward in yy, so those points sit on saddle shaped patches. On x=0x = 0 itself the yy curvature is zero, and in fact both partials vanish along that whole line, so the second derivative test says nothing there.

The mixed partial is 2fxy=2xcosy\frac{\partial^2 f}{\partial x \partial y} = 2x\cos y whichever order you take, since differentiating 2xsiny2x\sin y by yy and x2cosyx^2\cos y by xx both land there.

Frequently asked questions

Where do both partials vanish?

You need 2xsiny=02x\sin y = 0 and x2cosy=0x^2\cos y = 0. If x=0x = 0 both are zero for every yy, so the whole yy axis is a line of critical points. If x0x \neq 0 you would need siny\sin y and cosy\cos y zero at once, which never happens.

Does the answer change if I write the function as sin(y) x^2?

No. Multiplication commutes, and each partial derivative only cares about which factor contains the moving variable.