# Solving a quadratic equation

We want to solve a quadratic equation $$$a\Tred{x}^2 + b\Tred{x}+c = 0$$$ for numbers $$a\ne0$$, $$b$$ and $$c$$.

We first compute the **discriminant** $$\Tviolet{\Delta} = b^2 - 4 ac$$.

- If $$\Tviolet{\Delta}\lt 0$$, the equation has
**no solutions**. - If $$\Tviolet{\Delta} = 0$$, the equation has exactly
**one solution**$$$ \Tred{x_0} = \frac{-b}{2a}.$$$ - If $$\Tviolet{\Delta}\gt 0$$, the equation has exactly
**two solutions**$$$\displaystyle \Tred{x_-} = \frac{-b-\sqrt{\Tviolet{\Delta}}}{2a},\quad \Tred{x_+} = \frac{-b+\sqrt{\Tviolet{\Delta}}}{2a}.$$$

For instance, take the equation $$$x^2 - x - 2 = 0$$$ The discriminant is $$\Tviolet{\Delta} = 1 + 8 = 9$$. Its positive square root is $$\sqrt{\Tviolet{\Delta}} = \Tgreen{3}$$. The solutions of the equation are \begin{align*} \Tred{x_-} &= \frac{-(-1) - \Tgreen{3}}{2\times 1} = \frac{-2}{2} = -1\\ \Tred{x_+} &= \frac{-(-1) + \Tgreen{3}}{2\times 1} = \frac{4}{2} = 2 \end{align*} This can be **checked** by plugging the solutions into the equation \begin{align*} (\Tred{-1})^2 - (\Tred{-1}) -2 &= 1 +1 -2 = 0,\\ \Tred{2}^2 -\Tred{2} - 2 &= 4 - 2 - 2 = 0. \end{align*}