Math & School

Quadratic equation solver

Solve a quadratic equation – pq-formula or quadratic formula, with a worked example.

Updated on May 25, 2026 Calculator, calculation path and examples on one page

Back to category: Math & School

Calculator

Reset Load example

Examples

Typical calculations

x² − 4x + 4 = 0 → x = 2.

Double solution

Solution (double): x = 2.00

Load this example

2x² − 8x + 6 = 0 → x = 3 and x = 1.

Midnight formula

x₁: 3.00

Load this example

FAQ

Frequently asked questions

What is the pq formula?

It solves equations of the form x² + px + q = 0 with x = −p/2 ± √((p/2)² − q).

What is the midnight formula?

The abc or midnight formula solves ax² + bx + c = 0 with x = (−b ± √(b² − 4ac)) / (2a).

What does the discriminant say?

If D is greater than 0, there are two solutions; if D is 0, a double solution; if D is less than 0, not a real solution.

When do I use pq and when abc?

The pq formula fits if there is a 1 in front of the x². Otherwise the midnight formula with a, b and c is more convenient.

Can I put an equation with a in front of x² into pq form?

Yes, by dividing the whole equation by a. Or you can use the midnight formula directly.

Are negative or decimal numbers also allowed?

Yes. You can enter any real numbers for p, q, a, b and c.

Related calculators

Continue seamlessly

Geometry calculator

Calculate area, perimeter and volume for circle, rectangle, triangle, cylinder and sphere.

Sources and notes

Rule status and context

Formulas
pq: x = −p/2 ± √((p/2)² − q); abc: x = (−b ± √(b² − 4ac)) / (2a)