The Directional Derivative

Example

f[x_,y_]=x*Exp[y]+Cos[x*y];
Plot3D[f[x,y],{x,0,4},{y,-1,2},PlotRange->All,AxesLabel->{" x"," y"," z"},ColorFunction->"AvocadoColors"]
surface=ContourPlot[f[x,y],{x,0,4},{y,-1,2},PlotRange->All,FrameLabel->{" x"," y"},ContourShading->False,Contours->40]

Clear[f,x0,y0,u1,u2]
f[x_,y_]=x*Exp[y]+Cos[x*y];
x0=2;y0=0;u1=3;u2=-4;
grad={D[f[x,y],x]/.{x->x0,y->y0},D[f[x,y],y]/.{x->x0,y->y0}}
direction=(({u1,u2})/(Sqrt[(u1^2)+(u2^2)]))
rate=grad.direction
gradplot=Graphics[{Purple,Arrow[{{x0,y0},{x0,y0}+grad}]}];
directionplot=Graphics[{Red,Arrow[{{x0,y0},{x0,y0}+direction}]}];
Show[surface,gradplot,directionplot]

Here's an animation.

Clear[f,x0,y0,u1,u2,directionplot]
f[x_,y_]=x*Exp[y]+Cos[x*y];

x0=2;
y0=0;

grad={D[f[x,y],x]/.{x->x0,y->y0},D[f[x,y],y]/.{x->x0,y->y0}};

unitu[u_]:=(u/(Sqrt[u.u]))

rate:=grad.unitu[u]

gradplot=Graphics[{Purple,Arrow[{{x0,y0},{x0,y0}+grad}]}];

directionplot[t_]=Graphics[{Red,Arrow[{{x0,y0},{x0,y0}+unitu[{Cos[t],Sin[t]}]}]}];

Manipulate[
Show[
surface,
gradplot,
directionplot[t],
Graphics[{Text[grad.unitu[{Cos[t],Sin[t]}],{1,1}]}]],
{t,0,2Pi}]

The purple vector is ∇f , and the red vector is the direction we are calculuating the directional derivative in.
Notice the maximum of the directional derivative is in the direction of the gradient of f, ∇f  (the purple vector). The minimum is in the direction -∇f. The directional derivative is zero in direction orthogonal to ∇f.

Another Example

Clear[f,x0,y0,u1,u2,directionplot]
f[x_,y_]=Cos[x]Sin[y];

surface=ContourPlot[f[x,y],{x,0,2},{y,0,2},PlotRange->All,FrameLabel->{" x"," y"},ContourShading->False,Contours->40,AspectRatio->1];

x0=1;
y0=1;

grad={D[f[x,y],x]/.{x->x0,y->y0},D[f[x,y],y]/.{x->x0,y->y0}};

unitu[u_]:=(u/(Sqrt[u.u]))

rate:=grad.unitu[u]

gradplot=Graphics[{Purple,Arrow[{{x0,y0},{x0,y0}+grad}]}];

directionplot[t_]=Graphics[{Red,Arrow[{{x0,y0},{x0,y0}+unitu[{Cos[t],Sin[t]}]}]}];

Manipulate[
Show[
surface,
gradplot,
directionplot[t],
Graphics[{Text[N[grad.unitu[{Cos[t],Sin[t]}]],{1.5,1.5}]}]],
{t,0,2Pi}]

The purple vector is ∇f , and the red vector is the direction we are calculuating the directional derivative in.
Notice the maximum of the directional derivative is in the direction of the gradient of f, ∇f  (the purple vector). The minimum is in the direction -∇f. The directional derivative is zero in direction orthogonal to ∇f.