# If the normal equation works, why do we need gradient descent?

Recently, I followed the open course CS229, http://cs229.stanford.edu/notes/cs229-notes1.pdf
This lecturer introduces an alternative approach to gradient descent that is called "Normal Equation" and the equation is as follows:

$$\theta=\left(X^{T} X\right)^{-1} X^{T} \vec{y}$$

The normal equation can directly compute the $$\theta$$.

If the normal equation works, why do we need gradient descent? What is the trade-off between these two methods?