# Why do we need gradient descent to minimize a cost function?

I read about regression in machine learning and came across this gradient descent algorithm to find the minimum value of a cost function. Then I read wikipedia to know more and it says the following

But then I started thinking of what I learnt in my high school math like the one described here in these Khan Academy lectures. The way to take derivative and second derivative test to find maximum and minimum. Then I started wondering why we need iterative gradient descent algorithm when we have the above mentioned high school math method.

I am not sure if I have understood things wrongly.

Can you help me understand why we need gradient descent here ?

• What if the objective function is polynomial? To find the critical points, one needs to solve a system of polynomial equations, which is in the realm of algebraic geometry. One can then use Groebner bases, but that is not exactly taught in high school, is it? – Rodrigo de Azevedo Jun 11 '17 at 10:16
• Actually the simplest problem in my head is logistic regression: try to write down its objective and derivative and set the derivative to 0. You'll find that you can't get the solution in closed form, because there isn't. The solution must be find using some iterative method like gradient descent – Yining Wang Jun 21 '17 at 15:04