How to write this Piecewise function using LaTeX?

I tried

```
$
\begin{array}{cc}
\{ &
\begin{array}{cc}
0 & x\leq 0 \\
\frac{100-x}{100} & 0\leq x\leq 100 \\
0 & 100\leq x
\end{array}
\end{array}
$
```

but it didn't work perfectly, the bracket "**{**" looks small, see:

## Best Answer

This situation is exactly what the

`cases`

environment from the`amsmath`

package was designed for. If you putin your preamble then you can wite

to adapt your example with the correct size bracket.

As for not being able to use TeX-like syntax to write equations on this site: this is a deliberate choice. Most of the time we actually want to talk about the TeX source here rather than the equations (or whatever) it produces; and there are times when it could be actively confusing to have a TeX-like process to produce images that isn't actually TeX (in its full, Turing-complete, confusing glory...)

(See the discussion on meta for more on this, if you're interested.)