Why height becomes negative 2 (-2) in the below figure?

Hello @Eljan_Mahammadli

Welcome to the community.

While doing Gradient descent, we calculate height = J_{final} - J_{initial}

When we are on the right side of the minima,

J_{final} **>** J_{initial} So, the height = J_{final} - J_{initial} = +2

When we are on the left side of the minima,

J_{final} **<** J_{initial} So, the height = J_{final} - J_{initial} = -2

Our ultimate aim is to calculate the slope at every point on the cost curve as we are traversing the cost curve, which is calculated as (J_{final} - J_{initial})/(w_{final} - w_{initial})

w_{final} > w_{initial} in both cases.

Hence the slope will be negative on the left hand side of the minima and it will be positive on the right hand side of the minima.

Hope this clarifies.

@Eljan_Mahammadli I had exactly the same question. Check this out - it really helped with understanding why the slope is negative: Positive and negative slope | Algebra I | Khan Academy - YouTube

Thanks, this enlightened me.