Multivariable calculus

Directional derivative of sin(xy) at (0, 2)

At (0, 2) the gradient of f(x,y) = sin(xy) is (2, 0), since the x partial is y cos(xy) and the y partial is x cos(xy). Dotting with the unit direction (0.6, -0.8) gives 6/5, that is 1.2. Only the x component contributes, because the y partial vanishes when x = 0.

f(x,y)=sin(xy)f(x,y) = \sin(xy)
Duf(0,2)=65=1.2D_{\mathbf{u}} f(0,2) = \frac{6}{5} = 1.2

At x = 0, y = 2, in the unit direction (0.6, -0.8).

Differentiate, then substitute

The chain rule gives cos(xy)\cos(xy) times the partial of the product xyxy, which is yy in the xx slot and xx in the yy slot. Do that in general first, and only then put in the point.

f=ycos(xy),  xcos(xy),f(0,2)=2,0\nabla f = \left\langle y\cos(xy),\; x\cos(xy) \right\rangle, \qquad \nabla f(0,2) = \langle 2, 0 \rangle

At (0,2)(0,2) the argument xyxy is 0, so cos(xy)=1\cos(xy) = 1. The xx partial is y=2y = 2 and the yy partial is x=0x = 0.

Duf(0,2)=2(0.6)+0(0.8)=65D_{\mathbf{u}} f(0,2) = 2(0.6) + 0(-0.8) = \frac{6}{5}

The mistake: substituting before you differentiate

Set x=0x = 0 first and ff collapses to sin(0)=0\sin(0) = 0 for every yy. The zero function has zero derivative, so this route reports a directional derivative of 0, which is wrong by 1.2.

What went missing is the change in ff caused by moving off the line x=0x = 0. Restricting to that line before differentiating throws away exactly the information the xx partial carries. Substitution is the last step, never the first.

The honest statement is narrower: the derivative of ff along the yy axis is 0 at this point, and that is why the 0.8-0.8 in the direction contributes nothing here.

What the number says about the surface

The steepest ascent at (0,2)(0,2) is straight along the positive xx axis, at rate f(0,2)=2\lVert \nabla f(0,2) \rVert = 2. Our direction is about 53.1 degrees away from that, and since cosθ\cos\theta is exactly 0.6 the rate is 2(0.6)=1.22(0.6) = 1.2.

  • Fastest increase: direction 1,0\langle 1, 0 \rangle, rate 2
  • Fastest decrease: direction 1,0\langle -1, 0 \rangle, rate 2-2
  • No change: directions 0,±1\langle 0, \pm 1 \rangle, straight up or down the yy axis

The build re-checks that (0.6, -0.8) has length 1, rebuilds the gradient of sin(xy) at (0, 2) by central differences on the function itself, and fails unless the dot product is still 1.2.

Frequently asked questions

Why does the y part of the direction not matter at this point?

Because fy=xcos(xy)\frac{\partial f}{\partial y} = x\cos(xy) is 0 when x=0x = 0. Any unit direction with the same xx component gives the same answer at (0,2)(0,2), no matter what its yy component is.

Is the answer still 1.2 at a nearby point like (0.1, 2)?

No. There the gradient is about 1.960,0.098\langle 1.960, 0.098 \rangle, and the dot product with 0.6,0.8\langle 0.6, -0.8 \rangle is about 1.098. A directional derivative is a statement about one point only.