\[ax^2 +bx+c=0\]
can be solved for \[x\]
using the formula \[x= \frac{-b \pm \sqrt{b^2-4ac}}{2a}\]
.We can derive this formula by completing the square.
Starting from
\[ax^2 +bx+c=0\]
, multiply by \[a\]
.\[a^2x^2 +abx+ac=0\]
Ignore
\[ac\]
for the moment and complete the square for \[a^2x^2 +abx\]
.\[a^2x^2 +abx+ac=((ax+\frac{b}{2})^2 - (\frac{b}{2})^2)+ac=0 \]
Now add
\[(\frac{b}{2})^2\]
and subtract \[ac\]
.\[(ax+\frac{b}{2})^2 = (\frac{b}{2})^2-ac =\frac{b^2}{4}-ac= \frac{b^2-4ac}{4}\]
Square root both sides.
\[ax+\frac{b}{2} = \sqrt{(\frac{b^2-4ac}{4})}=\pm \frac{\sqrt{b^2-4ac}}{2}\]
Now subtract
\[\frac{b}{2}\]
from both sides.\[ax =- \frac{b}{2} \sqrt{(\frac{b^2-4ac}{4})}= \frac{-b \pm\sqrt{b^2-4ac}}{2}=\]
Finally divide both sides by
\[a\]
.\[x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}\]
.