A probability density function is a very special function used in probability to calculate the moments of random variables. It is used in the transfer function, one of the most important theorems in probability theory.

The density function simplifies the expression of the probability distribution. Let’s discover together without further delay this great function.

## What is a probability density function?

Throughout the rest of this article, $(\Omega,\mathscr{A},\mathbb{P})$ is a probability space, $\mathscr{B}$ the Borel algebra formed by the open sets of $\mathbb{R}$. Moreover, if $x\in \mathbb{R}$ and $X$ is a random variable on $(\Omega,\mathscr{A}),$ we denote $(X\le x)=X^{-1}((-\infty,x])=\{\omega\in\Omega: X(\omega)\le x\}$. More generally, if $B$ is a Borel set, we denote $(X\in B)=X^{-1}(B)=\{\omega\in \Omega: X(\omega)\in B\}$.

Definition: The probability density function, PDF, of a continuous random vartaiable $X:(\Omega,\mathscr{A})\to (\mathbb{R},\mathscr{B})$ is an positive integrable function $f_X$ on $\mathbb{R}$ such that $$\int^{+\infty}_{-\infty}f_X(x)dx=1$$ and for any $a,b\in\mathbb{R}$ with $a<b$, we have $$\mathbb{P}(a\le X\le b)=\int^b_a f(x)dx.$$ In this case, we say that the random variable $X$ has a probability density function $f_X$.

### Density and the cumulative distribution function

Let $X$ be a random variable and denote by $F_X$ its cumulative distribution function, CDF. That is, for any $x\in X,$ $F_X(x)=\mathbb{P}(X\le x)$.

Assume that a random variable $X$ has a density $f_X$. Then according to the previous paragraph, we have $\mathbb{P}(X=x)=\mathbb{P}(x\le X\le x)=0$, for any $x\in \mathbb{R}$. Thus, for any $a,b\in\mathbb{R}$ with $a<b,$ we can write \begin{align*} F_X(b)-F_X(a)&=\mathbb{P}(a<X\le b)\cr &= \mathbb{P}(a\le X< b)\cr& = \mathbb{P}(a\le X\le b)\cr &=\int^b_a f(x)dx.\end{align*} Let us now use properties of the cumulative distribution function to derive further properties on the density function. We know that $F_X(x)\to 1$ as $x\to+\infty$ and $F_X(x)\to 0$ as $x\to-\infty$. The by letting $a\to -\infty,$ we obtain \begin{align*} F_X(b)=\int^b_{-\infty}f(x)dx.\end{align*} On the other hand, the fact that \begin{align*} \frac{F_X(x)-F_X(x)}{x-a}=\frac{1}{x-a}\int^x_a f(t)dt\end{align*} shows that if $f_X$ is continuous at the point $a,$ then the function $F_X$ is differentiable at $a$ and $F’_X(a)=f(a)$. From this, we also deduce that if the density function $f_X$ is  piecewise continuous, then the cumulative distribution function $F_X$ is piecewise differentiable and $F_X'(x)=f(x)$ for almost every $x$. This can also reformulated as $dF_X(x)=f(x)dx.$