# [Tex/LaTex] Writing a equation with many regions

math-mode

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

Use cases environment
\documentclass{article}
\begin{document}$$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}$$