Want to keep learning?

This content is taken from the UNSW Sydney's online course, Maths for Humans: Linear and Quadratic Relations. Join the course to learn more.
Picture of Al Khwarizmi
Al Khwarizmi

Al Khwarizmi's identity and the quadratic formula

Al Khwarizmi is often considered the father of algebra, due to an influential text he wrote, and his name is the origin of the term algorithm. His `completing-the-square’ technique lies at the heart of a beautiful formula that we call al Khwarizmi’s identity. The usual quadratic formula is a consequence.

In this step you

  • will see how the completing-the-square leads to al Khwarizmi’s identity

  • how the quadratic formula follows from al Khwarizmi’s identity

  • use the quadratic formula to factor quadratic polynomials.

This step is probably the algebraic highlight of the course, and the most detailed steps. On this page is a very important derivation. Make sure you proceed slowly and carefully, please check all the steps by writing things out line by line, and then apply your understanding to work out the answers to the questions. This is how we learn mathematics.

Solving a quadratic equation using completing the square

Suppose we want to solve the quadratic equation


Half of the coefficient of \(\normalsize{x}\) is \(\normalsize{-7}\), so we take the \(\normalsize{1887}\) to the other side, and add the square of \(\normalsize{-7}\) to both sides. This gives


Now we rewrite the left-hand side as a perfect square:


At this stage we have to “take the square root” of \(\normalsize{1936}\). What does this mean? It means finding a number \(\normalsize{r}\) with the property that \(\normalsize{r^2=1936}\). In this case such a number actually exists: it is \(\normalsize{r=44}\). But otherwise we would just write \(\normalsize{\pm \sqrt{1936}}\) to represent an approximate square root, and its negative. We can’t forget about the negative, since we want two solutions!

So in our case \(\normalsize{x-7=44}\) or \(\normalsize{x-7=-44}\). Thus we do get two solutions, namely \(\normalsize{x=51}\) or \(\normalsize{x=-37}\).

Deriving al Khwarizmi’s identity

Now let’s apply this to transform the general quadratic polynomial


where \(a\neq 0\). First step, factor out the \(\normalsize{a}\) to get

\[\Large{ax^2+bx+c = a \left( x^2+\frac{b}{a}x+\frac{c}{a}\right) }.\]

Add and subtract \(\normalsize{\left(\frac{b}{2a}\right)^2}\) inside the right hand expression:

\[\Large{ax^2+bx+c = a \left( x^2+\frac{b}{a}x + \left(\frac{b}{2a}\right)^2 +\frac{c}{a} -\left(\frac{b}{2a}\right)^2\right)}.\]

Now there is a perfect square inside these brackets:

\[\Large{ax^2+bx+c = a \left( \left(x+\frac{b}{2a}\right)^2 +\frac{c}{a} -\left(\frac{b}{2a}\right)^2\right)}.\]


\[{\Large \frac{c}{a} -\left(\frac{b}{2a}\right)^2 = \frac{4ac-b^2}{(2a)^2}}\]

we get

\[\Large{ax^2+bx+c = a \left( \left(x+\frac{b}{2a}\right)^2 +\frac{4ac-b^2}{(2a)^2}\right)}.\]

Now for the last step, we multiply through by \(\normalsize{a}\) to get

\[\Large{ax^2+bx+c=a\left(x+\frac{b}{2a}\right)^2+\frac{4ac-b^2}{4a}. \label{1} \tag 1}\]

This is one of the really great derivations in mathematics, resulting in an essential formula, which we call al Khwarizmi’s identity. This step has lots of questions to give you practice with this formula!

Q1 (E): Apply the steps above to rewrite \(\normalsize{x^2+12x-85}\) using al Khwarizmi’s identity.

Q2 (M): Apply the steps above to rewrite \(\normalsize{3x^2+5x-22}\) using al Khwarizmi’s identity.

Solving quadratic equations using al Khwarizmi’s identity

Once we have written a quadratic function in the form of al Khwarizmi’s identity, solving a quadratic equation involving it is relatively easy.

For example suppose that we want to solve \(\normalsize{x^2+12x-85=0}\). Having already solved Q1, we rewrite this equation as


and then as


Now taking square roots, \(\normalsize{x+6=11}\) or \(\normalsize{x+6=-11}\) from which we deduce that \(\normalsize{x=5}\) or \(\normalsize{x=-17}\). These are the two solutions.

Q3 (M): i) Solve \(\normalsize{x^2+12x-85=-21}\).

Q4 (M): i) Solve \(\normalsize{3x^2+5x-22=0}\) using al Khwarizmi’s identity.

The quadratic formula

The familiar quadratic formula follows from al Khwarizmi’s identity.

If \(\normalsize{ax^2+bx+c = 0}\) then



\[\Large{ \left(x+\frac{b}{2a}\right)^2 = \frac{b^2-4ac}{(2a)^2}}.\]

Taking square roots

\[\Large{ x+\frac{b}{2a}=\pm\frac{\sqrt{b^2-4ac}}{2a}}.\]

And finally, we isolate \(x\)

\[\Large{ x= \frac{- b \pm\sqrt{b^2-4ac}}{2a}}.\]

This is the famous equation that all students memorise.

Q5 (E): Use the quadratic formula to solve \(\normalsize{x^2+4x+3=0}\).

Factoring quadratics–the simpler way

Once we know how to solve quadratics, Descartes theorem allows us a simpler way to factor a quadratic expression: just find its zeroes first, and then each of these will correspond to a linear factor!

Q6 (E) Use the quadratic formula and Descartes’ theorem to factor \(\normalsize{x^2+x-132}\).


A1. We transform the quadratic expression \(\normalsize{x^2+12x-85}\) to


A2. We transform



We use the working of A1. to rewrite \(\normalsize{x^2+12x-85=-21}\) as


This gives


In this case we can take square roots, giving \(\normalsize{x+6=10}\) or \(\normalsize{x+6=-10}\), from which we deduce that \(\normalsize{x=4}\) or \(\normalsize{x=-16}\). These are the two solutions.


We use the working of A2. to write \(\normalsize{3x^2+5x-22=0}\) as


This gives


So taking square roots, \(\normalsize{x+5/6=17/6}\) or \(\normalsize{x+5/6=-17/6}\) from which we deduce that \(\normalsize{x=12/6=2}\) or \(\normalsize{x=-22/6=-11/3}\). These are the two solutions.

A5. Using the quadratic formula we have:




A6. Solving equation \(\normalsize{x^2+x-132=0}\) we have zeroes






You are now in a position to systematically solve all quadratic factorisation problems, without any guess work. Thank you al Khwarizmi!

Share this article:

This article is from the free online course:

Maths for Humans: Linear and Quadratic Relations

UNSW Sydney

Get a taste of this course

Find out what this course is like by previewing some of the course steps before you join: