Formula

Quadratic formula

Also written: quadratic equation formula · solving quadratics formula

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

The quadratic formula gives both solutions of any equation in the form ax² + bx + c = 0, whether or not it factors.

What each part means

aa
the coefficient of x², and never zero
bb
the coefficient of x
cc
the constant term
±\pm
read the formula twice, once with plus and once with minus

Quadratic formula calculator

Enter the numbers from ax2+bx+c=0ax^2 + bx + c = 0. Whole numbers, decimals and fractions all work, and the steps below follow the lesson line for line.

The steps below solve a sample equation, ax2+bx+c=0ax^2 + bx + c = 0 with a = 1, b = −5 and c = 6. Turn on JavaScript to try your own numbers.

Worked example: x2−5x+6=0

Two real solutions: x = 3 and x = 2.

Read off a, b and c

In x2−5x+6=0, keep each sign with its number.

a=1b=−5c=6

Find the discriminant

b2−4ac=(−5)2−4(1)(6)=25−24=1

The discriminant is positive and a perfect square, so there are two real solutions, both rational.

Substitute into the formula

Put the values into the quadratic formula.

x=−(−5)±12(1)=5±12

Split the ±

Work out the + and the − separately.

x=5+12=3x=5−12=2

Check the solutions

Substitute each solution back into the equation.

(3)2−5(3)+6=9−15+6=0
(2)2−5(2)+6=4−10+6=0

Runs on your device: nothing you type is sent or saved. Want the reasoning behind each step? Read the quadratic formula lesson. If the discriminant is negative, see quadratics with complex solutions.

When to use it

The equation is quadratic and either does not factor or would take too long to try. It always works, so it is the fallback when factoring stalls.

Before you use it

Rearrange the equation so one side is zero. The formula reads aa, bb and cc off the standard arrangement ax2+bx+c=0ax^2 + bx + c = 0, and reading them off anything else gives the wrong answer.

Keep the signs with the numbers. In 2x2−5x+3=02x^2 - 5x + 3 = 0, the value of bb is −5-5.

Where the formula comes from

It is completing the square, done once on the general equation instead of every time on numbers.

Start from ax2+bx+c=0ax^2 + bx + c = 0, divide by aa, then move the constant across:

x2+bax=−cax^2 + \frac{b}{a}x = -\frac{c}{a}

Add the square of half the xx coefficient to both sides:

x2+bax+b24a2=b24a2−cax^2 + \frac{b}{a}x + \frac{b^2}{4a^2} = \frac{b^2}{4a^2} - \frac{c}{a}

The left side is now a perfect square, and the right side goes over a common denominator:

(x+b2a)2=b2−4ac4a2\left(x + \frac{b}{2a}\right)^2 = \frac{b^2 - 4ac}{4a^2}

Take the square root of both sides, which is where ±\pm appears, and subtract b2a\tfrac{b}{2a}:

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Full walkthrough in completing the square.

Worked examples

Solve x2−5x+6=0x^2 - 5x + 6 = 0.

Here a=1a = 1, b=−5b = -5, c=6c = 6.

x=5±25−242=5±12x = \frac{5 \pm \sqrt{25 - 24}}{2} = \frac{5 \pm 1}{2}

So x=3x = 3 or x=2x = 2.

Solve 2x2+3x−1=02x^2 + 3x - 1 = 0.

Here a=2a = 2, b=3b = 3, c=−1c = -1.

x=−3±9+84=−3±174x = \frac{-3 \pm \sqrt{9 + 8}}{4} = \frac{-3 \pm \sqrt{17}}{4}

This one does not factor over the whole numbers, which is exactly when the formula earns its place.

The part under the root

b2−4acb^2 - 4ac is the discriminant. Computing it first tells you how many real solutions to expect, and warns you before you take the root of a negative.

Lessons that teach this

Related