Compute the gradient and the directional derivative in the direction of
Recall the rule and check the direction vector. For a unit vector , the directional derivative is the dot product . Here , so is already a unit vector and no normalisation is needed. Had it not been, we would have had to divide by its length first.
Differentiate with respect to . The term gives . The term needs the product rule together with the chain rule, since :
So
Differentiate with respect to . Now is a constant, so gives , and makes the second term :
Assemble the gradient.
Dot with the direction. Because kills the first component, only the -partial survives, with a sign flip:
That is exactly what the geometry says: moving in the direction is moving backwards along , so the rate of change is the negative of .
Spot-check numerically. At a central difference gives and , matching the formulas, and . At the formula gives , again matching the numerical derivative.
Need to solve a different problem like this? Open the solver →