Multivariable calculus

Gradient of e^(xy) sin(z) in Three Variables

For f(x, y, z) = e^(xy) sin(z) the gradient is (y e^(xy) sin z, x e^(xy) sin z, e^(xy) cos z). For the x and y partials, sin z is a constant multiplier and the chain rule acts on the exponent xy. For the z partial, e^(xy) is the constant. The gradient vanishes only where x = y = 0 and cos z = 0.

f(x,y,z)=exysinzf(x,y,z) = e^{xy}\sin z
f=yexysinz,  xexysinz,  exycosz\nabla f = \left\langle y\,e^{xy}\sin z,\; x\,e^{xy}\sin z,\; e^{xy}\cos z \right\rangle
fx=yexysinz\frac{\partial f}{\partial x} = y\,e^{xy}\sin z
fy=xexysinz\frac{\partial f}{\partial y} = x\,e^{xy}\sin z
fz=exycosz\frac{\partial f}{\partial z} = e^{xy}\cos z

Decide which factor is frozen, then differentiate the other

The function splits into a factor in xx and yy and a factor in zz alone. For the first two components, sinz\sin z is a constant multiplier and all the work is the chain rule on the exponent.

fx=sinzexyx(xy)=yexysinz\frac{\partial f}{\partial x} = \sin z \cdot e^{xy}\cdot\frac{\partial}{\partial x}(xy) = y\,e^{xy}\sin z
fy=sinzexyy(xy)=xexysinz\frac{\partial f}{\partial y} = \sin z \cdot e^{xy}\cdot\frac{\partial}{\partial y}(xy) = x\,e^{xy}\sin z

For the third component the roles reverse. Nothing in exye^{xy} mentions zz, so it comes along as a multiplier and the sine is differentiated.

fz=exyddz(sinz)=exycosz\frac{\partial f}{\partial z} = e^{xy}\cdot\frac{d}{dz}\left(\sin z\right) = e^{xy}\cos z

Every component keeps the full exye^{xy}. It is a factor of the original function, and no partial derivative here can remove it, since the exponential is never differentiated away.

Where the gradient is zero, and a point check

The factor exye^{xy} is positive everywhere, so it can be divided out of all three equations. What remains is ysinz=0y\sin z = 0, xsinz=0x\sin z = 0 and cosz=0\cos z = 0.

The third equation forces z=π2+kπz = \frac{\pi}{2}+k\pi, and at those values sinz=±1\sin z = \pm 1, which is not zero. So the first two equations reduce to y=0y = 0 and x=0x = 0.

f=0,0,0    x=0,  y=0,  z=π2+kπ\nabla f = \left\langle 0,0,0 \right\rangle \iff x = 0,\; y = 0,\; z = \tfrac{\pi}{2}+k\pi

Those isolated points sit on the zz axis, spaced π\pi apart, alternating between f=1f = 1 and f=1f = -1.

For a concrete evaluation take (1,1,0)(1, 1, 0), where sinz=0\sin z = 0 kills the first two components.

f(1,1,0)=0,  0,  e0,  0,  2.7183\nabla f(1,1,0) = \left\langle 0,\; 0,\; e \right\rangle \approx \left\langle 0,\; 0,\; 2.7183 \right\rangle

That says something readable about the surface: on the plane z=0z = 0 the function is identically zero, so it cannot change in xx or yy there, and the only way to move off that flat sheet is in the zz direction.

The mistake: losing a factor when the variable is not the live one

The dominant errors are dropped factors, and each has a different cause.

  • Writing fz=cosz\frac{\partial f}{\partial z} = \cos z, having discarded exye^{xy} because it contains no zz. A factor without the live variable is a multiplier, not something to delete.
  • Writing fx=exysinz\frac{\partial f}{\partial x} = e^{xy}\sin z, forgetting the inner derivative of the exponent. That is the same slip as writing the derivative of exye^{xy} as exye^{xy}.
  • Applying the product rule across exye^{xy} and sinz\sin z when differentiating in xx, and picking up a phantom term exycosze^{xy}\cos z. With respect to xx, the derivative of sinz\sin z is zero, so that term vanishes.

Test at (0,0,0)(0,0,0): the true gradient is 0,0,1\left\langle 0, 0, 1\right\rangle, since sin0=0\sin 0 = 0 and e0=1e^{0} = 1. The dropped-exponential version also gives 11 there, so use (1,1,0)(1,1,0) instead, where the true zz component is e2.7183e \approx 2.7183 and that version returns 11.

Frequently asked questions

Why do the xx and yy components look identical apart from the swap?

Because ff is symmetric in xx and yy: the only place they appear is in the product xyxy. Swapping them leaves the function unchanged, so it must swap the two partials as well, and yexysinzy e^{xy}\sin z becomes xexysinzx e^{xy}\sin z.

Does the gradient ever point purely in the zz direction?

Yes, everywhere on the planes z=kπz = k\pi, where sinz=0\sin z = 0 kills the first two components while cosz=±1\cos z = \pm 1 keeps the third alive. It also happens on the zz axis, where x=y=0x = y = 0 makes the first two components vanish, apart from the critical points z=π2+kπz = \frac{\pi}{2}+k\pi, where the whole vector is zero and no direction is defined.