Tutorials › Calculus III › Recovering a Gradient from Directional Measurements

Directional Derivatives and Gradients · Tutorial 390 of 999

Recovering a Gradient from Directional Measurements

Convert directional measurements into equations and solve for the gradient, using independent unit directions to ensure the system determines a unique answer.

Intermediate 9 min read

What You'll Learn

  • Translate a directional-rate measurement into a dot-product equation for the gradient
  • Assemble measurements in two or three independent unit directions into a linear system
  • Recover a gradient by solving the system and checking each measurement
  • Explain why independent directions guarantee a unique solution
  • Detect and correct the error caused by using unnormalized direction vectors

From directional rates to an unknown gradient

A gradient is often used to predict a directional rate: take the dot product of the gradient with a unit direction. The same relationship can be used in reverse. If a scalar field’s directional rates are measured in enough independent directions at one point, those measurements can determine the gradient there.

This is an inverse problem: the measurements are known, and the components of the gradient are unknown. The key is to turn each measured rate into a linear equation. In two variables, two independent directions give two equations for two unknowns; in three variables, three independent directions give three equations for three unknowns.

Definition: Let \(f\) be differentiable at a point \(\mathbf{p}\). Its gradient is the vector of partial derivatives at that point. For a unit vector \(\mathbf{u}\), the directional derivative is the rate of change of \(f\) at \(\mathbf{p}\) in direction \(\mathbf{u}\), and it satisfies \(D_{\mathbf{u}}f(\mathbf{p})=\nabla f(\mathbf{p})\cdot\mathbf{u}\).

Throughout, all the measurements must refer to the same point, and each direction used in the dot-product equation must be a unit vector. Write the unknown gradient as a vector of unknown components, then use the measured rates to form and solve a linear system.

Writing the system

In two dimensions, write \(\nabla f(\mathbf{p})=(g_x,g_y)\). If the measured rate in the unit direction \(\mathbf{u}_i=(u_{ix},u_{iy})\) is \(r_i\), then

$$ u_{ix}g_x+u_{iy}g_y=r_i. $$

With two directions, this becomes a two-equation system. In three dimensions, write \(\nabla f(\mathbf{p})=(g_x,g_y,g_z)\). A measurement in direction \(\mathbf{u}_i=(u_{ix},u_{iy},u_{iz})\) gives

$$ u_{ix}g_x+u_{iy}g_y+u_{iz}g_z=r_i. $$

Stacking the equations gives a matrix system. For \(n=2\) or \(n=3\), let the \(n\) measured unit directions be the rows of \(\mathbf{U}\), let \(\mathbf{g}\) be the column of gradient components, and let \(\mathbf{r}\) be the column of measured rates. Then

$$ \mathbf{U}\mathbf{g}=\mathbf{r}. $$

If the direction vectors are linearly independent, the square matrix \(\mathbf{U}\) is invertible. The system therefore has exactly one solution, given by \(\mathbf{g}=\mathbf{U}^{-1}\mathbf{r}\). In practice, solving the equations by elimination is often simpler than calculating a matrix inverse.

Why independent directions determine the gradient

Each measurement gives one dot product of the unknown gradient with a known direction. Geometrically, one such equation constrains the gradient but usually does not identify it by itself. Independent directions provide distinct constraints. The following argument explains why a complete set of independent measurements determines exactly one gradient.

1
Suppose a solution exists.
Let \(\mathbf{g}_1\) and \(\mathbf{g}_2\) both satisfy all the measured equations. Then \(\mathbf{U}\mathbf{g}_1=\mathbf{r}\) and \(\mathbf{U}\mathbf{g}_2=\mathbf{r}\).
2
Subtract the equations.
Subtracting gives \(\mathbf{U}(\mathbf{g}_1-\mathbf{g}_2)=\mathbf{0}\).
3
Use independence.
Independent rows in a square matrix make \(\mathbf{U}\) invertible. Multiplying by \(\mathbf{U}^{-1}\) gives \(\mathbf{g}_1-\mathbf{g}_2=\mathbf{0}\), so \(\mathbf{g}_1=\mathbf{g}_2\).
4
Conclude uniqueness and existence.
An invertible matrix has a solution for every right-hand side \(\mathbf{r}\), and the argument above shows that solution is unique. Thus the measurements determine exactly one vector of gradient components.

The proof depends on having a square system with independent direction vectors. The unit-length condition is needed for interpreting each right-hand side as the rate in that direction. If a direction is not a unit vector, it must be normalized before using the directional-derivative formula in this form.

Worked examples

Worked Example: Recovering a two-dimensional gradient

At a point \(\mathbf{p}\), the measured directional rate is \(6\) in the unit direction \(\mathbf{u}_1=(3/5,4/5)\), and the rate is \(2\) in the unit direction \(\mathbf{u}_2=(-4/5,3/5)\). Find \(\nabla f(\mathbf{p})\).

Write \(\nabla f(\mathbf{p})=(g_x,g_y)\). The first dot product gives

$$ \frac{3}{5}g_x+\frac{4}{5}g_y=6 \quad\Longrightarrow\quad 3g_x+4g_y=30. $$

The second measurement gives

$$ -\frac{4}{5}g_x+\frac{3}{5}g_y=2 \quad\Longrightarrow\quad -4g_x+3g_y=10. $$

Multiply the first equation by \(3\), and the second by \(4\):

$$ 9g_x+12g_y=90, \qquad -16g_x+12g_y=40. $$

Subtract the second equation from the first: \(25g_x=50\), so \(g_x=2\). Substitute into \(3g_x+4g_y=30\): \(6+4g_y=30\), so \(g_y=6\). Thus the recovered gradient is \((2,6)\).

Check both measurements by taking the dot products:

$$ (2,6)\cdot(3/5,4/5)=6/5+24/5=6, \qquad (2,6)\cdot(-4/5,3/5)=-8/5+18/5=2. $$

Both rates match the data.

Worked Example: Recovering a three-dimensional gradient

At \(\mathbf{p}\), the measured rates in the unit directions \(\mathbf{u}_1=(1,0,0)\), \(\mathbf{u}_2=(0,3/5,4/5)\), and \(\mathbf{u}_3=(3/5,0,4/5)\) are respectively \(2\), \(9/5\), and \(18/5\). Find \(\nabla f(\mathbf{p})\).

Let \(\nabla f(\mathbf{p})=(g_x,g_y,g_z)\). The three measurements give

$$ g_x=2,\qquad \frac{3}{5}g_y+\frac{4}{5}g_z=\frac{9}{5},\qquad \frac{3}{5}g_x+\frac{4}{5}g_z=\frac{18}{5}. $$

Multiply the last two equations by \(5\):

$$ 3g_y+4g_z=9, \qquad 3g_x+4g_z=18. $$

Use \(g_x=2\) in the second of these: \(6+4g_z=18\), so \(g_z=3\). Substitute into the first: \(3g_y+12=9\), so \(g_y=-1\). Therefore \(\nabla f(\mathbf{p})=(2,-1,3)\).

Check each rate:

$$ (2,-1,3)\cdot(1,0,0)=2, $$ $$ (2,-1,3)\cdot(0,3/5,4/5)=-3/5+12/5=9/5, $$ $$ (2,-1,3)\cdot(3/5,0,4/5)=6/5+12/5=18/5. $$

All three reconstructed rates agree with the measurements.

Worked Example: Solving with nonorthogonal directions

Suppose the measured rates are \(4\) in the unit direction \(\mathbf{u}_1=(1,0)\) and \(6\) in the unit direction \(\mathbf{u}_2=(3/5,4/5)\). These directions are not perpendicular, but they are independent. Find the gradient.

Let \(\nabla f(\mathbf{p})=(g_x,g_y)\). The first measurement gives \(g_x=4\). The second gives

$$ \frac{3}{5}g_x+\frac{4}{5}g_y=6. $$

Substitute \(g_x=4\): \(12/5+(4/5)g_y=6\). Multiply by \(5\) to obtain \(12+4g_y=30\), so \(4g_y=18\) and \(g_y=9/2\). The gradient is \((4,9/2)\).

Checking the dot products gives \((4,9/2)\cdot(1,0)=4\), and \((4,9/2)\cdot(3/5,4/5)=12/5+18/5=6\). Perpendicular directions are not required; independence is what makes the two equations determine a unique vector.

A common scaling mistake

A directional derivative uses a unit direction. If the measurement is reported for the direction of a nonzero vector \(\mathbf{w}\), the corresponding unit vector is \(\mathbf{w}/\lVert\mathbf{w}\rVert\). Substituting \(\mathbf{w}\) itself into the dot product without adjusting for its length changes the equation.

Common mistake: If a measured rate is \(6\) along the direction of \((3,4)\), writing \(3g_x+4g_y=6\) treats \((3,4)\) as a unit vector. Its length is \(5\), so the unit direction is \((3/5,4/5)\), and the correct equation is \((3/5)g_x+(4/5)g_y=6\), or \(3g_x+4g_y=30\).

For instance, with the two measurements from the first worked example, the incorrect equations would be \(3g_x+4g_y=6\) and \(-4g_x+3g_y=2\). Solving them gives \(g_x=2/5\), \(g_y=6/5\). But their dot product with the first unit direction is \((3/5)(2/5)+(4/5)(6/5)=30/25=6/5\), not \(6\). The check exposes the scaling error. Using the correct right-hand sides, \(30\) and \(10\), recovers \((2,6)\), which reproduces both measured rates.

Why recovering a gradient matters

Directional measurements describe how a field changes along selected directions. Recovering the gradient organizes those measurements into one vector that predicts the rate in any unit direction \(\mathbf{v}\) through the dot product \(\nabla f(\mathbf{p})\cdot\mathbf{v}\). This is useful when a field is known through measurements rather than through a convenient formula, as can happen with sampled temperature, elevation, or concentration data.

The calculation relies on local differentiability at the point and on measurements that genuinely represent directional derivatives there. Independent directions make the resulting square system uniquely solvable; unit directions ensure that the right-hand sides have the intended rate interpretation. After solving, substituting the proposed gradient into every original dot-product equation is an essential check.

Check Your Understanding

Use the dot-product relationship and show enough work to justify each answer.

  1. In two variables, what equation does a measured rate \(r\) in a unit direction \((a,b)\) impose on an unknown gradient \((g_x,g_y)\)?
  2. Why do two linearly independent direction measurements determine a unique two-dimensional gradient?
  3. A rate is measured in the direction of \((5,12)\). What unit vector should be used in the gradient dot product?
  4. At a point, the rates in directions \((1,0)\) and \((0,1)\) are \(3\) and \(-2\). What is the gradient, and how can you check it?
  5. In three dimensions, how many independent directional measurements are needed for this square-system method to recover all gradient components?