Given a probability space (Ω,F,P)\left(\Omega,\mathcal{F},\mathbb{P}\right) and a measurable space (S,S),\left(S,\mathcal{S}\right), a random variable is a function X:Ω→SX:\Omega\rightarrow S such that:

{ω∈Ω:X(ω)∈A}∈F  ∀ A∈S.\left\{\omega\in\Omega:X\left(\omega\right)\in A\right\}\in\mathcal{F}\,\,\forall\,A\in\mathcal{S}.

SS is called the state space of XX and S\mathcal{S} is its corresponding σ\sigma-algebra.

A second probability measure is often constructed when referring to the random variable XX and the values in the state space SS so that the underlying probability space (Ω,F,P)\left(\Omega,\mathcal{F},\mathbb{P}\right) and the original probability measure P\mathbb{P} do not need to be continually referenced.

Given a random variable XX defined with respect to an underlying probability space (Ω,F,P)\left(\Omega,\mathcal{F},\mathbb{P}\right) and measurable space (S,S),\left(S,\mathcal{S}\right), the pushforward probability measure is a probability measure PX\mathbb{P}_X on (S,S)\left(S,\mathcal{S}\right) such that:

PX(X∈A)=P({ω∈Ω:X(ω)∈A})  ∀ A∈S.\mathbb{P}_X\left(X\in A\right) = \mathbb{P}\left(\left\{\omega\in\Omega:X\left(\omega\right)\in A\right\}\right)\,\,\forall\,A\in\mathcal{S}.

The pushforward probability measure PX\mathbb{P}_X assigns probabilities to measurable subsets of the state space, A∈S,A\in\mathcal{S}, and defines the probability distribution of XX over the state space S.S. The complete probability space is (S,S,PX).\left(S,\mathcal{S},\mathbb{P}_X\right).

The support of the probability distribution PX\mathbb{P}_X of a real-valued random variable XX is the smallest closed set X⊆R\mathcal{X}\subseteq\mathbb{R} such that PX(X∈X)=1.\mathbb{P}_X\left(X\in\mathcal{X}\right)=1. Equivalently, it is the set of points whose every neighbourhood has positive probability:

X={x∈R:PX(x−ε<X<x+ε)>0  ∀ ε>0}.\mathcal{X}=\left\{x\in\mathbb{R}:\mathbb{P}_X\left(x-\varepsilon<X<x+\varepsilon\right)>0\,\,\forall\,\varepsilon>0\right\}.

Individual points of the support can have probability zero; for a continuous random variable every point does. In practice the support of a discrete random variable is usually taken to be {x:pX(x)>0}\left\{x:p_X\left(x\right)>0\right\} and that of a continuous random variable {x:fX(x)>0}\left\{x:f_X\left(x\right)>0\right\} (see below), which differ from the definition above by at most a set of probability zero.

A cumulative distribution function (cdf) FX(x)F_X\left(x\right) of a random variable XX is:

FX(x)=PX(X≤x)  ∀ x∈R.F_X\left(x\right)=\mathbb{P}_X\left(X\leq x\right)\,\,\forall\,x\in\mathbb{R}.

A cdf has the following properties:

  • FXF_X is monotonically increasing;
  • FXF_X is right-continuous;
  • FXF_X have the limiting cases:
lim⁡x→−∞FX(x)=0\lim_{x\rightarrow-\infty}F_X\left(x\right)=0 lim⁡x→∞FX(x)=1.\lim_{x\rightarrow\infty}F_X\left(x\right)=1.

The probability PX(X∈A)\mathbb{P}_X\left(X\in A\right) where A⊆SA\subseteq S and A=(a1,a2]A=\left(a_1, a_2\right] is a half-open interval where a1<a2a_1<a_2 is constructed through the difference of cdfs:

PX(X∈A)=PX(a1<X≤a2)=PX(X≤a2)−PX(X≤a1)=FX(a2)−FX(a1).\begin{align*} \mathbb{P}_X\left(X\in A\right)&=\mathbb{P}_X\left(a_1<X\leq a_2\right)\\ &=\mathbb{P}_X\left(X\leq a_2\right)-\mathbb{P}_X\left(X\leq a_1\right)\\ &=F_X\left(a_2\right)-F_X\left(a_1\right). \end{align*}

Given a random variable XX defined on the measurable space (S,S),\left(S,\mathcal{S}\right), XX is a discrete random variable if there is an injective function from the state space SS to the natural numbers N.\mathbb{N}. That is, SS is countable:

S={x1,…,xn} (finite),orS=\{x_1,\ldots,x_n\}\,\mathrm{(finite), or} S={x1,…} (infinite).S=\{x_1,\ldots\}\,\mathrm{(infinite)}.

In this scenario SS is referred to as a discrete state space.

Let XX be a discrete random variable defined on the probability space (S,S,PX).\left(S,\mathcal{S},\mathbb{P}_X\right). The probability mass function (pmf) is a function pX:S→[0,1]p_X:S\rightarrow\left[0,1\right] defined by:

pX(x)=PX(X=x)  ∀ x∈S.p_X\left(x\right)=\mathbb{P}_X\left(X=x\right)\,\,\forall\,x\in S.

The pmf pX(x)p_X\left(x\right) assigns probability to each element x∈S.x\in S. Generally, the pmf is defined to be zero for all values x∈R∖Sx\in\mathbb{R}\setminus S so that pX(x)p_X\left(x\right) is defined for all x∈R.x\in\mathbb{R}.

The pmf pXp_X of a discrete random variable XX has the following properties:

pX(x)≥0  ∀ x∈Sp_X\left(x\right)\geq 0\,\,\forall\,x\in S ∑x∈SpX(x)=1.\sum_{x\in S}p_X\left(x\right)=1.

For discrete random variables, the singleton sets {x},\{x\}, x∈S,x\in S, form a partition of the state space SS into disjoint events. The probability PX(X∈A)\mathbb{P}_X\left(X\in A\right) for any A∈SA\in\mathcal{S} is constructed through the summation of the pmf:

PX(X∈A)=∑x∈APX(X=x)=∑x∈ApX(x).\begin{align*} \mathbb{P}_X\left(X\in A\right)&=\sum_{x\in A}\mathbb{P}_X\left(X=x\right)\\ &=\sum_{x\in A}p_X\left(x\right). \end{align*}

Let XX be a discrete random variable with support X={x1,x2,…}\mathcal{X}=\left\{x_1,x_2,\ldots\right\} where x1<x2<…,x_1<x_2<\ldots, pmf pXp_X and cdf FX.F_X. Given x∈R,x\in\mathbb{R}, for x<x1x<x_1 then FX(x)=0F_X\left(x\right)=0 and for x≥x1:x\geq x_1:

FX(x)=∑xi≤xpX(xi)⇔pX(xi)=FX(xi)−FX(xi−1)  ∀ i∈{2,3,…}.F_X\left(x\right)=\sum_{x_i\leq x}p_X\left(x_i\right)\Leftrightarrow p_X\left(x_i\right)=F_X\left(x_i\right)-F_X\left(x_{i-1}\right)\,\,\forall\,i\in\left\{2,3,\ldots\right\}.

A random variable XX is a continuous random variable if the cdf is a continuous function on R.\mathbb{R}. XX is absolutely continuous if the cdf FXF_X can be written in terms of its probability density function (pdf) fXf_X as:

FX(x)=∫−∞xfX(t) dt.F_X\left(x\right)=\int_{-\infty}^x f_X\left(t\right)\,dt.

Continuous pdfs and cdfs have the following properties. The pdf is the derivative of the cdf at every xx where FXF_X is differentiable (for example, wherever fXf_X is continuous):

fX(x)=ddt[FX(t)]t=xf_X\left(x\right)=\frac{d}{dt}\left[F_X\left(t\right)\right]_{t=x}

The probability that XX takes any single value is zero, PX(X=x)=0  ∀ x∈R,\mathbb{P}_X\left(X=x\right)=0\,\,\forall\,x\in\mathbb{R}, so the density fX(x)f_X\left(x\right) is not a probability and can even exceed one. Including or excluding the endpoints of an interval therefore does not change its probability:

PX(x1≤X≤x2)=PX(x1<X<x2)=FX(x2)−FX(x1)  ∀ x1<x2; x1,x2∈R.\begin{align*} \mathbb{P}_X\left(x_1\leq X\leq x_2\right)&=\mathbb{P}_X\left(x_1<X<x_2\right)\\ &=F_X\left(x_2\right)-F_X\left(x_1\right)\,\,\forall\,x_1<x_2;\,x_1,x_2\in\mathbb{R}. \end{align*}

The pdf fXf_X of a continuous random variable XX has the following properties:

fX(x)≥0  ∀ x∈Rf_X\left(x\right)\geq 0\,\,\forall\,x\in\mathbb{R} ∫−∞∞fX(x) dx=1.\int_{-\infty}^{\infty}f_X\left(x\right)\,dx=1.

Two random variables X1X_1 and X2X_2 are identically distributed if and only if they have the same probability distribution, PX1(X1∈A)=PX2(X2∈A)  ∀ A.\mathbb{P}_{X_1}\left(X_1\in A\right)=\mathbb{P}_{X_2}\left(X_2\in A\right)\,\,\forall\,A. A collection of random variables that are mutually independent and identically distributed is independent and identically distributed (iid).

Let X1,…,XnX_1,\ldots,X_n be real-valued random variables defined with respect to a common probability space. The random vector X‾=(X1,…,Xn)\underline{X}=\left(X_1,\ldots,X_n\right) is the function X‾:Ω→Rn\underline{X}:\Omega\rightarrow\mathbb{R}^n with components Xi,X_i, and its joint distribution PX‾\mathbb{P}_{\underline{X}} is the pushforward probability measure on Rn.\mathbb{R}^n. The joint cumulative distribution function of X‾\underline{X} is

FX‾(x‾)=P(X1≤x1,…,Xn≤xn)  ∀ x‾∈Rn.F_{\underline{X}}\left(\underline{x}\right)=\mathbb{P}\left(X_1\leq x_1,\ldots,X_n\leq x_n\right)\,\,\forall\,\underline{x}\in\mathbb{R}^n.

If every XiX_i is discrete then X‾\underline{X} is a discrete random vector with joint probability mass function

pX‾(x‾)=P(X1=x1,…,Xn=xn)p_{\underline{X}}\left(\underline{x}\right)=\mathbb{P}\left(X_1=x_1,\ldots,X_n=x_n\right)

and X‾\underline{X} is a continuous random vector if there is a joint probability density function fX‾:Rn→[0,∞)f_{\underline{X}}:\mathbb{R}^n\rightarrow\left[0,\infty\right) such that for every measurable A⊆RnA\subseteq\mathbb{R}^n

P(X‾∈A)=∫AfX‾(x‾)dx‾.\mathbb{P}\left(\underline{X}\in A\right)=\int_A f_{\underline{X}}\left(\underline{x}\right)d\underline{x}.

The joint pmf sums to one over the state space and the joint pdf integrates to one over Rn.\mathbb{R}^n. The marginal distribution of a component XiX_i is its own probability distribution and is recovered from the joint distribution by summing or integrating over the other components. For n=2n=2 the marginal pmf and marginal pdf of X1X_1 are

pX1(x1)=∑x2pX1,X2(x1,x2)p_{X_1}\left(x_1\right)=\sum_{x_2}p_{X_1,X_2}\left(x_1,x_2\right) fX1(x1)=∫−∞∞fX1,X2(x1,x2)dx2.f_{X_1}\left(x_1\right)=\int_{-\infty}^{\infty}f_{X_1,X_2}\left(x_1,x_2\right)dx_2.

The random variables X1,…,XnX_1,\ldots,X_n are mutually independent if and only if the joint cdf factorises as the product of the marginal cdfs for all x‾,\underline{x}, and equivalently if and only if the joint pmf or pdf factorises as the product of the marginal pmfs or pdfs.

FX‾(x‾)=∏i=1nFXi(xi)F_{\underline{X}}\left(\underline{x}\right)=\prod_{i=1}^n F_{X_i}\left(x_i\right) fX‾(x‾)=∏i=1nfXi(xi)f_{\underline{X}}\left(\underline{x}\right)=\prod_{i=1}^n f_{X_i}\left(x_i\right)

Let random variables X1X_1 and X2X_2 be defined on the probability spaces (S1,S1,PX1)\left(S_1,\mathcal{S}_1,\mathbb{P}_{X_1}\right) and (S2,S2,PX2)\left(S_2,\mathcal{S}_2,\mathbb{P}_{X_2}\right) respectively and with respect to a common underlying probability space (Ω,F,P).\left(\Omega,\mathcal{F},\mathbb{P}\right). The random variable events X1∈A1X_1\in A_1 and X2∈A2X_2\in A_2 where A1∈S1A_1\in\mathcal{S}_1 and A2∈S2A_2\in\mathcal{S}_2 are associated with the events E1,E2∈FE_1,E_2\in\mathcal{F} respectively:

PX1(X1∈A1)=P(E1)\mathbb{P}_{X_1}\left(X_1\in A_1\right)=\mathbb{P}\left(E_1\right) PX2(X2∈A2)=P(E2).\mathbb{P}_{X_2}\left(X_2\in A_2\right)=\mathbb{P}\left(E_2\right).

The joint random variable event is (X1∈A1,X2∈A2)\left(X_1\in A_1,X_2\in A_2\right) and corresponds to the intersection of the associated sample space events E1∩E2.E_1\cap E_2. The bivariate probability distribution for the bivariate random vector (X1,X2)\left(X_1,X_2\right) is a joint pushforward probability measure:

PX1,X2(X1∈A1,X2∈A2)=P({ω∈Ω:X1(ω)∈A1,X2(ω)∈A2}).\mathbb{P}_{X_1,X_2}\left(X_1\in A_1,X_2\in A_2\right)=\mathbb{P}\left(\left\{\omega\in\Omega:X_1\left(\omega\right)\in A_1,X_2\left(\omega\right)\in A_2\right\}\right).

The random variables X1X_1 and X2X_2 are independent if and only if:

PX1,X2(X1∈A1,X2∈A2)=PX1(X1∈A1)PX2(X2∈A2)  ∀ A1∈S1,A2∈S2.\mathbb{P}_{X_1,X_2}\left(X_1\in A_1,X_2\in A_2\right)=\mathbb{P}_{X_1}\left(X_1\in A_1\right)\mathbb{P}_{X_2}\left(X_2\in A_2\right)\,\,\forall\,A_1\in\mathcal{S}_1,A_2\in\mathcal{S}_2.

Let (X1,X2)\left(X_1,X_2\right) be a discrete random vector and x2x_2 be a value with pX2(x2)>0.p_{X_2}\left(x_2\right)>0. The conditional pmf of X1X_1 given X2=x2X_2=x_2 is the conditional probability of the event X1=x1X_1=x_1 given the event X2=x2.X_2=x_2.

pX1∣X2(x1∣x2)=pX1,X2(x1,x2)pX2(x2)p_{X_1\mid X_2}\left(x_1\mid x_2\right)=\frac{p_{X_1,X_2}\left(x_1,x_2\right)}{p_{X_2}\left(x_2\right)}

Let (X1,X2)\left(X_1,X_2\right) be a continuous random vector and x2x_2 be a value with fX2(x2)>0.f_{X_2}\left(x_2\right)>0. The conditional pdf of X1X_1 given X2=x2X_2=x_2 is defined by the same ratio of densities, even though the event X2=x2X_2=x_2 has probability zero.

fX1∣X2(x1∣x2)=fX1,X2(x1,x2)fX2(x2)f_{X_1\mid X_2}\left(x_1\mid x_2\right)=\frac{f_{X_1,X_2}\left(x_1,x_2\right)}{f_{X_2}\left(x_2\right)}

The conditional distribution of X1X_1 given X2=x2X_2=x_2 is the probability distribution with this pmf or pdf. Rearranging gives fX1,X2=fX1∣X2fX2,f_{X_1,X_2}=f_{X_1\mid X_2}f_{X_2}, and X1X_1 and X2X_2 are independent if and only if the conditional distribution of X1X_1 given X2=x2X_2=x_2 equals the marginal distribution of X1X_1 for every x2.x_2. Bayes’ theorem for densities follows in the same way as for events.

fX2∣X1(x2∣x1)=fX1∣X2(x1∣x2)fX2(x2)fX1(x1)f_{X_2\mid X_1}\left(x_2\mid x_1\right)=\frac{f_{X_1\mid X_2}\left(x_1\mid x_2\right)f_{X_2}\left(x_2\right)}{f_{X_1}\left(x_1\right)}

Let XX be a random variable and g:R→Rg:\mathbb{R}\rightarrow\mathbb{R} be a function. The transformation Y=g(X)Y=g(X) is a random variable whose distribution is determined by that of XX through FY(y)=P(g(X)≤y).F_Y\left(y\right)=\mathbb{P}\left(g(X)\leq y\right). If XX is discrete then

pY(y)=∑x: g(x)=ypX(x).p_Y\left(y\right)=\sum_{x:\,g(x)=y}p_X\left(x\right).

If XX is continuous and gg is strictly monotonic and differentiable on the support of XX then the change of variables formula gives

fY(y)=fX(g−1(y))∣ddyg−1(y)∣.f_Y\left(y\right)=f_X\left(g^{-1}\left(y\right)\right)\left\lvert\frac{d}{dy}g^{-1}\left(y\right)\right\rvert.

If gg is not monotonic the formula is applied separately on each interval where gg is monotonic and the contributions are summed; for example Y=X2Y=X^2 has fY(y)=12y(fX(y)+fX(−y))f_Y\left(y\right)=\frac{1}{2\sqrt{y}}\left(f_X\left(\sqrt{y}\right)+f_X\left(-\sqrt{y}\right)\right) for y>0.y>0. For a continuous random vector X‾\underline{X} and a bijection g‾:Rn→Rn\underline{g}:\mathbb{R}^n\rightarrow\mathbb{R}^n that is continuously differentiable with continuously differentiable inverse, the change of variables theorem for multiple integrals gives

fY‾(y‾)=fX‾(g‾−1(y‾))∣det⁡Jg‾−1(y‾)∣f_{\underline{Y}}\left(\underline{y}\right)=f_{\underline{X}}\left(\underline{g}^{-1}\left(\underline{y}\right)\right)\left\lvert\det J_{\underline{g}^{-1}}\left(\underline{y}\right)\right\rvert

where Jg‾−1J_{\underline{g}^{-1}} is the Jacobian matrix of the inverse transformation.