Calculus · real student question

Compute the gradient and the directional derivative in the direction of the vector (0, -1) for the function f(x, y) = x^2 y + x e^(-xy).

Question

Compute the gradient and the directional derivative in the direction v=(0,1)T\mathbf{v}=(0,-1)^{T} of

f(x,y)=x2y+xexy.f(x,y)=x^{2}y+x e^{-xy}.

Step-by-step solution

  1. Recall the rule and check the direction vector. For a unit vector v\mathbf v, the directional derivative is the dot product Dvf=fvD_{\mathbf v}f=\nabla f\cdot \mathbf v. Here (0,1)=02+(1)2=1\|(0,-1)\|=\sqrt{0^2+(-1)^2}=1, so v\mathbf v is already a unit vector and no normalisation is needed. Had it not been, we would have had to divide by its length first.

  2. Differentiate with respect to xx. The term x2yx^2y gives 2xy2xy. The term xexyxe^{-xy} needs the product rule together with the chain rule, since xexy=yexy\partial_x e^{-xy}=-y e^{-xy}:

    x(xexy)=exyxyexy.\frac{\partial}{\partial x}\left(xe^{-xy}\right)=e^{-xy}-xy\,e^{-xy}.

    So

    fx=2xy+(1xy)exy.f_x=2xy+(1-xy)e^{-xy}.

  3. Differentiate with respect to yy. Now xx is a constant, so x2yx^2y gives x2x^2, and yexy=xexy\partial_y e^{-xy}=-x e^{-xy} makes the second term x2exy-x^2 e^{-xy}:

    fy=x2x2exy=x2(1exy).f_y=x^{2}-x^{2}e^{-xy}=x^{2}\left(1-e^{-xy}\right).

  4. Assemble the gradient.

    f(x,y)=(2xy+(1xy)exyx2(1exy)).\nabla f(x,y)=\begin{pmatrix}2xy+(1-xy)e^{-xy}\\[2pt] x^{2}\left(1-e^{-xy}\right)\end{pmatrix}.

  5. Dot with the direction. Because v=(0,1)\mathbf v=(0,-1) kills the first component, only the yy-partial survives, with a sign flip:

    Dvf=f(0,1)=fy=x2(1exy)=x2(exy1).D_{\mathbf v}f=\nabla f\cdot(0,-1)=-f_y=-x^{2}\left(1-e^{-xy}\right)=x^{2}\left(e^{-xy}-1\right).

    That is exactly what the geometry says: moving in the y-y direction is moving backwards along yy, so the rate of change is the negative of fyf_y.

  6. Spot-check numerically. At (x,y)=(1.3,0.7)(x,y)=(1.3,0.7) a central difference gives fx1.856227f_x\approx 1.856227 and fy1.009734f_y\approx 1.009734, matching the formulas, and Dvf1.009734D_{\mathbf v}f\approx-1.009734. At (2,1.5)(-2,1.5) the formula gives Dvf76.342D_{\mathbf v}f\approx 76.342, again matching the numerical derivative.

Answer

f=(2xy+(1xy)exy, x2(1exy)),D(0,1)f=x2(1exy)\nabla f=\left(2xy+(1-xy)e^{-xy},\ x^{2}\left(1-e^{-xy}\right)\right),\qquad D_{(0,-1)}f=-x^{2}\left(1-e^{-xy}\right)

Need to solve a different problem like this? Open the solver →