Gradient

Table of Contents

1. Gradient

Given a function \(w=f(x,y,z)\) in three variables, the gradient of \(w\) is the vector formed by its partial derivatives:

\[ \nabla w = \langle w_x,w_y,w_z \rangle \]

We can then, for example, rewrite the chain rule like so:

\[ \frac{\text{d}f}{\text{d}t} = \nabla f \cdot \frac{\text{d} \vec{r}}{\text{d} t} \]

where \(\frac{\text{d} \vec{r}}{\text{d} t} = \langle\frac{\text{d}x}{\text{d}t},\frac{\text{d}y}{\text{d}t},\frac{\text{d}z}{\text{d}t}\rangle\).

1.1. Level Surfaces

The gradient of \(w\) at a point is perpendicular to the level surface \(w=c\) at that point, pointing towards higher values of \(w\).

1.1.1. Intuition

Take, for example, the function \(w(x,y,z) = a_1x + a_2y + a_3z\). Then, the gradient of this function is:

\[ \nabla w = \langle a_1, a_2, a_3 \rangle \]

The level surfaces can be represented by \(a_1x+a_2y+a_3z=c\), where \(c\) is some constant. Realize, however, that this is simply the equation of a plane, and we know that what happens to be the gradient vector is perpendicular to this plane.

1.1.2. Proof

Say we have a level surface \(w(x,y,z)=c\), and we have another function \(\vec{r}(t)\) that moves on this level surface. We know that since \(\vec{r}(t)\) moves on the level surface, then its velocity vector \(\vec{v}\) must also be tangent to this level surface. Then, by the chain rule, we have:

\[ \frac{\text{d}w}{\text{d}t} = \nabla w \cdot \frac{\text{d}\vec{r}}{\text{d}t} = \nabla w \cdot \vec{v} \]

Yet, since \(w(t)=c\), its derivative must be zero. Therefore, we have:

\[ \nabla w \cdot \vec{v} = 0 \]

As the dot product is zero, we know that the gradient vector and the velocity vector are perpendicular. However, since the velocity vector is tangent to the surface, this can be extended to mean that the gradient vector and the level surface are perpendicular.

2. Directional Derivatives

Partial derivatives gives us the rate of change for a function in the directions defined by \(\hat{i}\), \(\hat{j}\), and so on. But directional derivatives allow us to calculate the rate of change for a function \(w\) in some arbitrary direction defined by the unit vector \(\hat{u}\).

To do so, we will introduce an external parameter \(s\), where \(\vec{r}(s)\) is the trajcetory along \(\hat{u} = \langle a,b \rangle\) moving at unit speed. Then, we can parameterize \(x\) and \(y\) in terms of \(s\):

\begin{aligned} x(s) &= x_0 + as \\ y(s) &= y_0 + bs \end{aligned}

We see that what we really want is to find \(\frac{\text{d}w}{\text{d}s}\). To do this, we can use the chain rule, with the notation as follows:

\[ \frac{\text{d}w}{\text{d}s}_{|\hat{u}} = \nabla w \cdot \frac{\text{d}\vec{r}}{\text{d}s} = \nabla w \cdot \hat{u} \]

2.1. Application of Gradient

We can further simplify this into:

\[ \frac{\text{d}w}{\text{d}s}_{|\hat{u}} = \nabla w \cdot \hat{u} = |\nabla w| \cos{\theta} \]

Geometrically, this means that the directional derivative is the projection of the gradient along the direction of the unit vector. It can be seen that the directional derivative's magnitude is the largest when \(\cos(0)=1\); in other words, when \(\hat{u} = \text{dir}(\nabla w)\).

This is a new way of thinking about the gradient: the gradient is the direction in which the function changes increases the fastest at that point. Similarly, this can be extended to show that the direction in which the function not changes is when the direction is perpendicular to the gradient (notice that this means we are moving along the level surface), and so on.

3. Finding the Potential

Sometimes, we would like to know the potential function that a given gradient is of. There are two ways to do this: using line integrals, and using antiderivatives.

3.1. Using Line Integrals

We know by the fundamental theorem of calculus, we can say that, for the trajectory starting from \((0,0)\) to \((x,y)\):

\[ \int_C \vec{F} \cdot \text{ d}\vec{r} = f(x,y) - f(0,0) \]

Therefore,

\[ f(x,y) = \int_C \vec{F} \cdot \text{ d}\vec{r} + f(0,0) \]

The \(f(0,0)\) can be interpreted as an integration constant. Since this vector field is path independent, we can choose the easiest path to get from \((0,0)\) to \((x,y)\): first along the x-axis, and then parallel to the y-axis. These two paths are easy to compute because for the first one, \(y\) is constant so \(\text{d}y=0\), and vice versa for the second path.

3.2. Using Antiderivatives

We can also use antiderivatives to find \(f\), such that we know the gradient components \(f_x\) and \(f_y\). First, taking the antiderivative of \(f_x\), we have:

\[ f = \int f_x + g(y) \]

\(g(y)\) is our integration constant, as we took the antiderivative with respect to \(x\). However, this means that there could still be extra terms that depend only on \(y\), which is why it is necessary to include this \(g(y)\).

But since we now know \(f\), we can figure out what \(g(y)\) should be by taking the derivative with respect to \(y\) and equating with our gradient expression for \(f_y\).

Last modified: 2025-07-20 11:56