LaTeX Math Equations — Complete Guide

Master mathematical typesetting, from simple formulas to complex multi-line derivations.

Inline vs Display Math

LaTeX offers two ways to typeset math. Inline math is embedded within a paragraph using dollar signs. Display math is set apart on its own line using backslash-bracket notation:

% Inline math sits within running text:
The quadratic formula is $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.

% Display math is centered on its own line:
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

Inline math is compact and adjusts to fit the line height. Display math is full-size and centered, making it easier to read for complex expressions.

Type equations and see them rendered in real time.

Try it in our editor

Fractions

Use \frac{numerator}{denominator} to create fractions. In inline mode they appear smaller; in display mode they render at full size:

% Simple fraction:
\[ \frac{a}{b} \]

% Nested fractions:
\[ \frac{1}{1 + \frac{1}{x}} \]

% Binomial coefficient using \binom (requires amsmath):
\[ \binom{n}{k} = \frac{n!}{k!(n-k)!} \]

Subscripts and Superscripts

Use ^ for superscripts and _ for subscripts. Wrap multi-character exponents or indices in braces:

\[ x^2 \quad a_n \quad e^{i\pi} \quad x_{n+1} \]

% Combined subscript and superscript:
\[ x_i^2 \quad a_{n}^{(k)} \]

% Limits on operators:
\[ \lim_{n \to \infty} a_n = L \]

Greek Letters

Greek letters are written as backslash commands. Lowercase letters use the lowercase name, uppercase letters capitalize the first letter:

% Lowercase Greek:
\[ \alpha \quad \beta \quad \gamma \quad \delta \quad \epsilon \quad \pi \quad \sigma \quad \omega \]

% Uppercase Greek:
\[ \Gamma \quad \Delta \quad \Theta \quad \Lambda \quad \Sigma \quad \Omega \]

% Variant forms:
\[ \varepsilon \quad \varphi \quad \vartheta \]

Sums and Integrals

Summation and integral signs use subscripts and superscripts for their limits. In display mode, the limits are placed above and below the symbol:

% Summation:
\[ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} \]

% Product:
\[ \prod_{k=1}^{n} k = n! \]

% Definite integral:
\[ \int_{a}^{b} f(x) \, dx \]

% Double integral:
\[ \iint_{D} f(x, y) \, dA \]

Note the \, before dx -- this thin space is a standard convention in typesetting integrals.

Compile integrals, sums, and complex expressions with one click.

Try it in our editor

Matrices

Matrices require the amsmath package. Use pmatrix for parentheses, bmatrix for brackets, or vmatrix for determinants:

\usepackage{amsmath}

% Parenthesized matrix:
\[
\begin{pmatrix}
    a & b \\
    c & d
\end{pmatrix}
\]

% Bracketed matrix:
\[
\begin{bmatrix}
    1 & 0 & 0 \\
    0 & 1 & 0 \\
    0 & 0 & 1
\end{bmatrix}
\]

% Determinant:
\[
\begin{vmatrix}
    a & b \\
    c & d
\end{vmatrix}
= ad - bc
\]

Aligned Equations

The align environment (from amsmath) lets you write multi-line equations aligned at a specific point, typically the equals sign. Use & to mark the alignment point:

\usepackage{amsmath}

\begin{align}
    (x + y)^2 &= (x + y)(x + y) \\
              &= x^2 + xy + yx + y^2 \\
              &= x^2 + 2xy + y^2
\end{align}

Each line is automatically numbered. To suppress numbering, use align* instead of align. To suppress numbering on a single line, add \nonumber before \\.

Common Symbols

Here is a reference table of frequently used mathematical symbols:

CommandCategoryOutput
\leq, \geqRelationsless/greater than or equal
\neqRelationsnot equal
\approxRelationsapproximately equal
\in, \notinSet theoryelement of, not element of
\subset, \subseteqSet theorysubset, subset or equal
\cup, \capSet theoryunion, intersection
\rightarrowArrowsright arrow
\RightarrowArrowsdouble right arrow (implies)
\leftrightarrowArrowsbidirectional arrow
\inftyMiscellaneousinfinity
\partialCalculuspartial derivative
\nablaCalculusgradient (nabla)
\times, \cdotOperatorscross product, dot product
\pm, \mpOperatorsplus-minus, minus-plus