# How do I define a piecewise function in latex?

I just saw this question but it doesn't answer mine. How do I define a function something like

f(x) = { bla bla if x<0 bla bla if x>0

The above question doesn't answer how to write f(x) before the bracket

• If you want f(x)= before the bracket, then just write f(x)= before the \begin{cases} (and after the \$ or $) – marsupilam Apr 21 '17 at 17:38 ## 1 Answer LaTeX is very flexible. Although it is not WYSIWYG you can write it in a very logical way. So if you want to have to have f(x) precede your cases, just write it that way. Here with the example of the linked question. \documentclass{article} \usepackage{amsmath} \begin{document} \[ f(x) = \begin{cases} 0 & x\leq 0 \\ \frac{100-x}{100} & 0\leq x\leq 100 \\ 0 & 100\leq x \end{cases}$