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


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}.

f_X(x) = 
\lambda \exp(-\lambda x) & x > 0 \\
0 & \text{otherwise.}
f_X(x) = 
\lambda \mathrm{e}^{-\lambda x} & x > 0 \\
0 & \text{otherwise.}

enter image description here

Related Question