The slope of a function at some point provides information about a local maximum. A positive slope means a peak is to the left and a negative slope means a peak is to the right. If you want to find the input that maximizes or minimizes the output of your function, you can use the slope to guide you. Calculate the slope, change the input accordingly, and repeat. This is gradient descent in one dimension. If your function takes multiple arguments, then instead of a single slope you use a vector of slopes with respect to each argument. This vector of slope(s) is your gradient.