# What is the directional derivative of f?

Finds the directional derivative D_u f = ∇f · u of f(x, y) or f(x, y, z) at a point, in the direction of a vector, with the gradient.

- Page: https://www.acalculator.org/math/directional-derivative-calculator
- JSON spec: https://www.acalculator.org/math/directional-derivative-calculator.json
- Version: 59fb633bc0ff

## Default answer

Example with the default inputs (f(x, y, z) x^2 - x y + 3y^2, Point x -1, Point y 2, Direction, x part 3, Direction, y part 4): The directional derivative of x^2 - x y + 3y^2 at the point in the direction (3, 4) is 8.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| f | f(x, y, z) | The function, in x and y, or x, y and z. |
| x0 | Point x | The x coordinate of the point. |
| y0 | Point y | The y coordinate of the point. |
| z0 | Point z (for f in x, y, z) | The z coordinate; leave empty for f(x, y). |
| u1 | Direction, x part | The x component of the direction vector. |
| u2 | Direction, y part | The y component of the direction vector. |
| u3 | Direction, z part | The z component; empty is 0. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| value | D_u f | How fast f changes at the point, per unit of distance along u. |
| exact | Exact D_u f | The directional derivative, exactly. |
| gradient | ∇f = | The gradient (f_x, f_y) or (f_x, f_y, f_z). |
| gradientAt | ∇f at the point | The gradient at the point. |
| steepest | Largest D_u f | ‖∇f‖ at the point: the directional derivative along ∇f. |

## Method

D_u f(P) = ∇f(P) · v/‖v‖, each partial derivative from a computer algebra system, checked numerically.

## Assumptions

- The direction v is scaled to length 1 first.
- Angles in radians. An answer that fails its check is not shown.

## Worked examples

1. f = x^2 - x y + 3y^2, x0 = -1, y0 = 2, u1 = 3, u2 = 4 gives value = 8, exact = 8, gradient = (2x - y, -x + 6y), gradientAt = (-4, 13). Source: OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient), Example 4.32 (u = (3/5, 4/5)).
2. f = 5x^2 - 2x y + y^2 - 4y z + z^2 + 3x z, x0 = 1, y0 = -2, z0 = 3, u1 = -1, u2 = 2, u3 = 2 gives value = -8.333333, exact = -25/3. Source: OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient), Example 4.37.
3. f = x y, x0 = 1, y0 = 1, u1 = 1, u2 = 1 gives value = 1.414214, steepest = 1.414214.

## FAQ

### What is a directional derivative?

The rate at which f changes at a point as you move from it in the direction of a unit vector u. For f(x, y) and u = (a, b), D_u f(x, y) = f_x(x, y) a + f_y(x, y) b. The partial derivatives f_x and f_y are the directional derivatives along the x and y axes.

### How do I find a directional derivative?

Find the gradient ∇f = (f_x, f_y, f_z), evaluate it at the point, and take its dot product with the unit vector u = v/‖v‖ in the chosen direction. For f = x² − xy + 3y² at (−1, 2) towards (3, 4): ∇f(−1, 2) = (−4, 13) and u = (3/5, 4/5), so D_u f = −12/5 + 52/5 = 8.

### Do I need to type a unit vector?

No. Type any nonzero vector in the direction you want; the page divides it by its length first. (3, 4) and (0.6, 0.8) give the same answer.

### What if the direction is given as an angle θ?

Type the direction vector (cos θ, sin θ). For θ = π/3 that is (0.5, 0.8660254038), or use (1, 1.732050808), since only the direction counts.

### In which direction is the directional derivative largest?

In the direction of the gradient ∇f. The largest value is ‖∇f‖ at the point, shown as "Largest D_u f". Opposite the gradient f falls fastest, at −‖∇f‖, and at right angles to it D_u f is 0.

### How is the answer checked?

Each partial derivative comes from a computer algebra system and must match a numeric difference quotient at 15 test points. The exact value is shown only when it equals the decimal value to 10⁻⁹.

## Sources

- OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (retrieved 2026-10-03): https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient
