Case Study 2 — Reading the Mountain: Steepest Ascent and Terrain Analysis

Field: Geography / GIS and search-and-rescue. The gradient as a literal compass needle on a hillside — slope, aspect, and the fastest way up (or the way water runs down).

The Problem

Rosa is a GIS analyst supporting a mountain search-and-rescue team. A hiker is overdue near a ridge, and the team needs two things fast: the steepest safe route to a vantage point on the summit, and a prediction of where rainwater (and a disoriented hiker following the easiest downhill path) would drain off the slope. Both questions, Rosa knows, are gradient questions. The elevation model of the terrain, fit from the digital elevation model (DEM) over the search area, is approximated near the trailhead by

$$h(x, y) = 100 - x^2 - 2y^2 + xy \quad\text{(meters of elevation)},$$

where $x$ and $y$ are easting and northing in hundreds of meters from a reference benchmark, valid in the patch she cares about. This is exactly the "landscape" picture of §30.4: $h(x,y)$ is the height of the hill above the map point $(x, y)$, and its level curves are the contour lines on the topographic map.

The Gradient Is the Slope Map

Rosa's first move is the chapter's central computation: the gradient.

$$\nabla h = \left\langle \frac{\partial h}{\partial x},\ \frac{\partial h}{\partial y}\right\rangle = \langle -2x + y,\ -4y + x\rangle.$$

By the three superpowers of §30.4, this single vector field answers everything. At any map point, $\nabla h$ points in the direction of steepest ascent, its magnitude $\|\nabla h\|$ is the slope (rate of climb per unit horizontal distance), and $-\nabla h$ is the direction water runs downhill, always crossing the contour lines at right angles (Superpower 2). GIS software builds slope maps from $\|\nabla h\|$ and aspect maps from the compass direction of $\nabla h$ — precisely the Real-World Application called out in §30.4.

The rescue team's current position is the trailhead at $(x, y) = (1, 1)$ (one hundred meters east and north of the benchmark). Rosa evaluates:

$$\nabla h(1, 1) = \langle -2(1) + 1,\ -4(1) + 1\rangle = \langle -1,\ -3\rangle.$$

Which Way Is Up, and How Steep?

Steepest ascent (Superpower 1). The fastest way up from $(1,1)$ is along $\nabla h(1,1) = \langle -1, -3\rangle$ — that is, toward the southwest on the map (decreasing $x$, decreasing $y$). The maximum rate of climb is

$$\|\nabla h(1,1)\| = \sqrt{(-1)^2 + (-3)^2} = \sqrt{10} \approx 3.16.$$

So at the trailhead the mountain rises about $3.16$ meters of elevation per $100$ meters walked in the steepest direction — roughly a $3\%$ grade in these units (Rosa would rescale to true meters before quoting a grade to the team, but the direction is exact). As a unit heading the rescuers can follow with a compass:

$$\mathbf{u}_{\text{up}} = \frac{1}{\sqrt{10}}\langle -1, -3\rangle \approx \langle -0.316,\ -0.949\rangle.$$

The slope in the route they actually want. The team cannot always go straight up; a safe traverse heads due north, $\mathbf{u} = \langle 0, 1\rangle$. How steep is that? The directional-derivative formula $D_{\mathbf u}h = \nabla h\cdot\mathbf u$ (§30.5) answers instantly, no new limit required:

$$D_{\langle 0,1\rangle} h(1,1) = \langle -1, -3\rangle\cdot\langle 0, 1\rangle = -3.$$

Heading due north, elevation drops at $3$ m per $100$ m — they would be descending, not climbing. Rosa flags it: the planner's "obvious" northward traverse goes the wrong way. One dot product caught a routing error.

Had Rosa instead been handed the raw direction "northeast, $\langle 1, 1\rangle$," she would normalize first ($\|\langle1,1\rangle\| = \sqrt2$, $\mathbf u = \tfrac1{\sqrt2}\langle1,1\rangle$) and compute $D_{\mathbf u}h = \tfrac1{\sqrt2}(-1 - 3) = -\tfrac{4}{\sqrt2} = -2\sqrt2 \approx -2.83$. The §30.5 Common Pitfall — using an un-normalized direction — would have silently inflated this by a factor of $\sqrt2$.

Where the Water (and a Lost Hiker) Goes

A disoriented hiker, or a sheet of rain, follows the path of steepest descent: direction $-\nabla h$ at every point. At the trailhead that is

$$-\nabla h(1, 1) = \langle 1,\ 3\rangle,$$

heading northeast and steeply (the search team should look downhill to the northeast for someone who wandered off following the easiest descent). Rosa traces this drainage path by stepping in $-\nabla h$ repeatedly — the steepest-descent iteration of §30.8, here modeling physical runoff instead of optimization. Starting at $(1, 1)$ with a small step $\eta = 0.1$:

$$\mathbf{p}_1 = (1, 1) + 0.1\langle 1, 3\rangle = (1.1,\ 1.3).$$

Recompute the gradient at the new point: $\nabla h(1.1, 1.3) = \langle -2(1.1) + 1.3,\ -4(1.3) + 1.1\rangle = \langle -0.9,\ -4.1\rangle$, so $-\nabla h = \langle 0.9, 4.1\rangle$ and

$$\mathbf{p}_2 = (1.1, 1.3) + 0.1\langle 0.9, 4.1\rangle = (1.19,\ 1.71).$$

The path curves as it descends, always perpendicular to the local contour line — a literal drainage trace. Hydrologists call the accumulation of these paths a flow network; avalanche forecasters flag stretches where $\|\nabla h\|$ exceeds a critical slope. Every one of those products is the gradient field of this chapter, evaluated across millions of DEM cells.

The Contour Picture, Made Precise

Rosa double-checks her intuition against Superpower 2. A direction of zero elevation change at $(1,1)$ — a direction that walks along the contour line, neither up nor down — must be perpendicular to $\nabla h = \langle -1, -3\rangle$. Any vector $\mathbf u$ with $\nabla h\cdot\mathbf u = 0$ works; take $\mathbf u = \tfrac{1}{\sqrt{10}}\langle -3, 1\rangle$ (since $\langle -1,-3\rangle\cdot\langle -3,1\rangle = 3 - 3 = 0$). Walking that heading, the hiker stays at the same elevation — a contour-following traverse, the gentlest possible route, exactly the kind a well-engineered switchback trail uses. The gradient and the contour are perpendicular, just as the topographic map shows them.

She confirms the whole field numerically with the chapter's tooling:

# Slope (|∇h|) and aspect (direction of ∇h) at the trailhead
import numpy as np

def grad_h(x, y):
    return np.array([-2*x + y, -4*y + x])      # ∇h = <-2x+y, -4y+x>

g = grad_h(1.0, 1.0)
slope = np.linalg.norm(g)                        # steepest rate of climb
aspect_deg = np.degrees(np.arctan2(g[1], g[0]))  # compass-style direction of ∇h
print("∇h =", g)                 # -> [-1. -3.]
print("slope |∇h| =", round(slope, 3))   # -> 3.162  (= sqrt(10))
print("uphill aspect (deg) =", round(aspect_deg, 1))  # -> -108.4

(The printed values match the hand computation: $\nabla h = \langle -1, -3\rangle$, $\|\nabla h\| = \sqrt{10} \approx 3.162$.) Rosa never needed to run the code to brief the team — she had the direction and the slope from one gradient by hand — but the same three lines, vectorized over the full DEM, produce the slope and aspect rasters the whole operation depends on.

The Resolution

Rosa delivers two map layers within the hour. The slope/aspect layer ($\|\nabla h\|$ and the direction of $\nabla h$) tells the climbing team the steepest safe ascent heads southwest and flags the planner's northward traverse as a descent. The drainage layer ($-\nabla h$ flow traces) tells ground searchers to concentrate northeast and downslope, where water — and an exhausted hiker taking the path of least resistance — naturally collects. The hiker is found in the predicted drainage. None of it required a single new idea beyond this chapter: the gradient points uphill, its magnitude is the slope, its negative is the way water runs, and it always crosses the contours at a right angle.

Discussion Questions

  1. Steepest vs. safe. The steepest-ascent direction is rarely the route rescuers take. Using $D_{\mathbf u}h = \|\nabla h\|\cos\theta$ (§30.5), explain quantitatively how much climb-rate is sacrificed by traversing at $60°$ to the gradient instead of straight up. (Compute $\cos 60°$ times the max rate.)
  2. Aspect and avalanches. Avalanche risk depends on both slope magnitude and which compass direction the slope faces (sun exposure). Which superpower gives the magnitude, and which quantity (a function of $\nabla h$'s components) gives the facing direction?
  3. Conditioning of terrain. The coefficient on $y^2$ is twice that on $x^2$, so the hill is steeper north–south than east–west. Relate this anisotropy to the "narrow valley" / poor-conditioning discussion of §30.8 — and to why a single step size behaves differently along the two axes.
  4. From runoff to optimization. The drainage trace and gradient descent (Case Study 1) are the same iteration $\mathbf p_{k+1} = \mathbf p_k - \eta\nabla(\cdot)$. State precisely what plays the role of the "loss function" here, and what plays the role of "the minimum."

A Short Annotated Reading

  • Stewart, Calculus: Early Transcendentals (9th ed.), §14.6. The gradient, directional derivatives, and the "maximum rate of change is $\|\nabla f\|$" result that underlies Rosa's slope map; worked hill-climbing examples.
  • OpenStax, Calculus Volume 3, §4.6 (directional derivatives and the gradient). Free; its temperature/terrain examples parallel this case study closely, including the perpendicularity to level curves.
  • Burrough, McDonnell & Lloyd, Principles of Geographical Information Systems (3rd ed.), ch. on terrain analysis. How DEMs are differentiated to produce slope and aspect rasters — the applied face of $\nabla h$.
  • Stewart §14.4 (tangent planes & linear approximation). Connects to how a smooth surface is fit to discrete DEM cells before the gradient is taken.