Gradient
Topic
Tags
Intro
The gradient describes the rate of change of a function. This type of function can be anything such as a cost function, room temperature, or pressure in an air tank. The gradient describes how these values behave over the function parameters and can mathematically be computed by taking the derivative of the function.
Gradient of a 1D field
The gradient in a 1D field can simply be computed by taking the derivative of the function, as it only depends on one variable. Take for example the function , which defines a basic parabola, shown in Figure 1. By taking the derivative of , we obtain .
By looking at Figure 1, there can be seen that for the parabola, there is a gradient defined by . This means that the gradient is non-constant and is a function of x.
Starting at there is a zero slope for the function . At this location, the gradient is also zero. If we now move to the right, so there holds , there clearly can be seen that the slope of starts to increase significantly. Which is similarly observed in the behavior of the gradient as well. Eventually, as becomes really large, the slope of approaches asymptotically a vertical line. This means that the slope becomes really steep, which implies a high rate of change, this is also the case for the gradient. For a large x, the gradient becomes large as well and shows that a large rate of change is present in the function of .
Now there is the understanding that the gradient is simply the derivative of the function, we will compute the gradient for a 2D case in the next section.
Gradient of a 2D field
Computing the gradient in a 2D field is practically the same as for the 1D field case. However, now 2 variables need to be taken into account. The derivative can be computed by taking partial derivatives of a function with respect to each parameter. This action can be noted by the gradient operator , the symbol is nothing more than taking the partial derivatives.
Let's consider the function . The gradient of this function can be computed accordingly;
By plotting these two functions in Figure 2, there can again be obtained that the gradient indeed shows the rate of change of the original function . Namely, there is no rate of change where the , and for larger , the rate increases as a function .
There is shown how the gradient can be computed and what its meaning is with respect to the original function. The gradient itself can be used further by exploiting its properties, for example, the algorithm gradient descent, minima are found based on the gradient of the function.