# Calculation of minimum of cost function [duplicate]

Generally we use the gradient descent to compute the minimum of cost function. My question is why can't we use the maxima minima approach to calculate the cost function. If I am not wrong double derivative of the graph will give us the minima. And we would be able to avoid those gradient steps which are slow to execute. Please feel free If my understanding of the concept is wrong.

The problem is, even if a cost function is differentiable (necessary for gradient descent anyways), it does not mean that the equation $\frac{\partial \mathcal L(w)}{dw}=0$ has an analytical solution. A typical examples are neural networks.