Directional Derivative and Gradient Calculator

Enter a multivariable function, a point, and any nonzero direction vector. The calculator finds the symbolic gradient, evaluates it at the point, normalizes the direction, and computes the directional derivative—all locally in your browser.

Enter the function and vectors

Use ^ for powers and * between variables: x*y, not xy. Supported functions include sin, cos, exp, ln, sqrt, and abs.

Use 2–6 distinct single-letter variables.

For x, y enter x first, then y.

Any nonzero vector; it is normalized automatically.

Try an example

Keyboard shortcut: Ctrl/ + Enter.

Advertisement

Gradient and directional derivative

Symbolic gradient
The gradient will appear here.
Gradient at the point
Enter valid coordinates to evaluate the gradient.
Directional derivative
The unit direction and dot-product result will appear here.

Step-by-step calculation

Gradient, normalization, and dot-product steps will appear here.

Calculator methodology and limits

Developed and reviewed by
Starlight Robotics calculator team
Last reviewed
Method
Symbolic partial derivatives → point evaluation → Euclidean vector normalization → gradient dot unit direction.
Input limits
Two to six distinct single-letter variables, a 300-character function, and finite decimal coordinates.
Privacy
The function, point, direction, and results remain in your browser; no solving API receives them.
Domain note
The gradient method assumes differentiability at the point. Roots, logarithms, denominators, absolute values, and piecewise behavior may restrict the domain.

How to use the directional derivative calculator

  1. Enter a function such as x^2*y + y^3. Use explicit multiplication between different variables.
  2. List the variables in coordinate order, then enter the point and direction components in that same order.
  3. Select Calculate gradient and derivative. The direction vector does not need length 1; the calculator normalizes it.
  4. Review the symbolic gradient, evaluated vectors, dot product, gradient magnitude, and steepest-ascent direction.

Gradient and directional derivative formulas

For a scalar function of n variables, the gradient collects its first partial derivatives:

\[\nabla f=\left\langle \frac{\partial f}{\partial x_1},\frac{\partial f}{\partial x_2},\ldots,\frac{\partial f}{\partial x_n}\right\rangle\]

If v is a nonzero direction vector, first form the unit vector u = v/‖v‖. For a differentiable function at point p:

\[D_{\mathbf u}f(\mathbf p)=\nabla f(\mathbf p)\cdot\mathbf u\]

The gradient points in the direction of fastest increase when it is nonzero, and ‖∇f(p)‖ is the maximum directional derivative. This formula and the normalization of arbitrary direction vectors follow the standard treatment in OpenStax Calculus, Volume 3, section 4.6.

Worked examples

Non-unit direction

For f=x²y+y³ at (1,2), ∇f = ⟨4,13⟩. The direction ⟨3,4⟩ becomes ⟨3/5,4/5⟩.

The directional derivative is 4(3/5)+13(4/5)=12.8.

Three variables

For f=xyz, ∇f = ⟨yz,xz,xy⟩. At (1,2,3), it is ⟨6,3,2⟩.

Use the same coordinate order for every point and direction vector.

Zero gradient

For f=x²+y² at (0,0), ∇f = ⟨0,0⟩.

The gradient-based directional derivative is zero in every direction, and no unique steepest direction is selected.

Directional derivative and gradient FAQs

What is the formula for a directional derivative?

For a differentiable function and unit vector u, the directional derivative at p is ∇f(p) · u. It is a scalar rate of change per unit distance.

Does my direction vector need to be a unit vector?

No. Enter any nonzero vector. The calculator divides it by its Euclidean magnitude before applying the dot-product formula.

Why does vector order matter?

Each position must refer to the same variable throughout. If the variable list is x,y,z, then point and direction components must also be entered in x, y, z order.

What does the gradient tell me?

At a differentiable point with a nonzero gradient, it points in the direction of steepest increase. Its magnitude equals the largest possible directional derivative there.

What happens when the gradient is zero?

The dot product with every unit direction is zero. That makes the point stationary to first order, but it does not by itself prove the point is a maximum or minimum.

Can the gradient formula fail?

Yes. The dot-product formula requires differentiability at the point. A function can have missing partial derivatives, a corner, or other nondifferentiable behavior. The calculator flags non-real or undefined values but cannot certify differentiability for every expression.

Does my input leave the browser?

No. Parsing, symbolic differentiation, evaluation, normalization, and dot products run on your device.

Explore more mathematical tools

Explore more tools