Math Equations in LaTeX: A Complete Reference

LaTeX was purpose-built for mathematical typesetting. Whether you need a simple fraction in a paragraph or a multi-line proof with aligned equals signs, LaTeX handles it with consistent, publication-quality output. This guide covers everything from the basics to advanced usage.

Inline vs. Display Math

LaTeX has two fundamental math modes. Inline math sits inside a paragraph, while display math is centred on its own line with extra vertical spacing.

% Inline math — use single dollar signs
The formula $E = mc^2$ appears inside the sentence.

% Display math — use \[ ... \] or equation environment
\[
  E = mc^2
\]

% Numbered equation
\begin{equation}
  E = mc^2
  \label{eq:einstein}
\end{equation}

% Reference the equation later
As shown in equation \eqref{eq:einstein}, energy and mass are equivalent.

Use the equation environment when you want numbered equations that can be cross-referenced. Use \[...\] for unnumbered display equations.

The amsmath Package

Always load amsmath in any document with significant mathematics. It adds essential environments and fixes several LaTeX math quirks.

\usepackage{amsmath}   % essential math environments
\usepackage{amssymb}   % extra math symbols (ℝ, ∈, ∅, etc.)
\usepackage{amsthm}    % theorem/proof environments

Fractions, Powers, and Subscripts

% Fractions
\frac{numerator}{denominator}

\[
  f(x) = \frac{x^2 + 2x + 1}{x - 3}
\]

% Superscripts (powers) and subscripts
x^2          % x squared
x_i          % x sub i
x_i^2        % x sub i, squared
x^{2n+1}     % use braces for multi-character exponents
a_{ij}       % matrix element a_ij

% Square root and nth root
\sqrt{x}     % square root
\sqrt[n]{x}  % nth root

Sums, Integrals, and Limits

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

% Integral
\[
  \int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
\]

% Double integral
\[
  \iint_D f(x,y) \, dx \, dy
\]

% Limit
\[
  \lim_{x \to \infty} \frac{1}{x} = 0
\]

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

The \, command adds a thin space before dx in integrals — a typographic convention in mathematical writing.

Multi-line Equations with align

Use the align environment (from amsmath) to typeset multi-line equations with columns aligned at the & character.

\begin{align}
  f(x) &= (x+1)^2 \\
       &= x^2 + 2x + 1
\end{align}

% align* suppresses equation numbering
\begin{align*}
  2x + 3 &= 11 \\
  2x     &= 8  \\
  x      &= 4
\end{align*}

Each line ends with \\ (double backslash). The & marks the alignment point — usually placed just before the equals sign.

Matrices

% pmatrix — parentheses  ( )
\[
  A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
\]

% bmatrix — brackets  [ ]
\[
  B = \begin{bmatrix} a & b \\ c & d \end{bmatrix}
\]

% vmatrix — vertical bars  | | (determinant notation)
\[
  \det(A) = \begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} = -2
\]

% Larger matrix with dots
\[
  M = \begin{pmatrix}
    a_{11} & a_{12} & \cdots & a_{1n} \\
    a_{21} & a_{22} & \cdots & a_{2n} \\
    \vdots & \vdots & \ddots & \vdots \\
    a_{m1} & a_{m2} & \cdots & a_{mn}
  \end{pmatrix}
\]

Common Symbols Quick Reference

Symbol typeCommandResult
Greek — lowercase\alpha, \beta, \gamma, \pi, \sigma, \omegaα β γ π σ ω
Greek — uppercase\Gamma, \Delta, \Sigma, \OmegaΓ Δ Σ Ω
Set notation\in, \notin, \subset, \cup, \cap, \emptyset∈ ∉ ⊂ ∪ ∩ ∅
Real/integer sets\mathbb{R}, \mathbb{Z}, \mathbb{N}, \mathbb{C}ℝ ℤ ℕ ℂ
Logic\forall, \exists, \neg, \land, \lor∀ ∃ ¬ ∧ ∨
Arrows\to, \gets, \Rightarrow, \iff→ ← ⇒ ⟺
Relations\leq, \geq, \neq, \approx, \equiv≤ ≥ ≠ ≈ ≡
Dots\ldots, \cdots, \vdots, \ddots… ⋯ ⋮ ⋱

Try math equations in the editor

Paste any of the examples above and see them rendered as a PDF in real time.

Start Writing

Continue Learning