Tutorials › Calculus III › Temperature and Terrain Direction Problems

Directional Derivatives and Gradients · Tutorial 400 of 999

Temperature and Terrain Direction Problems

Use gradient data and unit heading vectors to interpret local rates of temperature and elevation change in practical settings.

Intermediate 9 min read

What You'll Learn

  • Convert a compass heading into east–north vector components.
  • Calculate a field’s instantaneous rate of change along a specified unit heading.
  • Compare local warming or elevation rates along different headings.
  • Identify the direction of fastest increase and decrease from a gradient.
  • Find and verify headings with zero instantaneous change.

Reading a Gradient as Local Field Information

A temperature map or elevation map gives values at different locations, but a gradient gives more specific local information: it describes how the field changes as you move from a particular point. With that information, you can compare different headings, choose a direction of fastest increase or decrease, or find a heading along which the field has no instantaneous change.

The same calculation has different physical interpretations depending on the field. For temperature, a rate might be measured in degrees Celsius per kilometre. For terrain elevation, it might be metres of elevation change per kilometre travelled. In each case, the gradient points in the direction of greatest instantaneous increase, and its magnitude is the greatest rate per unit distance.

Headings and Directional Rates

Use coordinates in which the first component points east and the second points north. A heading is represented by a unit vector \(\mathbf{u}=(u_1,u_2)\), where \(u_1^2+u_2^2=1\). The unit length matters: the rate is measured per unit distance travelled, not per unit of an arbitrarily scaled vector.

Definition: Let \(f(x,y)\) be a differentiable scalar field at a point \(P=(x_0,y_0)\), and let \(\mathbf{u}=(u_1,u_2)\) be a unit direction vector. The directional derivative of \(f\) at \(P\) in direction \(\mathbf{u}\) is the instantaneous rate of change of \(f\) per unit distance travelled in that direction. It is \(D_{\mathbf{u}}f(P)=\nabla f(P)\cdot\mathbf{u}\), where \(\nabla f(P)=(f_x(P),f_y(P))\).

For a compass bearing measured clockwise from north, the east–north components of the unit heading at bearing \(\theta\) are \((\sin\theta,\cos\theta)\). Thus a bearing of \(0^\circ\) points north, \(90^\circ\) points east, and \(180^\circ\) points south. If a problem gives a heading directly as a vector, first check that it has unit length; if not, divide it by its magnitude.

The dot product makes the rate calculation direct. If \(\nabla f(P)=(a,b)\), then the rate along \(\mathbf{u}=(u_1,u_2)\) is \(au_1+bu_2\). A positive result means the field increases in that direction, a negative result means it decreases, and zero means there is no instantaneous change along that heading.

Why the Dot-Product Formula Works

The formula comes from following the field along a straight path through \(P\). For a unit heading \(\mathbf{u}\), write that path as \(\mathbf{r}(t)=P+t\mathbf{u}\). Because \(\mathbf{u}\) has length one, changing \(t\) by a small amount corresponds to travelling that same amount of distance along the path. The chain rule gives the rate of the field along this path:

$$ \frac{d}{dt}f(\mathbf{r}(t)) = \nabla f(\mathbf{r}(t))\cdot\mathbf{r}'(t). $$

At \(t=0\), the path is at \(P\), and \(\mathbf{r}'(t)=\mathbf{u}\). Therefore the instantaneous rate there is \(\nabla f(P)\cdot\mathbf{u}\), as claimed. This also explains why the heading must have unit length when the result is to be interpreted as a rate per unit distance.

Worked Example: Comparing Temperature Changes Along Headings

Worked Example: Comparing Temperature Changes Along Headings

At a location, suppose the temperature gradient is \(\nabla T=(2,-3)\) degrees Celsius per kilometre, with components measured east and north. Compare the instantaneous temperature rates when travelling east, north, and northeast.

The east heading is \(\mathbf{u}_E=(1,0)\). Its rate is

$$ D_{\mathbf{u}_E}T = (2,-3)\cdot(1,0) = 2(1)+(-3)(0) = 2\ \text{°C/km}. $$

The north heading is \(\mathbf{u}_N=(0,1)\). Its rate is

$$ D_{\mathbf{u}_N}T = (2,-3)\cdot(0,1) = 2(0)+(-3)(1) = -3\ \text{°C/km}. $$

The northeast heading is halfway between east and north, so its unit vector is \(\mathbf{u}_{NE}=(1/\sqrt{2},1/\sqrt{2})\). Its rate is

$$ D_{\mathbf{u}_{NE}}T = (2,-3)\cdot\left(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}\right) = \frac{2}{\sqrt{2}}-\frac{3}{\sqrt{2}} = -\frac{1}{\sqrt{2}}\ \text{°C/km}. $$

Thus temperature is increasing fastest among these three headings when travelling east, at \(2\) °C/km. It is decreasing along the north and northeast headings; the northward decrease has the greater magnitude of the two. As a check, each rate is the gradient dotted with the stated unit heading, and each has the same units as the gradient: degrees Celsius per kilometre.

Fastest Increase and Decrease

For a nonzero gradient, the direction of fastest increase is the unit vector pointing along the gradient. The direction of fastest decrease is the opposite unit vector. The corresponding rates are the magnitude of the gradient and its negative. This conclusion follows from the dot-product inequality: for unit \(\mathbf{u}\), \(\nabla f(P)\cdot\mathbf{u}\leq \lVert\nabla f(P)\rVert\), with equality when \(\mathbf{u}\) points along the gradient.

Takeaway: If \(\nabla f(P)\ne\mathbf{0}\), the steepest-increase heading is \(\nabla f(P)/\lVert\nabla f(P)\rVert\), and the greatest increase per unit distance is \(\lVert\nabla f(P)\rVert\). The steepest-decrease heading is \(-\nabla f(P)/\lVert\nabla f(P)\rVert\), with rate \(-\lVert\nabla f(P)\rVert\). If the gradient is zero, every heading has directional derivative zero at that point.

Worked Example: Choosing a Direction on a Slope

Worked Example: Choosing a Direction on a Slope

At a point on a hillside, suppose the elevation gradient is \(\nabla h=(6,8)\) metres per kilometre, with east and north components. Find the direction and rate of steepest ascent, the steepest-descent rate, and the rate on a compass bearing of \(060^\circ\).

First calculate the gradient’s magnitude:

$$ \lVert\nabla h\rVert = \sqrt{6^2+8^2} = \sqrt{36+64} = 10\ \text{m/km}. $$

The unit vector in the gradient direction is

$$ \frac{\nabla h}{\lVert\nabla h\rVert} = \left(\frac{6}{10},\frac{8}{10}\right) = \left(\frac{3}{5},\frac{4}{5}\right). $$

So steepest ascent points \(3/5\) of its unit length eastward and \(4/5\) northward, and its rate is \(10\) m/km. The opposite heading is \((-3/5,-4/5)\); its rate is

$$ (6,8)\cdot\left(-\frac{3}{5},-\frac{4}{5}\right) = -\frac{18}{5}-\frac{32}{5} = -10\ \text{m/km}. $$

A bearing of \(060^\circ\) has east–north unit vector \((\sin 60^\circ,\cos 60^\circ)=(\sqrt{3}/2,1/2)\). Therefore the elevation rate on that heading is

$$ (6,8)\cdot\left(\frac{\sqrt{3}}{2},\frac{1}{2}\right) = 3\sqrt{3}+4\ \text{m/km}. $$

Since \(\sqrt{3}\) is approximately \(1.732\), this is approximately \(9.196\) m/km. Rounded to two decimal places, the rate is \(9.20\) m/km. It is positive, so elevation is increasing on that heading. The result is slightly below the maximum of \(10\) m/km, as expected because the \(060^\circ\) bearing is not exactly the gradient direction. The dot product with the opposite gradient direction gives \(-10\), confirming the steepest descent rate.

Headings with Zero Instantaneous Change

A heading has zero instantaneous change exactly when it is perpendicular to the gradient, because the dot product of perpendicular vectors is zero. In two dimensions, if the gradient is nonzero, there are two opposite unit headings perpendicular to it. These directions are tangent to the local level curve of the field. Zero instantaneous change is a local statement: it does not say that the field remains constant over an entire route.

Worked Example: Finding Temperature-Neutral Headings

Worked Example: Finding Temperature-Neutral Headings

At a location, suppose \(\nabla T=(3,4)\) °C/km. Find both unit headings along which the instantaneous temperature change is zero.

Let the heading be \(\mathbf{u}=(u_1,u_2)\). It must be a unit vector and perpendicular to the gradient, so it must satisfy

$$ 3u_1+4u_2=0 \qquad\text{and}\qquad u_1^2+u_2^2=1. $$

A vector perpendicular to \((3,4)\) is \((-4,3)\), since \(3(-4)+4(3)=-12+12=0\). Its magnitude is \(\sqrt{(-4)^2+3^2}=\sqrt{16+9}=5\), so one unit heading is \((-4/5,3/5)\). The opposite heading is \((4/5,-3/5)\).

Check the first heading:

$$ 3\left(-\frac{4}{5}\right)+4\left(\frac{3}{5}\right) = -\frac{12}{5}+\frac{12}{5} = 0, \qquad \left(-\frac{4}{5}\right)^2+\left(\frac{3}{5}\right)^2 = \frac{16}{25}+\frac{9}{25} = 1. $$

For the opposite heading, the dot product is \(3(4/5)+4(-3/5)=12/5-12/5=0\), and its squared length is \(16/25+9/25=1\). Both are valid unit headings with zero instantaneous temperature change.

A Common Pitfall: Forgetting to Normalize

A direction vector can point the right way but still fail to represent a unit heading. For example, using \((3,4)\) directly with the gradient \((3,4)\) gives the dot product \(3(3)+4(4)=25\). That is not the rate per unit distance: the vector \((3,4)\) has length \(5\), so this calculation scales the rate by \(5\).

Normalize the vector first: \((3,4)/5=(3/5,4/5)\). The correct rate is then

$$ (3,4)\cdot\left(\frac{3}{5},\frac{4}{5}\right) = \frac{9}{5}+\frac{16}{5} = 5. $$

This agrees with the gradient magnitude, \(\sqrt{3^2+4^2}=5\), because the normalized heading points in the direction of steepest increase. Always check the length of a heading vector before interpreting its dot product as a rate per unit distance.

Using Rates Responsibly

Gradient data describe change at a particular point, not necessarily over a long journey. A rate of \(2\) °C/km means that temperature initially changes by about \(2\) °C for each kilometre travelled in that direction near the point. If the heading or the gradient changes farther along the route, the same rate need not continue to apply.

In practical comparisons, retain the units and the sign. A positive elevation rate indicates uphill travel; a negative one indicates downhill travel. A positive temperature rate indicates warming along the heading, and a negative one indicates cooling. When comparing headings for fastest increase or decrease, compare the rates themselves, not just the east or north components separately.

Check Your Understanding

Use east–north components for headings. Unless stated otherwise, interpret each rate as instantaneous change per unit distance.

  1. A temperature gradient is \((4,-2)\) °C/km. What is the temperature rate when travelling west?
  2. An elevation gradient is \((5,12)\) m/km. Find its magnitude and the unit heading of steepest ascent.
  3. What is the elevation rate for the gradient \((5,12)\) m/km along the opposite of its steepest-ascent heading?
  4. For the gradient \((2,5)\), give a nonzero direction vector perpendicular to it, then normalize that vector.
  5. Why must a heading vector be a unit vector when its dot product with the gradient is interpreted as a rate per unit distance?