Piecewise Functions
A piecewise function chooses a rule according to its input. Move the slider across each boundary to see the active branch and result while KaTeX displays the complete definition.
Explore the branches
Input
Active branch
Evaluated result
f(x)=\begin{cases}-x & x<0 \\ x & x\ge 0\end{cases}Typeset conditions with cases
The cases environment pairs each expression with its condition under one opening brace. Include equality in the appropriate condition so the definition covers its boundary. Choose from 13 examples, including pulses, step functions, and loss functions. JavaScript evaluates them; KaTeX renders the definition and result. See cases notation for the underlying TeX syntax.