PPLATO | Basic Mathematics | Gradients and directional derivatives (2024)

The base vectors in two dimensional Cartesian coordinates are the unit vector i in the positive direction of the x-axis and the unit vector j in the y direction (see figure bottom left). In three dimensions we also require k, the unit vector in the z direction.

The position vector of a point P (x, y) in two dimensions is xi + yj. We will often denote this important vector by r (see figure bottom right). In three dimensions the position vector is r = xi + yj + zk.

PPLATO | Basic Mathematics | Gradients and directional derivatives (1)

PPLATO | Basic Mathematics | Gradients and directional derivatives (2)

The vector differential operator , called 'del' or 'nabla', is defined in three dimensions to be:

= /∂xi + /∂yj + /∂zk

- note that these are partial derivatives!

This vector operator may be applied to (differentiable) scalar functions (scalar fields) and the result is a special case of a vector field, called a gradient vector field.

Here are two warming up exercises on partial differentiation:

Quiz 1: Select the following partial derivative: /∂z(xyzx):

(a) x2yzx−1 Correct - well done!

(b) 0 Incorrect - please try again!

(c) xy logx(z) Incorrect - please try again!

(d) yzx−1 Incorrect - please try again!

Solution:The partial derivative of xyzx with respect to the variable z is:

/∂z (xyzx) = xy × /∂z (zx) = xy × x × zx−1 = x2yzx−1

Quiz 2: Choose the following partial derivative /∂x(x cos (y) + y):

(a)cos (y) Correct - well done!

(b)cos (y) − x sin (y) + 1 Incorrect - please try again!

(c) cos (y) + x sin (y) + 1 Incorrect - please try again!

(d)−sin (y)

Solution: Consider the function ƒ (x,y) = x cos (y) + y. Its derivative with respect to the variable x is:

/∂xƒ (x,y) = /∂x cos (y) + y
= /∂x (x) × cos (y) + /∂xy
= 1×cos (y) + 0=cos (y)

The gradient of a function, ƒ (x,y), in two dimensions is defined as:

grad ƒ (x,y) = ƒ (x,y) = ∂ƒ/∂x i + ∂ƒ/∂y j

The gradient of a function is a vector field. It is obtained by applying the vector operator to the scalar function ƒ (x,y). Such a vector field is called a gradient (or conservative) vector field.

Example 1: The gradient of the function ƒ (x,y) = x + y2 is given by:

ƒ (x,y) = ∂ƒ/∂x i + ∂ƒ/∂y j
= /∂x (x + y2)i + /∂y (x + y2)j
= (1 + 0)i + (0 + 2y)j
= i + 2yj

Quiz 3: Choose the gradient of ƒ (x,y) = x2y3:

(a) 2xi + 3y2j Incorrect - please try again!

(b) x2i + y3j Incorrect - please try again!

(c) 2xy3i + 3x2y2j Correct - well done!

(d) y3i + x2j

Solution: The gradient of the function ƒ (x,y) =x2y3 is given by:

ƒ (x,y) = ∂ƒ/∂x i + ∂ƒ/∂y j
= /∂x (x2y3)i + /∂y (x2y3)j
= /∂x (x2) × y3i + x2 × /∂y (y3)j
= 2x2−1 × y3i + 3x2 × y3−1j
= 2xy3i + 3x2y2j

The definition of the gradient may be extended to functions defined in three dimensions ƒ (x,y,z):

ƒ (x,y,z) = ∂ƒ/∂x i + ∂ƒ/∂y j + ∂ƒ/∂z k

Exercise 1: Calculate the gradient of the following functions:

(a)ƒ (x,y) = x + 3y2

Solution: The function ƒ (x,y) = x + 3y2 has gradient:

ƒ (x,y) = ∂ƒ/∂x i + ∂ƒ/∂y j
= /∂x (x + 3y2)i + /∂y (x + 3y2)j
= (1 + 0)i + (0 + 3 × 2y2−1)j
= i + 6yj

(b)ƒ (x,y) = x2 + y2

Solution: The gradient of the function ƒ (x,y) = x2 + y2 = (x2 + y2)½ is given by:

ƒ (x,y) = ∂ƒ/∂x i + ∂ƒ/∂y j = /∂x (x2 + y2)½i + /∂y (x2 + y2)½j
= 1/2 (x2 + y2)½−1 × /∂x (x2)i + 1/2 (x2 + y2)½−1 × /∂y (y2)j
= 1/2 (x2 + y2)−½ × 2x2−1i + 1/2 (x2 + y2)−½ × 2y2−1j
= (x2 + y2)−½ xi + (x2 + y2)−½ yj
= x/ x2 + y2i + y/ x2 + y2j

(c) ƒ (x,y,z) = 3x2y + cos (3z)

Solution: The gradient of the function ƒ (x,y,z) = 3x2y + cos (3z) = 3x2y½ + cos (3z) is given by:

ƒ (x,y,z) = ∂ƒ/∂xi + ∂ƒ/∂yj + ∂ƒ/∂z k
= 3y½/∂x (x2)i + 3x2/∂y (y½)j + /∂y (cos (3z))k
= 3y½ × 2x2−1i + 3x2 × 1/2y½−1 j − 3 sin (3z)k
= 6y½xi + 3/2x2y−½ j − 3 sin (3z)k
= 6xyi + 3/2 x2/ yj − 3 sin (3z)k

(d) ƒ (x,y,z) =1/ x2 + y2 + z2

Solution: The partial derivative of the function ƒ (x,y,z) = 1/ x2 + y2 + z2 = (x2 + y2 + z2)½ with respect to the variable x is:

∂ƒ/∂x = − (x2 + y2 + z2)½−1 × (x2)/∂x = − x/ (x2 + y2 + z2)3 ⁄ 2

Similarly, the derivatives ∂ƒ/∂y and ∂ƒ/∂z are:

∂ƒ/∂y = y/ (x2 + y2 + z2)3 ⁄ 2 and z/ (x2 + y2 + z2)3 ⁄ 2 respectively.

Therefore the gradient is:

ƒ (x,y,z) = − xi + yj + zk / (x2 + y2 + z2)3 ⁄ 2

(e) ƒ (x,y) 4y/ (x2 + 1)

Solution: The gradient of the function ƒ (x,y) 4y/ (x2 + 1) = 4y(x2 + 1)−1 is:

ƒ (x,y) = 4y × /∂x (x2 + 1)−1i + (x2 + 1)−1 × /∂y 4yj
= 4y × (−1)(x2 + 1)−1−1 /∂x (x2 + 1)2i + 4(x2 + 1)−1j
= −4y(x2 + 1)−2 × 2xi + 4(x2 + 1)−1j
= 8xy/ (x2 + 1)2i + 4/ (x2 + 1)j

(f) ƒ (x,y,z) = sin (x) ey ln(z)

Solution: The partial derivatives of the function ƒ (x,y,z) = sin (x) ey ln(z) are:

∂ƒ/∂x = /∂x (sin (x)) ey ln(z) = cos (x) ey ln(z)
∂ƒ/∂y = sin (x)/∂y (ey) ln(z) = sin (x) ey ln(z)
∂ƒ/∂z = sin (x) ey /∂z (ln(z)) = sin (x) ey1/z

Therefore the gradient is:

ƒ (x,y,z) = cos (x) ey ln(z)i + sin (x) ey ln(z)j + sin (x) ey1/z k

To interpret the gradient of a scalar field

ƒ (x,y,z) = ∂ƒ/∂x i + ∂ƒ/∂y j + ∂ƒ/∂z k

we note that its component in the i direction is the partial derivative of ƒ with respect to x. This is the rate of change of ƒ in the x direction since y and z are kept constant. In general, the component of ƒ in any direction is the rate of change of ƒ in that direction.

Example 2: Consider the scalar field ƒ (x,y) = 3x + 3 in two dimensions. It has no y dependence and it is linear in x. Its gradient is given by:

ƒ = /∂x (3x + 3)i + /∂y (3x + 3)j
= 3i + 0j

As would be expected the gradient has zero component in the y direction and its component in the x direction is constant (3).

Quiz 4: Select a point from the answers below at which the scalar field ƒ(x,y,z) = x2yzxy2z decreases in the y direction.

(a)(1, −1, 2) Incorrect - please try again!

(b)(1, 1, 1) Correct - well done!

(c)(−1, 1, 2) Incorrect - please try again!

(d)(1, 0, 1) Incorrect - please try again!

Solution: The partial derivative of the scalar function ƒ(x,y,z) = x2yzxy2z with respect to y is:

∂ƒ/∂y (x,y,z) = x2z − 2xyz

Evaluating it at the point (1, 1, 1) gives:

∂ƒ/∂y(1, 1, 1) = 12 × 1 − 2 × 1 × 1 × 1 = 1 − 2 = −1

This is negative and therefore the function ƒ decreases in the y direction at this point.

It may be verified that the function does not decrease in the y direction at any of the other three points.

Definition: if PPLATO | Basic Mathematics | Gradients and directional derivatives (3) is a unit vector, then PPLATO | Basic Mathematics | Gradients and directional derivatives (4) ƒ is called the directional derivative of ƒ in the direction PPLATO | Basic Mathematics | Gradients and directional derivatives (5). The directional derivative is the rate of change of ƒ in the direction PPLATO | Basic Mathematics | Gradients and directional derivatives (6).

Example 3: Find the directional derivative of ƒ (x,y,z) = x2yz in the direction 4i − 3k at the point (1, −1, 1).

Solution: The vector 4i − 3k has magnitude 42 + (−3)2 = 25 = 5. The unit vector in the direction 4i−3k is thus 1/5(4i −3k).

The gradient of ƒ is:

ƒ = /∂x (x2yz)i + /∂y (x2yz)j + /∂z (x2yz)k
= 2xyzi + x2zj + x2yk

and so the required directional derivative is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (7) ƒ = 1/5 (4i − 3k) (2xyzi + x2zj + x2yk)
= 1/5 [4 × 2xyz + 0 − 3 × x2y]

At the point (1, −1, 1) the desired directional derivative is thus:

PPLATO | Basic Mathematics | Gradients and directional derivatives (8) ƒ = 1/5 [8 × (−1) − 3 × (−1)] = −1

Exercise 2: Calculate the directional derivative of the following functions in the given directions and at the stated points:

(a)ƒ = 3x2 − 3y2 in the direction j at (1, 2, 3).

Solution: The directional derivative of the function ƒ = 3x2 − 3y2 in the unit vector j direction is given by the scalar product j .

The gradient of the function ƒ is

ƒ = 6xi − 6yj

Therefore the directional derivative in the unit vector j direction is:

j ƒ = j (6xi − 6yj) = −6y

and at the point (1, 2, 3) it has the value −6 × 2 = −12.

(b)ƒ = x2 + y2 in the direction 2i + 2j + k at (0, −2, 1).

Solution: The directional derivative of the function ƒ = x2 + y2 in the direction defined by the vector 2i + 2j + k is given by the scalar product PPLATO | Basic Mathematics | Gradients and directional derivatives (9) ƒ, where the unit vector PPLATO | Basic Mathematics | Gradients and directional derivatives (10) is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (11) = 2i + 2j + k / 22 + 22 + 12 = 2i + 2j + k / 9 = 2/3i + 2/3j + 1/3k

The gradient of the function ƒ is:

ƒ = x/ x2 + y2 i + y/ x2 + y2 j + 0k = xi + yi/ x2 + y2

Therefore the required directional derivative is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (12) ƒ = ( 2/3i + 2/3j + 1/3k ) ( xi + yi/ x2 + y2 ) = 2/3 x + y/ x2 + y2

At the point (0, −2, 1) it is equal to:

2/3 0 − 2/ 02 + (−2)2 = 2/3 × −2/2 = − 2/3

(c)ƒ = sin (x) + cos (y) + sin (z) in the direction πi + πj at (π, 0, π).

Solution: The directional derivative of the function ƒ = sin (x) + cos (y) + sin (z) in the direction defined by the vector πi + πj is given by the scalar product PPLATO | Basic Mathematics | Gradients and directional derivatives (13) ƒ, where the unit vector PPLATO | Basic Mathematics | Gradients and directional derivatives (14) is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (15) = πi + πj / π2 + π2 = i + j / 2

The gradient of the function ƒ is:

ƒ = cos (x)i − sin (y)j + cos (z)k

Therefore the directional derivative is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (16) ƒ = ( i + j / 2 ) [cos (x)i − sin (y)j + cos (z)k] = cos (x) − sin (y) / 2

and at the point (π, 0, π) it becomes cos (π) − sin (0) / 2 = − 1 / 2

We now state, without proof, two useful properties of the directional derivative and gradient:

  • The maximal directional derivative of the scalar field ƒ (x,y,z) is in the direction of the gradient vector ƒ.
  • If a surface is given by ƒ (x,y,z) = c where c is a constant, then the normals to the surface are the vectors ±ƒ.

Example 4: Consider the surface xy3 = z + 2. To find its unit normal at (1, 1, −1), we need to write it as : ƒ = xy3z = 2 and calculate the gradient of ƒ:

ƒ = y3i + 3xy2jk

At the point (1, 1, −1) this is ƒ = i + 3jk. The magnitude of this maximal rate of change is 12 + 33 + (−1)2 = 11

Thus the unit normals to the surface are: 1/11(i + 3jk).

Quiz 5: Which of the following vectors is normal to the surface x2yz = 1 at (1, 1, 1)?

(a) 4i + j + 17k Incorrect - please try again!

(b) 2i + j + 2k Incorrect - please try again!

(c) i + j + k Incorrect - please try again!

(d) −2ijk Correct - well done!

Explanation: The surface is defined by the equation:

x2yz = 1

To find its unit normal at (1, 1, 1) we need to evaluate the gradient of the function ƒ (x,y,z) = x2yz:

ƒ = 2xyzi + x2zj + x2yk

At the point (1, 1, 1) this is:

ƒ = i + j + k

Thus the required normals to the surface are ±(i + j + k). Hence (d) is a normal vector to the surface.

Quiz 6: Which of the following vectors is a unit normal to the surface cos (x)yz = −1 at (π, 1, 1)?

(a) −  1/ 2j + 1/ 2k Incorrect - please try again!

(b) πi + j + 2/ πk Incorrect - please try again!

(c) i Incorrect - please try again!

(d) −  1/ 2j1/ 2k Correct - well done!

Explanation: The surface is defined by the equation:

cos (x)yz = −1

To find its unit normal at the point (π, 1, 1), we need to evaluate the gradient of ƒ = cos (x)yz:

ƒ = −sin (x)yzi + cos (x)zj + cos (x)yk

At the point (π, 1, 1) this is:

ƒ = 0i + (−1)j + (−1)k = −jk

The magnitude of this vector is:

(−1)2 + (−1)2 = 2

Therefore the unit normal is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (17) = − 1/ 2 j1/ 2 k

Quiz 7: Select a unit normal to the (spherically symmetric) surface at x2 + y2 + z2 = 169 at (5, 0, 12):

(a) i + 1/6 j1/6 k Incorrect - please try again!

(b) 1/3 i + 1/3 j + 1/3 k Incorrect - please try again!

(c) 5/13 i + 12/13 k Correct - well done!

(d) 5/13 i + 12/13 k Incorrect - please try again!

Explanation: The surface is defined by the equation:

x2 + y2 + z2 = 169

To find its unit normal at point (5, 0, 12) we need to evaluate the gradient of ƒ = x2 + y2 + z2:

ƒ = 2xi + 2yj + 2zk

At the point (5, 0, 12) this is:

ƒ = 2 × 5i + 0 × j + 2 × 12k = 10i + 24k

The magnitude of this vector is:

(2 × 5)2 + (2 × 12)2 = 4 × (25 + 144) = 2 169 = 2 × 13

Therefore the unit normal is:

PPLATO | Basic Mathematics | Gradients and directional derivatives (18) = 5/13 j + 12/13 k

Choose the solutions from the options given

1. What is the gradient of ƒ (x, y, z) = xyz−1?

(a) i + j + z−2k

(b) y/zi + x/zjxy/z2k

(c) yz−1 i + xz−1 j + xyz−2 k

(d) − 1/z2

2.If n is a constant, choose the gradient of ƒ (r) = 1 ⁄ rn, where r = |r| and r = xi + yj + zk.

(a)0

(b)n/2 i + j + k/rn+1

(c) − nr/ rn+2

(d) n/2 r/rn+2

3.Select the unit normals to the surface of revolution, z = 1/2x2 + 1/2y2, at the point (1, 1, 4)

(a) ±1/ 3 (i + jk)

(b) ±1/ 3 (i + j + k)

(c) ±1/ 2 (i + j)

(d) ±1/ 2 (2i + 2j − 4k)


PPLATO | Basic Mathematics | Gradients and directional derivatives (2024)
Top Articles
Latest Posts
Article information

Author: Corie Satterfield

Last Updated:

Views: 6466

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.