[Tex/LaTex] How to write conditional equations with one-sided curly brackets

best practicesequations

I want to write a conditional expression such as the following.

enter image description here

What is the best way to express such conditional expressions in Latex?

Best Answer

I think this is a job for cases from the amsmath package

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
    f(x)= 
\begin{cases}
    \frac{x^2-x}{x},& \text{if } x\geq 1\\
    0,              & \text{otherwise}
\end{cases}
\]
\end{document}

or if you would prefer a displaystyle fraction, then you could use dcases from the mathtools package, which extends (and loads) the amsmath package.

enter image description here

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
    f(x)= 
\begin{dcases}
    \frac{x^2-x}{x},& \text{if } x\geq 1\\
    0,              & \text{otherwise}
\end{dcases}
\]
\end{document}