In the grafic below the numbers would be 2 and -1
thnks

Hi!

The graphic is correct, let me explain.

In the top graph the slope of the line is increasing in the w direction and increasing in the J(w) direction as well.
This will produce a positive slope i.e. the line is increasing as w increases.
w will then be updated using:
w = w - alpha * (slope)
since the slope is positive (- alpha * slope) is negative causing w to decrease after the update.

In the bottom graph the slope of the line is increasing in the w direction and decreasing in the J(w) direction.
This will produce a negative slope i.e. the line decreases as w increases.
w will then be updated using:
w = w - alpha * (slope)
since the slope is negative (- alpha * slope) is positive causing w to increase after the update.

I like to think of the gradient descent algorithm as simulating what would happen if we took a ball dropped it in a half-pipe and watched it roll until it stopped at the bottom.

I hope this clears things up!