BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

The gradient and directional derivatives

The gradient ∇w = ⟨w_x, w_y, w_z⟩ packages the partial derivatives into a vector at each point, and the chain rule becomes dw/dt = ∇w · dr/dt. The gradient is perpendicular to the level curves and level surfaces, which gives tangent planes to surfaces like x² + y² − z² = 4. The directional derivative in the direction of a unit vector û is dw/ds = ∇w · û = |∇w| cos θ: largest along ∇w, the direction of fastest increase, with value |∇w|, and zero along the level.

You need this first

Full reading path (11 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. Parametric equations of lines and the cycloid (18.02)
  7. Velocity, acceleration and Kepler's second law (18.02)
  8. Functions of two variables and partial derivatives (18.02)
  9. Tangent planes, critical points and least squares (18.02)
  10. The second derivative test (18.02)
  11. Differentials and the chain rule (18.02)
On this page · 6 sections
  1. The gradient vector
  2. Perpendicular to the level surfaces
  3. Tangent planes to surfaces
  4. Directional derivatives
  5. The direction of fastest increase
  6. Summary

The chain rule can be written more compactly with a new vector, the gradient. This lecture explains what the gradient means and what it is good for (transcript, p. 1).

The gradient vector#

For w=w(x,y,z)w = w(x, y, z) with xx, yy, zz depending on tt, the chain rule says dw/dt=wx dx/dt+wy dy/dt+wz dz/dtdw/dt = w_x\,dx/dt + w_y\,dy/dt + w_z\,dz/dt. That is a dot product (transcript, p. 1; notes, p. 1):

The chain rule with the gradient
dwdt=∇w⋅dr⃗dt,∇w=⟨wx,wy,wz⟩\frac{dw}{dt} = \nabla w \cdot \frac{d\vec r}{dt}, \qquad \nabla w = \langle w_x, w_y, w_z\rangle
In words

d w over d t equals del w times d vector r over d t, del w equals the average of w sub x, w sub y, w sub z

Source: 18.02 lecture summaries, Week 5 (Prof. Auroux), Lecture 12, pp. 1–2, Lecture 12, p. 1

The gradient ∇w\nabla w is the vector of the partial derivatives. It depends on the point (x,y,z)(x, y, z): one vector at each point, what will later be called a vector field (p. 1; notes, p. 2). It holds the same information as the partial derivatives or the differential; so far it is notation (p. 1).

Perpendicular to the level surfaces#

The first property (transcript, p. 1; notes, p. 1):

Gradient and level surfaces
∇w⊥{ w=c }\nabla w \perp \{\,w = c\,\}
In words

del w perpendicular w equals c

For a function of two variables, ∇w\nabla w is perpendicular to the level curves of its contour plot; for three variables, to the level surfaces (p. 1). It points towards higher values of ww, which comes out of the directional derivative below (p. 1).

Examples (p. 1; notes, p. 1):

  • w=a1x+a2y+a3zw = a_1x + a_2y + a_3z: ∇w=⟨a1,a2,a3⟩\nabla w = \langle a_1, a_2, a_3\rangle, and the level w=cw = c is a plane with exactly this normal vector. In a sense this is the general case, since linear approximation replaces level surfaces by their tangent planes.
  • w=x2+y2w = x^2 + y^2: the levels are circles, and ∇w=⟨2x,2y⟩\nabla w = \langle 2x, 2y\rangle is twice the position vector, pointing radially out, perpendicular to the circles.
  • w=x2−y2w = x^2 - y^2, shown on an applet: the gradient, moved around the contour plot, stays perpendicular to the level curves.

Proof. Take a curve r⃗(t)\vec r(t) that stays on the level surface w=cw = c. Its velocity v⃗=dr⃗/dt\vec v = d\vec r/dt is tangent to the curve, hence to the surface. By the chain rule (pp. 1–2; notes, p. 2):

Moving along a level
dwdt=∇w⋅v⃗=0\frac{dw}{dt} = \nabla w \cdot \vec v = 0
In words

d w over d t equals del w dot vector v equals 0

because ww stays equal to cc. So ∇w⊥v⃗\nabla w \perp \vec v. And any vector tangent to the surface is the velocity of some curve on it, so ∇w\nabla w is perpendicular to the whole tangent plane (p. 2; notes, p. 2).

Tangent planes to surfaces#

So the gradient gives a normal vector to any surface given by an equation (transcript, p. 2; notes, p. 2). The lecture's example is the hyperboloid x2+y2−z2=4x^2 + y^2 - z^2 = 4 at (2,1,1)(2, 1, 1): the level w=4w = 4 of w=x2+y2−z2w = x^2 + y^2 - z^2. Then ∇w=⟨2x,2y,−2z⟩=⟨4,2,−2⟩\nabla w = \langle 2x, 2y, -2z\rangle = \langle 4, 2, -2\rangle, and the tangent plane is 4x+2y−2z=8+2−24x + 2y - 2z = 8 + 2 - 2 (p. 2; notes, p. 2):

Tangent plane to the hyperboloid
4x+2y−2z=84x + 2y - 2z = 8
In words

4 x plus 2 y minus 2 z equals 8

(Solving for zz and using the linear approximation would also work here, but not in general; notes, p. 2.) Another way: dw=2x dx+2y dy−2z dz=4 dx+2 dy−2 dzdw = 2x\,dx + 2y\,dy - 2z\,dz = 4\,dx + 2\,dy - 2\,dz at the point, so Δw≈4Δx+2Δy−2Δz\Delta w \approx 4\Delta x + 2\Delta y - 2\Delta z. Staying on the level means Δw=0\Delta w = 0; setting the linear approximation exactly to zero gives the tangent plane, 4(x−2)+2(y−1)−2(z−1)=04(x - 2) + 2(y - 1) - 2(z - 1) = 0, the same plane (pp. 2–3; notes, p. 2).

Directional derivatives#

wxw_x and wyw_y are rates of change along i^\hat i and j^\hat j. What about any other direction, given by a unit vector u^=⟨a,b⟩\hat u = \langle a, b\rangle? Move along the straight line x(s)=x0+asx(s) = x_0 + as, y(s)=y0+bsy(s) = y_0 + bs at unit speed, so that ss is the distance travelled (transcript, p. 3; notes, p. 2). The directional derivative is the rate of change of ww along it, written (dw/ds)u^(dw/ds)_{\hat u}. (The lecture writes dw/dsdw/ds with a vertical bar and the subscript u^\hat u; it means the same.) Geometrically, it is the slope of the slice of the graph by the vertical plane in the direction u^\hat u, no longer parallel to the xx or yy axis (p. 3; notes, p. 2). By the chain rule, with dr⃗/ds=u^d\vec r/ds = \hat u (p. 3; notes, p. 2):

Directional derivative
(dwds)u^=∇w⋅dr⃗ds=∇w⋅u^\left(\frac{dw}{ds}\right)_{\hat u} = \nabla w \cdot \frac{d\vec r}{ds} = \nabla w \cdot \hat u
In words

( d w over d s ) sub u hat equals del w times d vector r over d s equals del w times u hat

It is the component of the gradient in the direction u^\hat u; for u^=i^\hat u = \hat i it is wxw_x, as it should be (p. 3).

The direction of fastest increase#

Since ∣u^∣=1|\hat u| = 1 (transcript, pp. 3–4; notes, p. 2):

Directional derivative and angle
(dwds)u^=∣∇w∣ cos⁡θ\left(\frac{dw}{ds}\right)_{\hat u} = |\nabla w|\,\cos\theta
In words

( d w over d s ) sub u hat equals the absolute value of del w cos theta

with θ\theta the angle between ∇w\nabla w and u^\hat u. At a given point (p. 4; notes, p. 2):

  • it is largest when cos⁡θ=1\cos\theta = 1, that is u^\hat u along ∇w\nabla w: the gradient points in the direction of fastest increase, and its length ∣∇w∣|\nabla w| is the rate of increase in that direction;
  • it is smallest when θ=180°\theta = 180°, opposite to the gradient, the fastest decrease: facing up a mountain, the steepest way down is behind you;
  • it is zero when θ=90°\theta = 90°, perpendicular to the gradient: that is the direction tangent to the level, where ww does not change.

On a contour plot, then, the gradient at a point is perpendicular to the level curve and points towards the higher levels (p. 4).

Worked example

Gradient, tangent line and directional derivative

Let w=x2+2y2w = x^2 + 2y^2 and the point (1,1)(1, 1). (a) Find ∇w\nabla w and the tangent line to the level curve through the point. (b) Find the directional derivative in the direction u^=⟨3/5,4/5⟩\hat u = \langle 3/5, 4/5\rangle. (c) What is the largest rate of increase, and in which directions is the rate zero?

(a) Gradient and tangent line

∇w=⟨2x,4y⟩=⟨2,4⟩\nabla w = \langle 2x, 4y\rangle = \langle 2, 4\rangle. The level curve is x2+2y2=3x^2 + 2y^2 = 3, an ellipse, and its tangent line has normal ⟨2,4⟩\langle 2, 4\rangle: 2x+4y=2+4=62x + 4y = 2 + 4 = 6, or x+2y=3x + 2y = 3.

(b) A directional derivative

u^\hat u is a unit vector, since (3/5)2+(4/5)2=1(3/5)^2 + (4/5)^2 = 1. Then dw/ds=⟨2,4⟩⋅⟨3/5,4/5⟩=6/5+16/5=22/5=4.4dw/ds = \langle 2, 4\rangle \cdot \langle 3/5, 4/5\rangle = 6/5 + 16/5 = 22/5 = 4.4.

(c) Fastest increase and the level directions

The largest rate is ∣∇w∣=4+16=20≈4.47|\nabla w| = \sqrt{4 + 16} = \sqrt{20} \approx 4.47, along ⟨2,4⟩/20\langle 2, 4\rangle/\sqrt{20}; part (b), at an angle with cos⁡θ=4.4/4.47≈0.98\cos\theta = 4.4/4.47 \approx 0.98, is close to it. The rate is zero along ±⟨2,−1⟩/5\pm\langle 2, -1\rangle/\sqrt 5, perpendicular to the gradient and along the tangent line x+2y=3x + 2y = 3.

Summary#

  • The gradient ∇w=⟨wx,wy,wz⟩\nabla w = \langle w_x, w_y, w_z\rangle is a vector at each point; the chain rule is dw/dt=∇w⋅dr⃗/dtdw/dt = \nabla w \cdot d\vec r/dt.
  • ∇w\nabla w is perpendicular to the level curves or surfaces w=cw = c; this gives tangent planes, such as 4x+2y−2z=84x + 2y - 2z = 8 for x2+y2−z2=4x^2 + y^2 - z^2 = 4 at (2,1,1)(2, 1, 1).
  • The directional derivative along a unit vector u^\hat u is dw/ds=∇w⋅u^=∣∇w∣cos⁡θdw/ds = \nabla w \cdot \hat u = |\nabla w|\cos\theta.
  • ∇w\nabla w points in the direction of fastest increase, with rate ∣∇w∣|\nabla w|; −∇w-\nabla w is the fastest decrease; along the level the rate is zero.

Symbols on this page

Show the 35 symbols used here
Δ\Delta capital delta.
A change or difference in a quantity, e.g. Δx = x₂ − x₁. Say it: “capital delta”.
θ\theta theta.
An angle. Say it: “theta” (sounds like “thay-ta or thee-ta”).
ϕ\phi phi.
In the cosmology note, the Newtonian gravitational potential. Unit: J/kg. Say it: “phi” (sounds like “fye”).
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
±\pm plus or minus.
Plus or minus: both signs, or an uncertainty (67.3 ± 1.2). Say it: “plus or minus”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
⟨\langle angle brackets.
The average (mean value) of what is inside, ⟨…⟩. Say it: “the average of”.
∇\nabla nabla (del).
Del: ∇f is the gradient, ∇·v the divergence, ∇×v the curl, ∇² the Laplacian. Say it: “del”.
cos⁡\cos cosine.
Cosine of an angle. Say it: “cos”.
v⃗\vec v vector arrow.
A vector: a quantity with a size and a direction. Say it: “vector”.
ı^\hat\imath hat.
A unit vector: a vector of length 1 that only gives a direction (î, r̂). Say it: “hat”.
aa a.
The first component of the unit vector û = ⟨a, b⟩. Say it: “a”.
zz z.
The z coordinate. Say it: “z”.
cc c.
A constant value of w: the level of a level curve or surface w = c. Say it: “c”.
⊥\perp perpendicular.
Is perpendicular to. Say it: “perpendicular”.
xx x.
The x coordinate. Say it: “x”.
yy y.
The y coordinate. Say it: “y”.
tt t.
A parameter (time) along a curve. Say it: “t”.
dd d.
The d of a derivative, as in dw/dt or dw/ds. Say it: “d”.
vv v.
The velocity vector dr/dt of a curve on a level surface. Say it: “v”.
rr r.
The position vector ⟨x, y, z⟩ of a moving point. Say it: “r”.
bb b.
The second component of the unit vector û = ⟨a, b⟩. Say it: “b”.
ss s.
Distance travelled along a straight line at unit speed. Say it: “s”.
x0x_{0} x nought.
The x coordinate of the starting point. Say it: “x nought”.
y0y_{0} y nought.
The y coordinate of the starting point. Say it: “y nought”.
a1a_{1} a one.
The coefficient of x in the linear function w = a₁x + a₂y + a₃z. Say it: “a one”.
a2a_{2} a two.
The coefficient of y in the linear function. Say it: “a two”.
uu u.
With a hat, û: a unit vector giving the direction of the directional derivative. Say it: “u”.
ww w.
A function of several variables, w(x, y, z) or w(x, y). Say it: “w”.
a3a_{3} a 3.
The coefficient of z in the linear function. Say it: “a three”.
i^\hat{i} i hat.
Unit vector in the x direction: length 1, pointing towards increasing x. Say it: “i hat”.
j^\hat{j} j hat.
Unit vector in the y direction: length 1, pointing towards increasing y. Say it: “j hat”.
wxw_{x} w sub x.
The partial derivative ∂w/∂x, the first component of ∇w. Say it: “w sub x”.
wyw_{y} w sub y.
The partial derivative ∂w/∂y, the second component of ∇w. Say it: “w sub y”.
wzw_{z} w sub z.
The partial derivative ∂w/∂z, the third component of ∇w. Say it: “w sub z”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 33 words used here

New here

directional derivative.
The rate at which a function changes as one moves from a point in a chosen direction, per unit distance travelled.

Also used

chain rule.
The rule for the derivative of a function of a function: multiply the derivative of the outer one by that of the inner one. Explained in Circular motion: polar coordinates, position and velocity.
vector.
A quantity with both a size and a direction, such as a velocity or a force, drawn as an arrow. Explained in Vectors.
gradient.
The vector of a function's partial derivatives; it points the way the function increases fastest, and its length is that fastest rate. Explained in Graphs, straight lines and slope.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
dot product.
A way of multiplying two vectors that gives a number: multiply matching components and add, or lengths times the cosine of the angle between them. Explained in Vectors and the dot product.
partial derivative.
The rate of change of a function of several variables with respect to one of them, while all the others are held fixed. Explained in Functions of two variables and partial derivatives.
vector field.
A rule that attaches an arrow, with a size and a direction, to every point of space, such as the wind velocity at each place. Explained in Fields: scalar, vector, gravitational and electric.
differential.
A tiny change in a variable, such as dx, or the matching change in a function along its tangent line, dy = f′(x) dx. Explained in Differentials and antiderivatives.
perpendicular.
At right angles to a line, a surface or another direction. Explained in Inclined planes.
level curve.
A curve along which a function of two variables keeps the same value, like a line of equal height on a map. Explained in Functions of two variables and partial derivatives.
contour map.
A flat map of a function of two variables, drawing the curves along which it keeps one value, like height lines on a hiking map. Explained in Fields: scalar, vector, gravitational and electric.
normal vector.
A vector at right angles to a plane or surface; it fixes which way the plane faces. Explained in Planes through three points, and matrices.
linear approximation.
Replacing a function near a point by the straight line, or flat plane, that best matches it there, using its first derivatives. Explained in Change of variables in double integrals.
tangent plane.
The flat plane that just touches a surface at a point and tilts the same way as the surface there. Explained in Tangent planes, critical points and least squares.
position vector.
The arrow from the origin of a coordinate system to a point, which says where the point is. Explained in Position and velocity in one dimension.
proof.
A chain of reasoning showing beyond doubt that a statement follows from definitions and results already known. Explained in Limits and continuity.
velocity.
How fast and in which direction something moves: a vector whose length is the speed and whose direction is the direction of motion. Explained in Velocity, acceleration and Kepler's second law.
tangent.
A straight line that touches a curve at a point and runs in the same direction as the curve there. Explained in Angles, radians and trigonometry.
rate of change.
How fast one quantity changes compared with another, often time: the change in the first divided by the change in the second. Explained in Rates of change and area under a graph.
unit vector.
A vector of length one, used only to point in a direction. Explained in Newton's law of gravitation.
graph.
The picture of a function: the curve y = f(x) for one variable, or the surface z = f(x, y) for two. Explained in Graphs, straight lines and slope.
ellipse.
An oval curve: the set of points whose distances from two fixed points, the foci, add up to the same total. Explained in Kepler's laws and orbits.
potential.
A function whose gradient is a given vector field; the field is then a gradient field. Explained in Gradient fields and path independence.
acceleration.
How fast velocity changes: the change in velocity in each unit of time. Explained in Rates of change and area under a graph.
density.
How much of something (mass, charge, energy, particles or probability) there is in each unit of volume, area, length or other variable. Explained in Density and pressure.
galaxy.
A huge system of stars, gas and dust, from thousands to over a trillion stars, held together by gravity inside a dark matter halo. Explained in Towards the universe: weighing the Sun and the Galaxy with orbits.
linear perturbation theory.
Following small departures from a smooth state by keeping only terms in the equations that are proportional to the departures, not their squares. Explained in How small ripples grow: linear perturbation theory.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
notation.
A system of symbols used to write ideas down briefly, such as dy/dx for a derivative.
in a sense.
Partly, or when looked at in one particular way; not in every respect.
hence.
For this reason; as a result of what was just said.
theory.
An organised body of ideas, laws and methods about a subject: a tested explanation of nature, or a branch or method of mathematics.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

33 more cosmology pages that build on this

Pages that build on this

Practise

Check your understanding

  1. The gradient of w=x2y+zw = x^2 y + z at (1,2,0)(1, 2, 0) is…
  2. At a point, ∇w=⟨3,4⟩\nabla w = \langle 3, 4\rangle. The largest directional derivative there is…
  3. In which direction is the directional derivative zero?
  4. A normal vector to the surface x2+y2+z2=9x^2 + y^2 + z^2 = 9 at (1,2,2)(1, 2, 2) is…
0 of 4 answered

Flashcards

1 / 3