Quadratic Formula in LaTeX

See the quadratic formula rendered and copy the LaTeX.

Free · Runs in your browser · Your text is never uploaded

A LaTeX formula on the left rendered as a typeset equation on the right

The code

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. Use \pm for ± and \sqrt{…} for the square root; \frac{numerator}{denominator} makes the fraction.

Display or inline

Display mode centres the formula and makes it larger. Inline mode shrinks it to fit within a line of text, where the fraction becomes smaller.

Edit and experiment

Change the formula in the box to see the preview update. Error messages point to missing braces or unknown commands.

The formula in LaTeX

The quadratic formula is typed as x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. The discriminant b² − 4ac decides the roots: positive gives two real roots, zero gives one repeated root and negative gives two complex roots.

Need more options? Open the full LaTeX Equation Editor.

Related guides

Frequently asked questions

How do I write a fraction in LaTeX?

Use \frac{a}{b}.

How do I number the equation?

Choose the equation wrapper, which adds \begin{equation} … \end{equation}.