# [Tex/LaTex] LaTeX: Statistics CDF and PDF

math-mode

Is there any way to type the CDF and PDF of a distribution on LaTeX similar to how it's done on this site?

https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)

I yield to @CarLaTeX’s invite to provide a slightly simplified version of her answer:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{mathtools}

\begin{document}

Probability density function:
$\begin{cases*} \frac{1}{b-a} & for x\in[a,b] \\ 0 & otherwise \\ \end{cases*}$

Cumulative distribution function:
$\begin{cases*} 0 & for x<a \\ \frac{x-a}{b-a} & for x\in[a,b) \\ 1 & for x\ge b \\ \end{cases*}$

\end{document}


See the manual of the mathtools package, section 3.4.3 (p. 18) for details.