Quadratic Equations

Computing the roots of a quadratic equation

Quadratic equations are equations of the form

(1)   \begin{equation*}  ax^2 + bx + c = 0  \end{equation*}

where a \neq 0. If a = 0, (1) becomes linear equation, the solution of which is x=-\frac{c}{b}.

A quadratic equation can be solved as follows:

First, calculating \Delta = b^2 - 4ac
If \Delta = 0, the equation has one real solution (or root), which is

(2)   \begin{equation*}  x = -\frac{b}{2a} \end{equation*}

If \Delta > 0 the equation has two real solutions, x_{1} and x_{2}, where

(3)   \begin{equation*}  x_{1}=\frac{-b-\sqrt{\Delta}}{2a} \end{equation*}

(4)   \begin{equation*}  x_{2}=\frac{-b+\sqrt{\Delta}}{2a} \end{equation*}

If \Delta < 0, then the equation has two complex solutions. To calculating these complex solutions we make use of the complex number i = \sqrt{-1} or i^2=-1, hence \Delta can be written as

(5)   \begin{equation*}  \Delta = i^2|\Delta|  \end{equation*}

where |\Delta| is the absolute value of \Delta

Substitue (5) into (3) and (4), the two complex solutions of equation (1) are

(6)   \begin{equation*}  x_{1}=-\frac{b}{2a}-i\frac{\sqrt{|\Delta|}}{2a} \end{equation*}

(7)   \begin{equation*}   x_{2}=-\frac{b}{2a}+i\frac{\sqrt{|\Delta|}}{2a} \end{equation*}

which is a pair of conjugate complex numbers

Derivation of (3) and (4) can be found here

A java code for calculating the roots of a quadratic equation is here.


Checking your solutions

A quadratic equation has a form of
aX2 + bX + c = 0
To solve your equation, enter the values of a, b, c into the text boxes then click the SUBMIT button