How do I get this sort of notation in LaTeX?

I'm using TeXmaker.
How do I get this sort of notation in LaTeX?

I'm using TeXmaker.
Use the cases environment from \usepackage{amsmath}.
\[f(x)=
\begin{cases}%
7 & \text{if $x=0$}\\
3x^2-2 & \text{otherwise}
\end{cases}
\]

\[ f(x)= \begin{cases} 7, &\qquad\text{if $x=0.$} \\ 3x-2, &\qquad\text{otherwise.} \end{cases} \] to have better spacing and the appropriate punctuation.
– Gonzalo Medina
Apr 15 '14 at 01:19