# Math Help - Piecewise function

1. ## Piecewise function

Why doesn't this code work?

0=\left{ \begin{array}{lr} 2u^2-7u+7 & \text{if } x \ge 1 \\ 2u^2+7u+7 & \text{if } x<1 \end{array} \right.

Which gives:

$0=\left{ \begin{array}{lr} 2u^2-7u+7 & \text{if } x \ge 1 \\ 2u^2+7u+7 & \text{if } x<1 \end{array} \right.$

2. \left{ should be \left\{

3. Ahh thanks, I didn't realise you had to use the extra backslash with \left and \right.

4. Originally Posted by Greengoblin
Ahh thanks, I didn't realise you had to use the extra backslash with \left and \right.
You don't. You only use the extra backslash when you want to write symbols such as { that are also used as special characters in the LaTeX system. Read this: Special Characters and Formatting in LaTeX

5. Alternatively, you can use the LaTeX cases environment:

0=\begin{cases} 2u^2-7u+7 & \text{if } x \ge 1 \\ 2u^2+7u+7 & \text{if } x<1 \end{cases}

which gives:

$0=\begin{cases} 2u^2-7u+7 & \text{if } x \ge 1 \\ 2u^2+7u+7 & \text{if } x<1 \end{cases}$