Actually, this is not an unique topic about gradient but I still would like to share my experiments on gradient. I’d like to study gradient term from a different aspect here. The other resources will be listed at the end of the article.
How I came up with the gradient again? I had accepted it as partial derivatives of variables of a function for a long time till I need to find out the position vector to the extremum from any point on the x-axis. I need to understand geometrical meaning of the gradient vector. If you remember, gradient of a scalar function is a vector and gives us the results below:
- It’s a vector that points in the direction of greatest increase of a function.
- It’s zero at a local maximum or local minimum (because there is no single direction of increase)
I’ll look into a quadratic function here for my special case. At first, I thought that gradient vector would give me the vector points to the extremum point If exist. But it was an intuitive error. Let’s consider a quadratic function f(x) and examine its graph.
The graph on the left shows the curve of an f(x) function and its derivative df/dx. I studied here a function has a max. point because of the nature of the gradient and to understand it more precisely. The f(x) function curve has a max. point and df/dx curve cuts the x-axis on point x=2. As you see, maximum value of the function located on x=2 on x-axis with the value of f(x)=6. By the way, this graph was drawn by gnuplot.
df/dx is positive on the left side of maximum point and negative in the other direction. Especially for the sample, this means that the magnitude of gradient vector is positive on the left side and negative on the right side. This means the gradient vector on the left side points to the right (positive direction) and points to the left on the right side (negative direction). Now, we exactly know a gradient vector on points of x-axis in the direction of greatest increase of a function. (In this sample, to the maximum point).
Well, so what can we say about the magnitude of the vector? Of course, we know it already from birth. The magnitude of the vector would be equal to the df/dx. But even so, It would be nice to see the gradient vectors on the graph. Let’s see them.
Gradient vectors of different quadratic functions.
To see the gradient vectors separately, they were plotted on top of each other and start positions of the vectors were selected by using constant small intervals. On the first graph above, a couple of vectors can be seen completely because of the slope of df/dx curve. If slope of derivative (green curve) is close to zero (A value is the slope of the derivative here), the difference between magnitude of sequential vectors will be small on the graph. In other words, slope of df/dx (A value) is the measure of rate of change in quadratic function. Greater slope as absolute value means that the magnitude of vectors away from the extremum will increase in proportion with slope. Bigger slope means more sharp f(x) curve and larger vectors away from the extremum.
As pointed out above, Gradient vector only gives the direction of greatest increase of a function and the change of the magnitude of the vector is basically related to the slope of df/dx and x value that vector is initialized on. A value controls the slope of the df/dx and curvature of f(x) function.
To study gradient vectors on one-dimension was a good experience for me although the information above is not a secret and helped me to understand the behavior of the gradient vectors on different f(x) functions. This would lead us to the understanding of gradient vector on two dimension. Most of two dimensional plots of gradient vectors on the web is not real demonstration, so it was hard for me to imagine it in my brain. If we consider a sink or source, the gradient vectors around extremum point will be smaller near the sink/source and greater away. You can think that vectors around a maximum point are and cross it. I hope this article will help you understand more precisely the concept of gradient and its vectors.