Gradient & Directional Derivative Calculator
Calculus, Multivariable
Intro: Computes the gradient ∇f at a point and the directional derivative in the direction of a given vector (normalized automatically).
Worked example
- For $f(x, y) = x^2 + 3xy − y^2$, find $∇f(1, 2)$ and the directional derivative in the direction of $v = (3, 4)$.
- First find the partial derivatives of $f(x,y)=x^2+3xy-y^2$.
- Compute $f_x = \dfrac{\partial}{\partial x}(x^2+3xy-y^2) = 2x + 3y$.
- Compute $f_y = \dfrac{\partial}{\partial y}(x^2+3xy-y^2) = 3x - 2y$.
- Evaluate the gradient at (1, 2): $f_x(1,2)=2\cdot1+3\cdot2 = 2+6=8$, and $f_y(1,2)=3\cdot1-2\cdot2 = 3-4=-1$.
- So $\nabla f(1,2) = \langle 8, -1 \rangle$.
- Next, normalize the direction vector $\mathbf{v}=(3,4)$. Its magnitude is $\|\mathbf{v}\|=\sqrt{3^2+4^2}=5$.
- The unit vector is $\mathbf{u}=\dfrac{1}{5}\langle3,4\rangle = \langle 3/5, 4/5 \rangle$.
- The directional derivative is $D_{\mathbf{u}}f = \nabla f(1,2) \cdot \mathbf{u} = \langle8,-1\rangle \cdot \langle3/5,4/5\rangle$.
- Compute the dot product: $8\cdot3/5 + (-1)\cdot4/5 = 24/5 - 4/5 = 20/5 = 4$.
- Answer: $\boxed{\nabla f(1,2)=\langle8,-1\rangle,\; D_{\mathbf{u}}f=4.}$
FAQs
Do I need to input a unit direction vector?
No. You can input any non-zero vector; we normalize it automatically before computing the directional derivative.
Why choose MathGPT?
- Get clear, step-by-step solutions that explain the “why,” not just the answer.
- See the rules used at each step (power, product, quotient, chain, and more).
- Optional animated walk-throughs to make tricky ideas click faster.
- Clean LaTeX rendering for notes, homework, and study guides.
How this calculator works
- Type or paste your function (LaTeX like
\sin,\lnworks too). - Press Generate a practice question button to generate the derivative and the full reasoning.
- Review each step to understand which rule was applied and why.
- Practice with similar problems to lock in the method.