# Compilation error for discontinuous function definition

I am trying to render the following discontinuous function definition

with the LaTeX code:

$$f(x) = \left\{ \begin{array}{lr} 0,5x & \text{for x} \in [0, 10] \\ 0,55x + 5 & \text{for x} \in (10, 30] \\ 0,1x + 25 & \text{for x} \in (30, 40] \\ 0,6x + 10 & \text{for x} \in (40, +\infty) \end{array}. \right$$


At Texify and other online LaTeX equation editors, this code renders fine (as you can see), but if I use this code in my document at the compilation time I get errors:

Missing delimeter (. insterted)
Missing $inserted Display math should end with $$Bad math environment delimenter. You can't use '\egno' in vertical mode Missing inserted Display math should end with$$  I have used LaTeX for rendering equations for two weeks so sorry for my poor knowledge (probably it will be something obvious for most of you). • You should put the x outside \text{...}, as it's math, not text. Also, you may consider using \text{for$x \in (10, 30]} which makes copy/pasting/reusing from or in other parts of the document easier. – Philippe Goutet Aug 20 '11 at 16:00 ## 1 Answer Write \right. instead of just \right, the dot is required for a phantom delimiter. However, you could use the cases environment of amsmath instead of this array. $$f(x) = \begin{cases} 0,5x & \text{for x} \in [0, 10] \\ 0,55x + 5 & \text{for x} \in (10, 30] \\ 0,1x + 25 & \text{for x} \in (30, 40] \\ 0,6x + 10 & \text{for x} \in (40, +\infty) \end{cases}$$  You don't need to write \left\{ and \right.. Note, the text is left aligned here, which could be more desirable. • That's it! Thank you very much. What i noticed, is that the left bracket (in both cases) looks like it was crossed by some horizontal (white) lines. If I change the zoom, there is more or less of these lines and they appear in different places - so I assume that's a reader application issue (or my monitor:)) and these lines will not be visible in the output document? – omnomnom Aug 20 '11 at 12:54 • @Piotrek: yes it's a displaying issue (not of your monitor) of the composed symbol. It should be fine in print because of the higher resolution. – Stefan Kottwitz Aug 20 '11 at 13:03 • @Stefan: x should be outside \text{...}. In fact, it's often better to write \text{forx \in (10, 30]\$} as it makes copy/pasting/reusing from or in other parts of the document easier. Also, note that unless you use \begin{array}{@{}lr}, the solution with {array} will have too much space between the brace and the equations. – Philippe Goutet Aug 20 '11 at 15:41
• @Philippe: that's correct, as can bee seen in the output images, good addition. It would be good to address your comment to Piotrek, as it may help him. – Stefan Kottwitz Aug 20 '11 at 15:46