Two dollar signs set the formula as a block of its own:
$$
\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}
$$Aligned over several lines
$$
\begin{aligned}
a &= b + c \\
&= d + e + f \\
&= g
\end{aligned}
$$The & marks the place where the lines line up.
Matrices
$$
\begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
$$Formulas that are too wide
The same applies here: what is too wide scrolls inside itself instead of blowing up the column.