# Large braces for specifying values of variables by condition

How do I typeset something like, X = 0 if a=1, 1 otherwise, using those huge left braces and specifying each condition in a line?

-

The »cases« environment from amsmath does the trick.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$$X= \begin{cases} 0, & \text{if}\ a=1 \\ 1, & \text{otherwise} \end{cases}$$
\end{document}

-
x = \begin{cases}
0, & \text{if } a = 1, \\
1, & \text{otherwise}.
\end{cases}


amsmath is needed for \text.

-

Another method, which is especially helpful if one needs to have more control over the items alignment, is the array construct.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$X=\left\{ \begin{array}{@{}ll@{}} 0, & \text{if}\ a=1 \\ 1, & \text{otherwise} \end{array}\right.$$

\end{document}


Instead of ll, one may choose cc, rr, rl, etc. Besides, all the array capabilities can be applied here (\arraycolsep, \arraystretch, \extrarowheight by loading the array package, etc).

-

Iverson bracket can also be used: $x=[a=1]$.

-