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.
At x = 1, y = 1, in the unit direction (0.28, 0.96).
Both partials come from the chain rule
The outer function is , whose derivative is itself, so each partial is times the partial of the exponent. The exponent has and .
Now dot with the given unit direction. Keeping symbolic to the end is cleaner than rounding early, and it makes the fraction obvious.
The mistake: forgetting the factor in front
Students who remember only that the exponential is its own derivative write . At that happens to give as well, so the error hides at this point and shows up everywhere else.
- At the correct is , and the careless version gives the same thing again
- At the correct value is , while the careless version gives , 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 rather than . Those are the same direction, since , but the answer would be 25 times too big.
Comparing with the steepest direction
Because the gradient is , the steepest ascent direction at is the 45 degree line , and the fastest possible rate is .
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 . At the exponent partials are and , and , so both components equal .
Is (0.28, 0.96) really a unit vector?
Yes. . It is the 7-24-25 right triangle written as a unit vector, and the build re-checks its length on every deploy.