# Piecewise function

• Dec 16th 2008, 04:19 AM
Greengoblin
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.$
• Dec 16th 2008, 04:25 AM
Chop Suey
\left{ should be \left\{
• Dec 16th 2008, 04:39 AM
Greengoblin
Ahh thanks, I didn't realise you had to use the extra backslash with \left and \right.
• Dec 16th 2008, 05:55 AM
mr fantastic
Quote:

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
• Dec 16th 2008, 11:43 AM
Opalg
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}$