Multivariable calculus

Directional derivative of e^(xy) at (1, 1)

At (1, 1) the gradient of f(x,y) = e^(xy) is (e, e), because each partial picks up a chain rule factor from the exponent. Dotting with the unit direction (0.28, 0.96) gives 1.24e, that is 31e/25 or about 3.3707, the rate of change of f per unit distance in that direction.

f(x,y)=exyf(x,y) = e^{xy}
Duf(1,1)=31e253.3707D_{\mathbf{u}} f(1,1) = \frac{31e}{25} \approx 3.3707

At x = 1, y = 1, in the unit direction (0.28, 0.96).

Both partials come from the chain rule

The outer function is exp\exp, whose derivative is itself, so each partial is exye^{xy} times the partial of the exponent. The exponent xyxy has x(xy)=y\frac{\partial}{\partial x}(xy) = y and y(xy)=x\frac{\partial}{\partial y}(xy) = x.

f=yexy,  xexy,f(1,1)=e,e\nabla f = \left\langle y\,e^{xy},\; x\,e^{xy} \right\rangle, \qquad \nabla f(1,1) = \langle e, e \rangle

Now dot with the given unit direction. Keeping ee symbolic to the end is cleaner than rounding early, and it makes the fraction obvious.

Duf(1,1)=e(0.28)+e(0.96)=1.24e=31e25D_{\mathbf{u}} f(1,1) = e(0.28) + e(0.96) = 1.24e = \frac{31e}{25}

The mistake: forgetting the factor in front

Students who remember only that the exponential is its own derivative write fx=exy\frac{\partial f}{\partial x} = e^{xy}. At (1,1)(1,1) that happens to give ee as well, so the error hides at this point and shows up everywhere else.

  • At (2,1)(2,1) the correct fx\frac{\partial f}{\partial x} is 1e27.3891 \cdot e^{2} \approx 7.389, and the careless version gives the same thing again
  • At (1,2)(1,2) the correct value is 2e214.782e^{2} \approx 14.78, while the careless version gives e27.389e^{2} \approx 7.389, off by a factor of 2
  • Check a case where the missing factor is not 1, and the mistake becomes visible immediately

The second trap is dotting with 7,24\langle 7, 24 \rangle rather than 0.28,0.96\langle 0.28, 0.96 \rangle. Those are the same direction, since 72+242=2527^2 + 24^2 = 25^2, but the answer would be 25 times too big.

Comparing with the steepest direction

Because the gradient is e,e\langle e, e \rangle, the steepest ascent direction at (1,1)(1,1) is the 45 degree line 1,1/2\langle 1, 1 \rangle / \sqrt{2}, and the fastest possible rate is e23.844e\sqrt{2} \approx 3.844.

Duf(1,1)=e2cosθ,θ28.7D_{\mathbf{u}} f(1,1) = e\sqrt{2}\,\cos\theta, \qquad \theta \approx 28.7^{\circ}

Our direction is about 28.7 degrees off the steepest one, which costs only about 12 percent of the rate. Near the maximum the cosine is flat, so being a little off the best direction barely matters.

The build re-checks that (0.28, 0.96) has length 1, rebuilds the gradient of e^(xy) at (1, 1) by central differences on the function itself, and fails unless the dot product is still 3.3707 to within a relative 1e-4.

Frequently asked questions

Why is the gradient (e, e) and not (1, 1)?

Each partial is the exponent's partial times exye^{xy}. At (1,1)(1,1) the exponent partials are y=1y = 1 and x=1x = 1, and exy=e1=ee^{xy} = e^{1} = e, so both components equal e2.718e \approx 2.718.

Is (0.28, 0.96) really a unit vector?

Yes. 0.282+0.962=0.0784+0.9216=10.28^2 + 0.96^2 = 0.0784 + 0.9216 = 1. It is the 7-24-25 right triangle written as a unit vector, and the build re-checks its length on every deploy.