Inline math looks like this: E=mc2E = mc^2 and σ2=1ni=1n(xiμ)2\sigma^2 = \frac{1}{n} \sum_{i=1}^{n} (x_i - \mu)^2.

Here is a displayed equation:

0ex2dx=π2\int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}

And a multi-line derivation:

f(x)=[x1f(x)x2f(x)]=[2x12x2]\begin{aligned} \nabla f(x) &= \begin{bmatrix} \partial_{x_1} f(x) \\ \partial_{x_2} f(x) \end{bmatrix} \\ &= \begin{bmatrix} 2x_1 \\ 2x_2 \end{bmatrix} \end{aligned}