[Tex/LaTex] Writing a equation with many regions

math-mode

How to write a equation like the following which contain many regions?
GHASH

Best Answer

Use cases environment

\documentclass{article}
\usepackage{amsmath}

\begin{document}\begin{equation}
f(n) = \begin{cases} n/2 &\mbox{if } n \equiv 0 \\
(3n +1)/2 & \mbox{if } n \equiv 1 \\
(3n +1)/2 & \mbox{if } n \equiv 1 
\end{cases}
\end{equation}
\end{document}

enter image description here