![]() |
Gradients and Directional Derivatives |
PPLATO @ | ||||
PPLATO / Basic Mathematics |
||||||
|
![]() |
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.
![]() |
![]() |
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):
Solution:The partial derivative of xyzx with respect to the variable z is:
Quiz 2: Choose the following partial derivative ∂∂x(x cos (y) + 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) + ∂∂x y | |
= | 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:
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:
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 |
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 |
= | 12 (x2 + y2)½−1 × ∂∂x (x2)i + 12 (x2 + y2)½−1 × ∂∂y (y2)j | |
= | 12 (x2 + y2)−½ × 2x2−1i + 12 (x2 + y2)−½ × 2y2−1j | |
= | (x2 + y2)−½ xi + (x2 + y2)−½ yj | |
= | x √x2 + y2i + y √x2 + y2j |
Solution: The gradient of the function ƒ (x,y,z) = 3x2√y + 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 × 12y½−1 j − 3 sin (3z)k | |
= | 6y½xi + 32x2y−½ j − 3 sin (3z)k | |
= | 6x√yi + 32 x2 √y j − 3 sin (3z)k |
Solution: The partial derivative of the function ƒ (x,y,z) = 1 √x2 + y2 + z2 = (x2 + y2 + z2)½ with respect to the variable x is:
Similarly, the derivatives ∂ƒ∂y and ∂ƒ∂z are:
Therefore the gradient is:
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 |
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) ey 1z |
---|
Therefore the gradient is:
To interpret the gradient of a scalar field
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) = x2yz − xy2z decreases in the y direction.
Solution: The partial derivative of the scalar function ƒ(x,y,z) = x2yz − xy2z with respect to y is:
Evaluating it at the point (1, 1, 1) gives:
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 ![]() ![]() ![]() ![]() |
---|
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 15(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:
![]() |
= | 15 (4i − 3k) ⋅ (2xyzi + x2zj + x2yk) |
= | 15 [4 × 2xyz + 0 − 3 × x2y] |
At the point (1, −1, 1) the desired directional derivative is thus:
Exercise 2: Calculate the directional derivative of the following functions in the given directions and at the stated points:
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
Therefore the directional derivative in the unit vector j direction is:
and at the point (1, 2, 3) it has the value −6 × 2 = −12.
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 ⋅ ∇ƒ, where the unit vector
is:
The gradient of the function ƒ is:
Therefore the required directional derivative is:
At the point (0, −2, 1) it is equal to:
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 ⋅ ∇ƒ, where the unit vector
is:
The gradient of the function ƒ is:
Therefore the directional derivative is:
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:
Example 4: Consider the surface xy3 = z + 2. To find its unit normal at (1, 1, −1), we need to write it as : ƒ = xy3 −z = 2 and calculate the gradient of ƒ:
At the point (1, 1, −1) this is ∇ƒ = i + 3j − k. 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 + 3j − k).
Quiz 5: Which of the following vectors is normal to the surface x2yz = 1 at (1, 1, 1)?
Explanation: The surface is defined by the equation:
To find its unit normal at (1, 1, 1) we need to evaluate the gradient of the function ƒ (x,y,z) = x2yz:
At the point (1, 1, 1) this is:
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)?
Explanation: The surface is defined by the equation:
To find its unit normal at the point (π, 1, 1), we need to evaluate the gradient of ƒ = cos (x)yz:
At the point (π, 1, 1) this is:
The magnitude of this vector is:
Therefore the unit normal is:
Quiz 7: Select a unit normal to the (spherically symmetric) surface at x2 + y2 + z2 = 169 at (5, 0, 12):
Explanation: The surface is defined by the equation:
To find its unit normal at point (5, 0, 12) we need to evaluate the gradient of ƒ = x2 + y2 + z2:
At the point (5, 0, 12) this is:
The magnitude of this vector is:
Therefore the unit normal is:
Choose the solutions from the options given