The result (click to save):

Inline Math
Display Math
No need to add $...$ or $$...$$.
You can also use \begin{align}...\end{align} to align a set of equations.