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 xaxis 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(xyz^{x}):
Solution:The partial derivative of xyz^{x} 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 + y^{2} is given by:
∇ƒ (x,y)  =  ∂ƒ∂x i + ∂ƒ∂y j 
=  ∂∂x (x + y^{2})i + ∂∂y (x + y^{2})j  
=  (1 + 0)i + (0 + 2y)j  
=  i + 2yj 
Quiz 3: Choose the gradient of ƒ (x,y) = x^{2}y^{3}:
Solution: The gradient of the function ƒ (x,y) =x^{2}y^{3} is given by:
∇ƒ (x,y)  =  ∂ƒ∂x i + ∂ƒ∂y j 
=  ∂∂x (x^{2}y^{3})i + ∂∂y (x^{2}y^{3})j  
=  ∂∂x (x^{2}) × y^{3}i + x^{2} × ∂∂y (y^{3})j  
=  2x^{2−1} × y^{3}i + 3x^{2} × y^{3−1}j  
=  2xy^{3}i + 3x^{2}y^{2}j 
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 + 3y^{2} has gradient:
∇ƒ (x,y)  =  ∂ƒ∂x i + ∂ƒ∂y j 
=  ∂∂x (x + 3y^{2})i + ∂∂y (x + 3y^{2})j  
=  (1 + 0)i + (0 + 3 × 2y^{2−1})j  
=  i + 6yj 
Solution: The gradient of the function ƒ (x,y) = √x^{2} + y^{2} = (x^{2} + y^{2})^{½} is given by:
∇ƒ (x,y)  =  ∂ƒ∂x i + ∂ƒ∂y j = ∂∂x (x^{2} + y^{2})^{½}i + ∂∂y (x^{2} + y^{2})^{½}j 
=  12 (x^{2} + y^{2})^{½−1} × ∂∂x (x^{2})i + 12 (x^{2} + y^{2})^{½−1} × ∂∂y (y^{2})j  
=  12 (x^{2} + y^{2})^{−½ } × 2x^{2−1}i + 12 (x^{2} + y^{2})^{−½ } × 2y^{2−1}j  
=  (x^{2} + y^{2})^{−½ }xi + (x^{2} + y^{2})^{−½ }yj  
=  x √x^{2} + y^{2}i + y √x^{2} + y^{2}j 
Solution: The gradient of the function ƒ (x,y,z) = 3x^{2}√y + cos (3z) = 3x^{2}y^{½} + cos (3z) is given by:
∇ƒ (x,y,z)  =  ∂ƒ∂xi + ∂ƒ∂yj + ∂ƒ∂z k 
=  3y^{½}∂∂x (x^{2})i + 3x^{2}∂∂y (y^{½})j + ∂∂y (cos (3z))k  
=  3y^{½} × 2x^{2−1}i + 3x^{2} × 12y^{½−1} j − 3 sin (3z)k  
=  6y^{½}xi + 32x^{2}y^{−½} j − 3 sin (3z)k  
=  6x√yi + 32 x^{2} √y^{ }j − 3 sin (3z)k 
Solution: The partial derivative of the function ƒ (x,y,z) = 1 √x^{2} + y^{2} + z^{2} = (x^{2} + y^{2} + z^{2})^{½} 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 (x^{2} + 1) = 4y(x^{2} + 1)^{−1} is:
∇ƒ (x,y)  =  4y × ∂∂x (x^{2} + 1)^{−1}i + (x^{2} + 1)^{−1} × ∂∂y 4yj 
=  4y × (−1)(x^{2} + 1)^{−1−1} ∂∂x (x^{2} + 1)^{2}i + 4(x^{2} + 1)^{−1}j  
=  −4y(x^{2} + 1)^{−2} × 2xi + 4(x^{2} + 1)^{−1}j  
=  − 8xy (x^{2} + 1)^{2}i + 4 (x^{2} + 1)j 
Solution: The partial derivatives of the function ƒ (x,y,z) = sin (x) e^{y} ln(z) are:
∂ƒ∂x  =  ∂∂x (sin (x)) e^{y} ln(z) = cos (x) e^{y} ln(z) 
∂ƒ∂y  =  sin (x)∂∂y (e^{y}) ln(z) = sin (x) e^{y} ln(z) 
∂ƒ∂z  =  sin (x) e^{y} ∂∂z (ln(z)) = sin (x) e^{y} 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) = x^{2}yz − xy^{2}z decreases in the y direction.
Solution: The partial derivative of the scalar function ƒ(x,y,z) = x^{2}yz − xy^{2}z 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 is a unit vector, then ⋅ ∇ƒ is called the directional derivative of ƒ in the direction . The directional derivative is the rate of change of ƒ in the direction . 

Example 3: Find the directional derivative of ƒ (x,y,z) = x^{2}yz in the direction 4i − 3k at the point (1, −1, 1).
Solution: The vector 4i − 3k has magnitude √4^{2} + (−3)^{2} = √25 = 5. The unit vector in the direction 4i− 3k is thus 15(4i −3k).
The gradient of ƒ is:
∇ƒ  =  ∂∂x (x^{2}yz)i + ∂∂y (x^{2}yz)j + ∂∂z (x^{2}yz)k 
=  2xyzi + x^{2}zj + x^{2}yk_{ } 
and so the required directional derivative is:
⋅ ∇ƒ  =  15 (4i − 3k) ⋅ (2xyzi + x^{2}zj + x^{2}yk) 
=  15 [4 × 2xyz + 0 − 3 × x^{2}y] 
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 ƒ = 3x^{2} − 3y^{2} 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 ƒ = √x^{2} + y^{2} 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 xy^{3} = z + 2. To find its unit normal at (1, 1, −1), we need to write it as : ƒ = xy^{3} −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 √1^{2} + 3^{3} + (−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 x^{2}yz = 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) = x^{2}yz:
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 x^{2} + y^{2} + z^{2} = 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 ƒ = x^{2} + y^{2} + z^{2}:
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