The Gradient

The Definition of the Gradient

Gradient

Suppose the function z=f(x,y)z = f(x, y) has first-order partial derivatives at the point (x,y)(x, y). Then the vector

∇f(x,y)=(∂f∂x,∂f∂y)=fxi⃗+fyj⃗\nabla f(x, y) = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right) = f_x \vec{i} + f_y \vec{j}

is called the gradient of the function f(x,y)f(x, y) at the point (x,y)(x, y), written ∇f\nabla f or grad f\text{grad}\, f.

Here ∇=(∂∂x,∂∂y)\nabla = \left( \frac{\partial}{\partial x}, \frac{\partial}{\partial y} \right) is called the nabla operator (the del operator).

For a function of three variables u=f(x,y,z)u = f(x, y, z), the gradient is:

∇f=(∂f∂x,∂f∂y,∂f∂z)\nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right)

The magnitude of the gradient is:

∣∇f∣=fx2+fy2(two variables),∣∇f∣=fx2+fy2+fz2(three variables)|\nabla f| = \sqrt{f_x^2 + f_y^2} \quad \text{(two variables)}, \quad |\nabla f| = \sqrt{f_x^2 + f_y^2 + f_z^2} \quad \text{(three variables)}

The Relation between the Gradient and the Directional Derivative

Theorem1

Suppose the function ff is differentiable at the point PP, and let l⃗\vec{l} be any unit direction vector. Then the directional derivative can be written as the inner product of the gradient with the direction vector:

∂f∂l=∇f⋅l⃗=∣∇f∣cos⁡θ\frac{\partial f}{\partial l} = \nabla f \cdot \vec{l} = |\nabla f| \cos\theta

where θ\theta is the angle between the gradient ∇f\nabla f and the direction l⃗\vec{l}.

The Geometric Meaning of the Gradient

The geometric interpretation of the gradient
  • For a function of two variables: the gradient ∇f(x0,y0)\nabla f(x_0, y_0) is the normal vector of the level curve f(x,y)=f(x0,y0)f(x,y) = f(x_0,y_0) at the point (x0,y0)(x_0,y_0), pointing in the direction in which the value of the function increases.
  • For a function of three variables: the gradient ∇f(x0,y0,z0)\nabla f(x_0, y_0, z_0) is the normal vector of the level surface f(x,y,z)=f(x0,y0,z0)f(x,y,z) = f(x_0,y_0,z_0) at that point, pointing in the direction in which the value of the function increases.

The Basic Properties of the Gradient

Theorem2
  1. Linearity: ∇(af+bg)=a∇f+b∇g\nabla(af + bg) = a\nabla f + b\nabla g
  2. The product rule: ∇(fg)=f∇g+g∇f\nabla(fg) = f\nabla g + g\nabla f
  3. The quotient rule: ∇(fg)=g∇f−f∇gg2\nabla\left(\frac{f}{g}\right) = \frac{g\nabla f - f\nabla g}{g^2} (g≠0g \neq 0)
  4. Composite functions: ∇F(f)=F′(f)∇f\nabla F(f) = F'(f)\nabla f

Worked Examples

Example 1: Computing the Gradient

Find the gradient of f(x,y)=x2+y2f(x, y) = x^2 + y^2 at the point (1,2)(1, 2), and find the directional derivative along the gradient direction.

the gradientthe directional derivativesteepest ascent

Approach:

The gradient is the vector formed by the partial derivatives; along the gradient direction the function changes fastest, and along the negative gradient direction it falls fastest.

Steps:

  1. ∇f=(2x,2y)\nabla f = (2x, 2y), and at (1,2)(1,2) we have ∇f=(2,4)\nabla f = (2, 4)
  2. The unit vector in the gradient direction: l⃗0=(2,4)4+16=(15,25)\vec{l}^0 = \frac{(2,4)}{\sqrt{4+16}} = (\frac{1}{\sqrt{5}}, \frac{2}{\sqrt{5}})
  3. The directional derivative along the gradient direction = ∣∇f∣=4+16=25|\nabla f| = \sqrt{4+16} = 2\sqrt{5}
  4. Checking: ∂f∂l=2⋅15+4⋅25=105=25\frac{\partial f}{\partial l} = 2\cdot\frac{1}{\sqrt{5}} + 4\cdot\frac{2}{\sqrt{5}} = \frac{10}{\sqrt{5}} = 2\sqrt{5}

Answer: the gradient is (2,4)(2,4), and the directional derivative along the gradient direction is 252\sqrt{5} (the maximum).

Example 2: The Gradient of a Function of Three Variables

Find the magnitude and the direction cosines of the gradient of u=x2+2y2+3z2+xy+3x−2y−6zu = x^2 + 2y^2 + 3z^2 + xy + 3x - 2y - 6z at the point P(1,1,1)P(1,1,1).

the gradienta function of three variablesdirection cosines

Approach:

First compute the three partial derivatives and substitute the given point; the magnitude of the gradient and the direction cosines both follow directly from these partial derivatives.

Steps:

  1. ux=2x+y+3u_x = 2x + y + 3, uy=4y+x−2u_y = 4y + x - 2 and uz=6z−6u_z = 6z - 6
  2. At (1,1,1)(1,1,1): ux=6u_x = 6, uy=3u_y = 3 and uz=0u_z = 0
  3. ∇f=(6,3,0)\nabla f = (6, 3, 0) and ∣∇f∣=36+9=35|\nabla f| = \sqrt{36+9} = 3\sqrt{5}
  4. The direction cosines: cos⁡α=635=25\cos\alpha = \frac{6}{3\sqrt{5}} = \frac{2}{\sqrt{5}}, cos⁡β=335=15\cos\beta = \frac{3}{3\sqrt{5}} = \frac{1}{\sqrt{5}} and cos⁡γ=0\cos\gamma = 0

Answer: the magnitude of the gradient is 353\sqrt{5}, and the direction cosines are (25,15,0)(\frac{2}{\sqrt{5}}, \frac{1}{\sqrt{5}}, 0).

Example 3: The Normal Vector of a Level Curve

Find the gradient of the function f(x,y)=x2a2+y2b2f(x,y) = \frac{x^2}{a^2} + \frac{y^2}{b^2} at the point (a,b)(a, b), and explain its relation to the level curve.

the gradientlevel curvenormal vectoran ellipse

Approach:

The components of the gradient are exactly the two partial derivatives of the implicit equation of the level curve, so the gradient direction is the normal to the level curve.

Steps:

  1. fx=2xa2f_x = \frac{2x}{a^2} and fy=2yb2f_y = \frac{2y}{b^2}
  2. At (a,b)(a,b): ∇f=(2a,2b)\nabla f = (\frac{2}{a}, \frac{2}{b})
  3. The level curve through (a,b)(a,b) is x2a2+y2b2=2\frac{x^2}{a^2}+\frac{y^2}{b^2} = 2 (an ellipse)
  4. The gradient (2a,2b)(\frac{2}{a}, \frac{2}{b}) is the normal vector of that ellipse at (a,b)(a,b), pointing in the direction in which the value of the function increases (outside the ellipse).

Answer: the gradient is (2a,2b)(\frac{2}{a}, \frac{2}{b}), and it is the normal vector of the level curve (the ellipse) at that point.


Exercises

Exercise 1

Find the gradient of f(x,y)=ln⁡(x2+y2)f(x,y) = \ln(x^2 + y^2) at the point (1,1)(1, 1).

the gradientthe logarithmic function

Approach:

Compute the two partial derivatives and substitute the point.

Steps:

  1. fx=2xx2+y2f_x = \frac{2x}{x^2+y^2} and fy=2yx2+y2f_y = \frac{2y}{x^2+y^2}
  2. At (1,1)(1,1): fx=fy=1f_x = f_y = 1
  3. ∇f=(1,1)\nabla f = (1, 1)

Answer: the gradient is (1,1)(1,1)

Exercise 2

Find the direction in which the function u=xy2z3u = xy^2 z^3 changes fastest at the point (1,1,1)(1, 1, 1), and find the greatest rate of change.

the gradientsteepest ascentthe greatest rate of change

Approach:

The direction of fastest change is the direction of the gradient, and the greatest rate of change is the magnitude of the gradient.

Steps:

  1. ux=y2z3u_x = y^2z^3, uy=2xyz3u_y = 2xyz^3 and uz=3xy2z2u_z = 3xy^2z^2
  2. At (1,1,1)(1,1,1): ∇f=(1,2,3)\nabla f = (1, 2, 3)
  3. The direction of fastest change is the gradient direction (1,2,3)(1,2,3)
  4. The greatest rate of change = ∣∇f∣=1+4+9=14|\nabla f| = \sqrt{1+4+9} = \sqrt{14}

Answer: the direction of fastest change is (1,2,3)(1,2,3), and the greatest rate of change is 14\sqrt{14}.


Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
∇f\nabla fGradientgradient of f / nabla fThe gradient of the function ff
grad f\text{grad}\, fGradientgrad fAnother notation for the gradient
∇\nablaNabla operatornabla / delThe differential operator (∂∂x,∂∂y)(\frac{\partial}{\partial x}, \frac{\partial}{\partial y})
∣∇f∣\lvert\nabla f\rvertMagnitude of the gradientmagnitude of gradientThe length of the gradient vector
θ\thetaAnglethetaThe angle between the gradient and the direction vector

Found an issue with this content?

Tell us what could be improved.