Multivariable calculus

Partial Derivatives of sin(x^2 + y^2): Chain Rule

The partials of sin(x^2 + y^2) are f_x = 2x cos(x^2 + y^2) and f_y = 2y cos(x^2 + y^2). Treat the inner expression x^2 + y^2 as one block: the outer sine becomes a cosine of that same block, and the block's own partial supplies the factor 2x or 2y.

f(x,y)=sin(x2+y2)f(x,y) = \sin(x^2 + y^2)
fx=2xcos(x2+y2)\frac{\partial f}{\partial x} = 2x\cos(x^2 + y^2)
fy=2ycos(x2+y2)\frac{\partial f}{\partial y} = 2y\cos(x^2 + y^2)

One chain rule, two partials

Write u=x2+y2u = x^2 + y^2, so f=sinuf = \sin u. The single variable chain rule does all the work. Differentiate the outer sine, then multiply by the partial derivative of uu with respect to whichever variable you are varying.

fx=cos(u)ux=2xcos(x2+y2)\frac{\partial f}{\partial x} = \cos(u)\cdot\frac{\partial u}{\partial x} = 2x\cos(x^2 + y^2)

For yy the outer factor is identical. Only the inner partial changes, from 2x2x to 2y2y, so compute cos(x2+y2)\cos(x^2+y^2) once and reuse it.

fy=cos(u)uy=2ycos(x2+y2)\frac{\partial f}{\partial y} = \cos(u)\cdot\frac{\partial u}{\partial y} = 2y\cos(x^2 + y^2)

Where students lose the inner derivative

The usual error is writing fx=cos(x2+y2)\frac{\partial f}{\partial x} = \cos(x^2 + y^2) and stopping. That is the derivative of sinu\sin u with respect to uu, not with respect to xx. It is off by exactly the factor 2x2x. At x=0.7x = 0.7, y=1.3y = 1.3 the true partial is 0.801-0.801 and the truncated version gives 0.572-0.572, a ratio of 1.41.4, which is 2x2x.

A second slip is treating yy as constant so aggressively that y2y^2 disappears from inside the cosine. Holding yy fixed means its value stays put during the differentiation, not that it leaves the expression.

  • Name the inner function before you differentiate anything.
  • Write the outer derivative with uu still in it, then substitute back.
  • Multiply by the inner partial as a separate written step, not mentally.

Reading the answer geometrically

Both partials carry the same cosine factor, so the gradient is cos(x2+y2)(2x,2y)\cos(x^2+y^2)\,(2x,\, 2y), a scalar times the radial vector (x,y)(x,y). Wherever it is not the zero vector, the gradient points straight toward or straight away from the origin, which is what you expect from a surface depending only on distance from the origin.

It also tells you where both partials vanish at once: either x=y=0x = y = 0, or cos(x2+y2)=0\cos(x^2+y^2) = 0, meaning x2+y2=π2, 3π2, x^2 + y^2 = \frac{\pi}{2},\ \frac{3\pi}{2},\ \dots. Those circles are the crests and troughs of the ripple.

Frequently asked questions

Do I have to apply the chain rule separately for each variable?

You apply it twice, but only the inner factor changes. The outer derivative cos(x2+y2)\cos(x^2+y^2) is common to both, so compute it once and attach 2x2x for the xx partial and 2y2y for the yy partial.

What is the gradient at the origin?

The zero vector. Both partials contain a factor of xx or yy, so both vanish at (0,0)(0,0). Near the origin sin(x2+y2)\sin(x^2+y^2) behaves like x2+y2x^2 + y^2, so that critical point is a local minimum with value 00.