The function w(t) which represents the path of the highway is shown in the "Domain" window in red. In the control panel there is a tapedeck that allows you to change the variable t0 and travel along the highway. Two vectors are drawn at the point w(t0): the pink vector is the unit tangent vector to the red curve at w(t0) while the yellow vector is the gradient vector of f(x,y) at w(t0).

The default function f(x,y) produces a graph called "Twin Peaks" which can be seen in the 3D graph window. Under f(x,y), the red curve in the domain is mapped into a red curve on the surface. This "scenic highway" has z(t) = f(w(t)) as its height function. With this in mind, we ask the following question. As we travel along the highway, at what point do we attain our maximum height? The question is simpler in the case of a 2D graph. To find the maximum height of the graph of a function f(t), we would set f'(t) = 0, solve for t, and then check if the solutions were maxima or minima. This method naturally generalizes to 3D graphs as well. To find the maximum point along the highway, we set z'(t) = 0. Then, by the chain rule,

z'(t) = fx(x(t),y(t))x'(t) + fy(x(t),y(t))y'(t),

or

0 = ∇f(x(t),y(t))⋅(x'(t),y'(t))

This tells us that at the highest point w(t0) on the highway, the gradient vector at w(t0) must be perpendicular to the tangent vector at w(t0). Note that if the highway passes through a local maximum of the graph, then the gradient vector will be 0 and will automatically be perpendicular to the tangent vector.