[Tex/LaTex] How to write Exponential distribution in overleaf

casesmath-mode

I am new to overleaf and having trouble in writing an exponential distribution function in overleaf.
Exponential distribution

Could anyone please help me share some insight on how to write it?
Thanks in advance!!

Best Answer

Use cases (or dcases), and although I prefer writing exp, if you insist on using e ensure it is an upright letter, as its a number, not a variable, so use \mathrm{e}.

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\begin{equation}
f_X(x) = 
\begin{cases}
\lambda \exp(-\lambda x) & x > 0 \\
0 & \text{otherwise.}
\end{cases}
\end{equation}
or
\begin{equation}
f_X(x) = 
\begin{dcases}
\lambda \mathrm{e}^{-\lambda x} & x > 0 \\
0 & \text{otherwise.}
\end{dcases}
\end{equation}
\end{document}

enter image description here

Related Question