How to write cases with LaTeX?

For the question as it was originally posed, we can still use cases very easily. We simply employ the technique of using \left. at the start and then we can put \right\} at the end:

\[
  X(m, n) = \left.
  \begin{cases}
    x(n), & \text{for } 0 \leq n \leq 1 \\
    x(n - 1), & \text{for } 0 \leq n \leq 1 \\
    x(n - 1), & \text{for } 0 \leq n \leq 1
  \end{cases}
  \right\} = xy
\]

enter image description here

I'm not sure that you can span rows with cases as in the edit, however.


\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \[
    X(m,n) = \left\{\begin{array}{lr}
        x(n), & \text{for } 0\leq n\leq 1\\
        x(n-1), & \text{for } 0\leq n\leq 1\\
        x(n-1), & \text{for } 0\leq n\leq 1
        \end{array}\right\} = xy
  \]
\end{document}

enter image description here

If you want two conditions on different lines, can use a \multirow for the first column:

\documentclass{article}
\usepackage{amsmath}
\usepackage{multirow}

\begin{document}
  \[
    X(m,n) = \left\{\begin{array}{@{}lr@{}}
        \multirow{2}{*}{x(n),} & \text{for }0\leq n\leq 1\\
                               & \text{or }0\leq n\leq 1\\
        x(n-1), & \text{for }0\leq n\leq 1\\
        x(n-1), & \text{for }0\leq n\leq 1
        \end{array}\right\} = xy
  \]
\end{document}

enter image description here


Essentially the same answer as Ignasi, but with the use of \text for the word for. (And with the \leqslant symbol of amssymb which I find much more elegant.)

\documentclass{article}
\usepackage{amsmath, amssymb}
\newcommand{\for}{\text{for }}
\begin{document}
  \[
    X(m,n)=
    \left\{
    \begin{array}{lr}
      x(n),& \for 0\leqslant n \leqslant 1 \\
      x(n-1),& \for 0\leqslant n \leqslant 1 \\
      x(n-1),& \for 0\leqslant n \leqslant 1
    \end{array}
    \right\} = xy.
  \]
\end{document}

enter image description here

Edit As for the modification recently asked:

\documentclass{article}
\usepackage{amsmath, amssymb}
\newcommand{\for}{\text{for }}
\begin{document}
  \[
    X(m,n)=
    \left\{
    \begin{array}{@{}lr@{}}
      x(n),& 
      \begin{array}{r@{}}
        \for 0\leqslant n \leqslant 1\\ 
        \text{or } 0\leqslant x \leqslant 1
      \end{array}\\
      x(n-1),& \for 0\leqslant n \leqslant 1 \\
      x(n-1),& \for 0\leqslant n \leqslant 1
    \end{array}
    \right\} = xy.
  \]
\end{document}

(I didn't deem it necessary to define a new macro for the word or since it is written only once. Note that it seems better this time to center the second column.)

Edit bis Added the @{} specifications suggested by daleif. No more centering.

enter image description here