The quadratic equation 2x2 + 5x + 1 = 0 can be solved by first writing it as
and then
This step is known as completing the square: the left-hand side is made into an exact square by adding a suitable constant to both sides. The solutions for x can then be arrived at by taking square roots and rearranging. Applying this method to the general quadratic equation derives the quadratic formula.