Multivariable calculus

Gradient of sin(x + 2y + 3z): A Fixed Direction

For f(x, y, z) = sin(x + 2y + 3z) the gradient is cos(x + 2y + 3z) times the fixed vector (1, 2, 3). Every component shares the same cosine factor, and the coefficients 1, 2 and 3 come from the chain rule. At the origin the gradient is (1, 2, 3), of length about 3.742.

f(x,y,z)=sin(x+2y+3z)f(x,y,z) = \sin\left(x + 2y + 3z\right)
f=cos(x+2y+3z)1,  2,  3\nabla f = \cos\left(x + 2y + 3z\right)\left\langle 1,\; 2,\; 3 \right\rangle
fx=cos(x+2y+3z)\frac{\partial f}{\partial x} = \cos\left(x + 2y + 3z\right)
fy=2cos(x+2y+3z)\frac{\partial f}{\partial y} = 2\cos\left(x + 2y + 3z\right)
fz=3cos(x+2y+3z)\frac{\partial f}{\partial z} = 3\cos\left(x + 2y + 3z\right)

One outer derivative, three inner derivatives

Set u=x+2y+3zu = x + 2y + 3z. The outer function is sinu\sin u, whose derivative is cosu\cos u no matter which variable you are differentiating. What changes from component to component is the inner derivative.

ux=1,uy=2,uz=3\frac{\partial u}{\partial x} = 1, \qquad \frac{\partial u}{\partial y} = 2, \qquad \frac{\partial u}{\partial z} = 3

Multiply the shared outer factor by each inner derivative in turn.

f=cosu,  2cosu,  3cosu=cos(x+2y+3z)1,  2,  3\nabla f = \left\langle \cos u,\; 2\cos u,\; 3\cos u \right\rangle = \cos\left(x + 2y + 3z\right)\left\langle 1,\; 2,\; 3 \right\rangle

Factoring the cosine out shows the structure at a glance. The gradient is always a scalar multiple of 1,2,3\left\langle 1, 2, 3 \right\rangle, so its direction is fixed up to sign for the whole of space.

The mistake: losing the coefficients 2 and 3

Writing f=cosu,cosu,cosu\nabla f = \left\langle \cos u, \cos u, \cos u \right\rangle is the standard error. It comes from treating ysin(u)\frac{\partial}{\partial y}\sin(u) as cos(u)\cos(u) and stopping, which skips the inner derivative. Those coefficients are the whole point: ff responds three times as strongly to a change in zz as to the same change in xx.

  • Rewrite the argument first if it helps: sin(x+2y+3z)\sin(x + 2y + 3z) has inner function u=x+2y+3zu = x+2y+3z, and uy=2\frac{\partial u}{\partial y} = 2 is not 1.
  • A quick test: at the origin the true rate in the zz direction is 3, so a small step of 0.01 in zz changes ff by about 0.03, not 0.01.
  • The reverse error, attaching the coefficients to the argument as in cos(2y)\cos(2y), changes the function rather than the derivative.

Level surfaces are parallel planes

At the origin, u=0u = 0 and cos0=1\cos 0 = 1, so the gradient takes its largest possible size.

f(0,0,0)=1,  2,  3,f=143.742\nabla f(0,0,0) = \left\langle 1,\; 2,\; 3 \right\rangle, \qquad \left| \nabla f \right| = \sqrt{14} \approx 3.742

The level surfaces sin(x+2y+3z)=c\sin(x+2y+3z) = c are stacks of parallel planes x+2y+3z=constantx + 2y + 3z = \text{constant}, and 1,2,3\left\langle 1,2,3 \right\rangle is the normal vector to those planes. This matches the general rule that the gradient is perpendicular to level surfaces, and here it is visible directly in the coefficients.

The gradient vanishes where cos(x+2y+3z)=0\cos(x+2y+3z) = 0, that is on the planes x+2y+3z=π2+kπx + 2y + 3z = \frac{\pi}{2} + k\pi. Those are the crests and troughs of the wave, entire planes of critical points where f=±1f = \pm 1.

Frequently asked questions

Why is the direction of steepest ascent the same everywhere?

Because every component carries the same cosine factor, so f\nabla f is always a multiple of 1,2,3\left\langle 1,2,3 \right\rangle. When the cosine is positive, steepest ascent is 1141,2,3\frac{1}{\sqrt{14}}\left\langle 1,2,3 \right\rangle. When it is negative, ascent points the opposite way.

What is the largest rate of change this function ever has?

It is 143.742\sqrt{14} \approx 3.742, reached wherever cos(x+2y+3z)=1\left| \cos(x+2y+3z) \right| = 1, which happens on the planes x+2y+3z=kπx + 2y + 3z = k\pi. There f=0f = 0, so the wave is steepest as it crosses zero.