# Syntax for writing a function defined by cases [duplicate]

Suppose we want to write about a function in a question that is defined by cases. In our note books we generally write "$f(x) =$" and then we give a big curly left bracket, and then define various values the function is to take in different domains. How to write this here? I mean can someone give me the syntax?

## marked as duplicate by user642796Dec 8 '15 at 20:41

• Specifically, this answer in the MathJax tutorial thread. – user642796 Dec 8 '15 at 20:41

The environment for that is cases, you use it as
$$f(x) = \begin{cases} 0 &, x < 0 \\ 1 & 0 \leqslant x \leqslant 2 \\ -\pi &, x > 2.\end{cases}$$

$$f(x) = \begin{cases} 0 &, x < 0 \\ 1 & 0 \leqslant x \leqslant 2 \\ -\pi &, x > 2.\end{cases}$$