Multivariable Calculus • Partial Derivatives

Directional Derivatives — Compute directional derivatives

Measure how a multivariable function changes as you move in any direction across its surface.

Multivariable Calculus emblem with three-dimensional axes, a function, and an orbiting path.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

Calculus began as a tool for understanding change, but for centuries it focused on functions of a single variable — asking how fast something changes as one input shifts. As mathematics grew more sophisticated in the 18th and 19th centuries, scientists and engineers needed to describe systems where multiple variables interact simultaneously. Temperature across a metal plate, air pressure across a weather map, or elevation across a mountain range all depend on at least two inputs. The question became: how do you measure the rate of change when you can walk in any direction?

1684 • Leibniz Publishes Calculus

Gottfried Wilhelm Leibniz published his foundational work on differential calculus, giving mathematicians the notation and framework for derivatives of single-variable functions.

1797 • Lagrange & Multivariable Functions

Joseph-Louis Lagrange formalized techniques for working with functions of several variables, laying groundwork for partial derivatives in his Théorie des fonctions analytiques.

1829 • Cauchy Formalizes Limits & Continuity

Augustin-Louis Cauchy rigorously defined limits and continuity for multivariable functions, providing the logical foundation needed for directional derivatives.

1860s • Directional Derivative Concept Emerges

Mathematicians formalized the directional derivative as a way to compute the rate of change of a function along any specified direction, unifying partial derivatives into a more general framework.

1900s • Modern Applications Flourish

Directional derivatives became essential in physics, engineering, machine learning, and economics — anywhere optimization along arbitrary paths is needed.

Partial derivatives answer the question of change along the x-axis or y-axis alone, but real-world motion rarely follows those axes perfectly. A hiker doesn't walk due east or due north — she walks northeast, or at some other angle. The directional derivative was developed precisely to fill this gap: it tells you the instantaneous rate of change of a function in any direction you choose.

SECTION 2

Core Principles & Definitions

Before computing directional derivatives, you need to understand four key ideas. These build upon your knowledge of partial derivatives and vectors, connecting them into a powerful tool for measuring change in any direction.

1

Unit Vector of Direction

A unit vector is a vector with magnitude 1 that specifies the direction of travel. It is written as û = ⟨a, b⟩ where a² + b² = 1. This ensures the derivative measures pure rate of change without being scaled by vector length.
2

Partial Derivatives

The partial derivative fx measures change along the x-direction, and fy measures change along the y-direction. These are the building blocks for any directional derivative.
3

The Gradient Vector

The gradient of f, written ∇f, packs both partial derivatives into a single vector: ∇f = ⟨fx, fy⟩. The gradient always points in the direction of steepest increase.
4

Dot Product Connection

The directional derivative is computed as the dot product of the gradient and the unit direction vector. This elegant formula — Dûf = ∇f · û — projects the gradient onto your chosen direction.
✦

KEY TAKEAWAY

Think of standing on a hillside. The gradient is like a compass arrow pointing straight uphill — the steepest way to climb. A directional derivative asks: if I choose to walk in some other direction (maybe diagonally across the slope), how steep is that particular path? The dot product with the gradient gives the answer: it tells you what fraction of the maximum steepness you experience in your chosen direction.

SECTION 3

Visual Explanation

The diagram below shows a surface z = f(x, y) viewed from above as a contour map. At a chosen point P, the gradient vector ∇f points toward the steepest ascent. A unit vector û defines the direction we care about, and the directional derivative Dûf measures how fast f changes along that direction.

Directional Derivative on a Contour Mapf = 1f = 2f = 3f = 4P∇f(steepest ascent)û(chosen direction)Dûfθ = angle between∇f and ûθLegend:Gradient ∇fUnit vector ûProjection (Dûf)Dashed ellipses = level curves (contour lines of equal f-value)
The pink arrow shows the gradient ∇f pointing toward the steepest increase, perpendicular to the contour lines. The cyan arrow is the unit direction vector û. The dashed amber arrow represents the directional derivative — the component of the gradient that aligns with your chosen direction.

Notice that when the unit vector û aligns perfectly with the gradient, the directional derivative equals the full magnitude of ∇f — you are climbing the steepest route. When û is perpendicular to ∇f, the directional derivative is zero because you are walking along a level curve where the function's value doesn't change. When û points opposite to the gradient, the directional derivative is negative — you are descending the steepest path.

SECTION 4

Mathematical Framework

Let's build the formula step by step. Suppose you have a differentiable function f(x, y) and you want to find its rate of change at a point (x₀, y₀) in the direction of a unit vector û = ⟨a, b⟩.

GRADIENT VECTOR

∇f(x,y)=⟨∂f/∂x,∂f/∂y⟩=⟨fx,fy⟩∇f(x, y) = ⟨ ∂f/∂x , ∂f/∂y ⟩ = ⟨ fₓ , f_y ⟩

∇f (read "del f" or "nabla f") is the gradient. fₓ is the partial derivative of f with respect to x; fyf_y is the partial derivative with respect to y.

UNIT DIRECTION VECTOR

u^=⟨a,b⟩wherea2+b2=1û = ⟨a, b⟩ where a² + b² = 1

If you're given a non-unit vector v = ⟨v₁, v₂⟩, normalize it: û = v / |v| = ⟨v₁ / √(v₁² + v₂²), v₂ / √(v₁² + v₂²)⟩.

DIRECTIONAL DERIVATIVE FORMULA

Du^f(x0,y0)=∇f(x0,y0)⋅u^=fx(x0,y0)×a+fy(x0,y0)×bD_û f(x₀, y₀) = ∇f(x₀, y₀) · û = fₓ(x₀, y₀) × a + f_y(x₀, y₀) × b

This is the dot product of the gradient evaluated at the point and the unit direction vector. It gives a scalar (a single number), not a vector.

ANGLE FORM

Du^f=∣∇f∣×cosθD_û f = |∇f| × cos θ

θ is the angle between the gradient and the direction vector. This form shows that the directional derivative is maximized when θ = 0° (same direction as gradient) and zero when θ = 90° (perpendicular to gradient).

⚠

Don't Forget to Normalize!

The most common mistake students make is forgetting to convert the direction vector into a unit vector before computing the dot product. If you use a vector that isn't length 1, your answer will be scaled incorrectly. Always check that a² + b² = 1 before plugging in.

SECTION 5

Step-by-Step Process & Visualization

Computing a directional derivative follows a consistent sequence of steps. The diagram below walks through the full process visually, and the numbered list summarizes the algorithm you should follow every time.

Step-by-Step: Computing D_û fSTEP 1Find fₓ and f_y(partial derivatives)STEP 2Evaluate at point (x₀, y₀)∇f(x₀, y₀) = ⟨fₓ, f_y⟩STEP 3Form the gradient∇f = ⟨number, number⟩STEP 4Normalize direction → û = v/|v|Check: a² + b² = 1STEP 5Compute dot product: D_û f = ∇f · û= fₓ × a + f_y × bRESULT: A scalar valuePositive = increasing, Negative = decreasing, Zero = levelWorked Mini-Example: f(x, y) = x² + xy, point (1, 2), direction v = ⟨3, 4⟩Step 1: fₓ = 2x + y, f_y = xStep 2: fₓ(1,2) = 4, f_y(1,2) = 1 → ∇f = ⟨4, 1⟩Step 4: |v| = √(9+16) = 5, û = ⟨3/5, 4/5⟩Step 5: D_û f = 4×(3/5) + 1×(4/5) = 12/5 + 4/5 = 16/5 = 3.2
The flowchart above traces the five-step algorithm from computing partial derivatives to the final scalar result. The mini-example at the bottom demonstrates each step with concrete numbers.
  1. Step 1: Find the partial derivatives fₓ and fyf_y by differentiating f with respect to each variable while treating the other as a constant.
  2. Step 2: Evaluate the partial derivatives at the given point (x₀, y₀) to get numerical values.
  3. Step 3: Assemble the gradient vector: ∇f(x₀, y₀) = ⟨fₓ(x₀, y₀), fyf_y(x₀, y₀)⟩.
  4. Step 4: Make sure the direction vector is a unit vector. If not, divide it by its magnitude.
  5. Step 5: Compute the dot product ∇f · û to get the directional derivative — a single number.

SECTION 6

Worked Example

Let's work through a full problem from start to finish. Suppose you are given f(x, y) = 3x² − xy + 4y² and asked to find the directional derivative at the point (2, −1) in the direction of the vector v = ⟨1, 3⟩.

Directional Derivative of f(x, y) = 3x² − xy + 4y²

  1. 1

    Step 1 — Find the partial derivatives

    Differentiate f with respect to x (treat y as a constant): fₓ = ∂/∂x (3x² − xy + 4y²) = 6x − y. Differentiate f with respect to y (treat x as a constant): fyf_y = ∂/∂y (3x² − xy + 4y²) = −x + 8y.
    fₓ = 6x − y, fyf_y = −x + 8y
  2. 2

    Step 2 — Evaluate at the point (2, −1)

    Substitute x = 2 and y = −1 into each partial derivative. fₓ(2, −1) = 6(2) − (−1) = 12 + 1 = 13. fyf_y(2, −1) = −(2) + 8(−1) = −2 − 8 = −10.
    fₓ = 13, fyf_y = −10
  3. 3

    Step 3 — Form the gradient vector

    Combine the evaluated partial derivatives into the gradient: ∇f(2, −1) = ⟨13, −10⟩.
    ∇f(2, −1) = ⟨13, −10⟩
  4. 4

    Step 4 — Normalize the direction vector

    The given direction is v = ⟨1, 3⟩. Compute its magnitude: |v| = √(1² + 3²) = √(1 + 9) = √10. The unit vector is û = ⟨1/√10, 3/√10⟩.
    û = ⟨1/√10, 3/√10⟩
  5. 5

    Step 5 — Compute the dot product

    D_û f = ∇f · û = 13 × (1/√10) + (−10) × (3/√10) = 13/√10 − 30/√10 = (13 − 30)/√10 = −17/√10. Rationalizing the denominator: −17/√10 = −17√10/10 ≈ −5.38.
    D_û f(2, −1) = −17/√10 ≈ −5.38
💡

Interpreting the Result

The negative value −5.38 tells us that as you move from the point (2, −1) in the direction ⟨1, 3⟩, the function f is decreasing at a rate of about 5.38 units of output per unit of distance traveled. If this were an elevation function, you would be heading downhill.

SECTION 7

Directional Derivatives vs. Partial Derivatives

It's important to understand how directional derivatives relate to the partial derivatives you already know. Partial derivatives are actually special cases of directional derivatives — they measure change along the coordinate axes specifically. The table below clarifies the differences and connections.

FeaturePartial DerivativeDirectional Derivative
DirectionOnly along the x-axis or y-axisAlong any direction specified by a unit vector û
Notationfₓ or ∂f/∂x, fyf_y or ∂f/∂yD_û f or ∇f · û
Special case?Yes — D with û = ⟨1, 0⟩ gives fₓ; û = ⟨0, 1⟩ gives fyf_yGeneral case that includes partial derivatives
OutputA scalar (single number)A scalar (single number)
Maximum valueDepends on function and axis alignmentEquals |∇f| when û aligns with the gradient

Partial derivatives are special cases of directional derivatives.

✦

KEY TAKEAWAY

Imagine a flashlight (the gradient) shining across a room. A partial derivative is like measuring how much light hits the north wall or the east wall specifically. A directional derivative is like measuring how much light you'd receive if you stood at any angle in the room. It generalizes partial derivatives to work in every direction, not just along the axes.

SECTION 8

Connection to Advanced Topics

The directional derivative is a gateway to several powerful ideas in higher mathematics. Understanding it well positions you to tackle these more advanced concepts with confidence.

This LessonAdvanced Extension
Directional derivative D_û f in 2DExtends naturally to 3D and higher dimensions: D_û f = ∇f · û works with three or more partial derivatives
Gradient ∇f points toward steepest ascentGradient descent algorithms in machine learning use −∇f to minimize loss functions iteratively
Dot product ∇f · û gives rate of changeThe total derivative (Jacobian matrix) generalizes this to vector-valued functions
D_û f = 0 perpendicular to ∇fLevel curves and implicit function theorem: solutions lie along surfaces where the gradient is normal

How directional derivatives connect to advanced multivariable calculus concepts.

One of the most exciting modern applications is gradient descent, the optimization algorithm behind virtually all neural network training. The idea is simple: if you want to minimize a function (such as the error of a prediction model), repeatedly step in the direction of −∇f — the negative gradient — because that's the direction of steepest decrease. Everything you've learned about directional derivatives and gradients in this lesson is the mathematical foundation for that process.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

If the gradient of f at a point is ∇f = ⟨5, 0⟩, what is the directional derivative in the direction û = ⟨0, 1⟩ (the positive y-direction)? Explain your reasoning without doing arithmetic.
Show answer
The directional derivative is 0. The gradient ∇f = ⟨5, 0⟩ points entirely in the x-direction, so all the change in f occurs along the x-axis. The direction û = ⟨0, 1⟩ is perpendicular to the gradient. Since D_û f = |∇f| × cos 90° = 0, there is no change in f when you move in the y-direction. This makes sense geometrically: moving along a level curve (perpendicular to the gradient) keeps the function value constant.

Question 2: BASIC CALCULATION

Given f(x, y) = x² + 3y², find the directional derivative at the point (1, 1) in the direction of the unit vector û = ⟨√2/2, √2/2⟩.
Show answer
First, compute the partial derivatives: fₓ = 2x and fyf_y = 6y. Evaluate at (1, 1): fₓ(1, 1) = 2 and fyf_y(1, 1) = 6, so ∇f(1, 1) = ⟨2, 6⟩. Since û = ⟨√2/2, √2/2⟩ is already a unit vector (check: (√2/2)² + (√2/2)² = 1/2 + 1/2 = 1), compute D_û f = ⟨2, 6⟩ · ⟨√2/2, √2/2⟩ = 2(√2/2) + 6(√2/2) = √2 + 3√2 = 4√2 ≈ 5.66. The function is increasing at approximately 5.66 units per unit distance in this direction.

Question 3: INTERMEDIATE

Let f(x, y) = sin(x) × y². Find the directional derivative at the point (π/2, 3) in the direction of v = ⟨−4, 3⟩. (Remember to normalize v first.)
Show answer
Compute partial derivatives: fₓ = cos(x) × y² and fyf_y = sin(x) × 2y. Evaluate at (π/2, 3): fₓ(π/2, 3) = cos(π/2) × 9 = 0 × 9 = 0, and fyf_y(π/2, 3) = sin(π/2) × 6 = 1 × 6 = 6. So ∇f = ⟨0, 6⟩. Normalize v = ⟨−4, 3⟩: |v| = √(16 + 9) = √25 = 5, so û = ⟨−4/5, 3/5⟩. Compute D_û f = 0 × (−4/5) + 6 × (3/5) = 0 + 18/5 = 3.6. The function increases at 3.6 units per unit distance in this direction. Notice that fₓ = 0 here, so the entire directional derivative comes from the y-component.

Question 4: APPLIED

A topographic map models the elevation of a hillside as h(x, y) = 500 − 2x² − y², where x and y are measured in meters. A hiker stands at position (5, 10) and wants to walk in the direction toward the point (8, 14). At what rate is the elevation changing (in meters of height per meter of horizontal distance) as the hiker starts walking?
Show answer
The direction vector from (5, 10) toward (8, 14) is v = ⟨8 − 5, 14 − 10⟩ = ⟨3, 4⟩. Normalize: |v| = √(9 + 16) = 5, so û = ⟨3/5, 4/5⟩. Compute partial derivatives: hₓ = −4x and hyh_y = −2y. Evaluate at (5, 10): hₓ(5, 10) = −20 and hyh_y(5, 10) = −20, giving ∇h = ⟨−20, −20⟩. Now compute D_û h = (−20)(3/5) + (−20)(4/5) = −12 + (−16) = −28. The elevation is decreasing at 28 meters of height per meter of horizontal distance. This is a very steep downhill slope, indicating the hiker would descend rapidly in this direction.

Question 5: CRITICAL THINKING

For the function f(x, y) = eˣ × cos(y), find the direction (expressed as a unit vector) in which the directional derivative at the point (0, π/4) is maximized. Then find that maximum value. Finally, explain why no direction can produce a directional derivative larger than this maximum.
Show answer
Compute partial derivatives: fₓ = eˣ × cos(y) and fyf_y = −eˣ × sin(y). At (0, π/4): fₓ = e⁰ × cos(π/4) = 1 × (√2/2) = √2/2, and fyf_y = −e⁰ × sin(π/4) = −√2/2. So ∇f(0, π/4) = ⟨√2/2, −√2/2⟩. The directional derivative is maximized when û points in the same direction as the gradient. Normalize the gradient: |∇f| = √((√2/2)² + (−√2/2)²) = √(1/2 + 1/2) = √1 = 1. Since |∇f| = 1, the gradient is already a unit vector, so the optimal direction is û = ⟨√2/2, −√2/2⟩, and the maximum directional derivative is |∇f| = 1. No direction can exceed this because D_û f = |∇f| × cos θ, and cos θ ≤ 1 for all angles θ. The maximum occurs when θ = 0° (û aligned with ∇f), giving D_û f = |∇f| × 1 = |∇f|.

SUMMARY

Lesson Summary

Summary

The directional derivative D_û f measures the instantaneous rate of change of a multivariable function f(x, y) at a specific point in the direction of a unit vector û. To compute it, first find the partial derivatives fₓ and fyf_y, evaluate them at the given point, and assemble them into the gradient vector ∇f = ⟨fₓ, fyf_y⟩. Then normalize the direction vector (if needed) and take the dot product: D_û f = ∇f · û.

Key insights to remember: the directional derivative is maximized when û aligns with ∇f (steepest ascent), equals zero when û is perpendicular to ∇f (moving along a level curve), and is most negative when û opposes ∇f (steepest descent). Partial derivatives are simply directional derivatives along the coordinate axes. This concept forms the foundation for gradient descent and optimization throughout mathematics, science, and machine learning.

Varsity Tutors • Multivariable Calculus • Directional Derivatives — Compute directional derivatives