Given a probability space (Ω,F,P) and a measurable space (S,S), a random variable is a function X:Ω→S such that:
{ω∈Ω:X(ω)∈A}∈F∀A∈S.
S is called the state space of X and S is its corresponding σ-algebra.
A second probability measure is often constructed when referring to the random variable X and the values in the state space S so that the underlying probability space (Ω,F,P) and the original probability measure P do not need to be continually referenced.
Given a random variable X defined with respect to an underlying probability space (Ω,F,P) and measurable space (S,S), the pushforward probability measure is a probability measure PX on (S,S) such that:
PX(X∈A)=P({ω∈Ω:X(ω)∈A})∀A∈S.
The pushforward probability measure PX assigns probabilities to measurable subsets of the state space, A∈S, and defines the probability distribution of X over the state space S. The complete probability space is (S,S,PX).
The support of the probability distribution PX of a real-valued random variable X is the smallest closed set X⊆R such that PX(X∈X)=1. Equivalently, it is the set of points whose every neighbourhood has positive probability:
X={x∈R:PX(x−ε<X<x+ε)>0∀ε>0}.
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} and that of a continuous random variable {x:fX(x)>0} (see below), which differ from the definition above by at most a set of probability zero.
A cumulative distribution function (cdf) FX(x) of a random variable X is:
FX(x)=PX(X≤x)∀x∈R.
A cdf has the following properties:
FX is monotonically increasing;
FX is right-continuous;
FX have the limiting cases:
x→−∞limFX(x)=0x→∞limFX(x)=1.
The probability PX(X∈A) where A⊆S and A=(a1,a2] is a half-open interval where a1<a2 is constructed through the difference of cdfs:
Given a random variable X defined on the measurable space (S,S),X is a discrete random variable if there is an injective function from the state space S to the natural numbers N. That is, S is countable:
S={x1,…,xn}(finite),orS={x1,…}(infinite).
In this scenario S is referred to as a discrete state space.
Let X be a discrete random variable defined on the probability space (S,S,PX). The probability mass function (pmf) is a function pX:S→[0,1] defined by:
pX(x)=PX(X=x)∀x∈S.
The pmf pX(x) assigns probability to each element x∈S. Generally, the pmf is defined to be zero for all values x∈R∖S so that pX(x) is defined for all x∈R.
The pmf pX of a discrete random variable X has the following properties:
pX(x)≥0∀x∈Sx∈S∑pX(x)=1.
For discrete random variables, the singleton sets {x},x∈S, form a partition of the state space S into disjoint events. The probability PX(X∈A) for any A∈S is constructed through the summation of the pmf:
PX(X∈A)=x∈A∑PX(X=x)=x∈A∑pX(x).
Let X be a discrete random variable with support X={x1,x2,…} where x1<x2<…, pmf pX and cdf FX. Given x∈R, for x<x1 then FX(x)=0 and for x≥x1:
A random variable X is a continuous random variable if the cdf is a continuous function on R.X is absolutely continuous if the cdf FX can be written in terms of its probability density function (pdf) fX as:
FX(x)=∫−∞xfX(t)dt.
Continuous pdfs and cdfs have the following properties. The pdf is the derivative of the cdf at every x where FX is differentiable (for example, wherever fX is continuous):
fX(x)=dtd[FX(t)]t=x
The probability that X takes any single value is zero, PX(X=x)=0∀x∈R, so the density fX(x) is not a probability and can even exceed one. Including or excluding the endpoints of an interval therefore does not change its probability:
The pdf fX of a continuous random variable X has the following properties:
fX(x)≥0∀x∈R∫−∞∞fX(x)dx=1.
Two random variables X1 and X2 are identically distributed if and only if they have the same probability distribution, PX1(X1∈A)=PX2(X2∈A)∀A. A collection of random variables that are mutually independent and identically distributed is independent and identically distributed (iid).
Let X1,…,Xn be real-valued random variables defined with respect to a common probability space. The random vectorX=(X1,…,Xn) is the function X:Ω→Rn with components Xi, and its joint distributionPX is the pushforward probability measure on Rn. The joint cumulative distribution function of X is
FX(x)=P(X1≤x1,…,Xn≤xn)∀x∈Rn.
If every Xi is discrete then X is a discrete random vector with joint probability mass function
pX(x)=P(X1=x1,…,Xn=xn)
and X is a continuous random vector if there is a joint probability density functionfX:Rn→[0,∞) such that for every measurable A⊆Rn
P(X∈A)=∫AfX(x)dx.
The joint pmf sums to one over the state space and the joint pdf integrates to one over Rn. The marginal distribution of a component Xi is its own probability distribution and is recovered from the joint distribution by summing or integrating over the other components. For n=2 the marginal pmf and marginal pdf of X1 are
The random variables X1,…,Xn are mutually independent if and only if the joint cdf factorises as the product of the marginal cdfs for all x, and equivalently if and only if the joint pmf or pdf factorises as the product of the marginal pmfs or pdfs.
Let random variables X1 and X2 be defined on the probability spaces (S1,S1,PX1) and (S2,S2,PX2) respectively and with respect to a common underlying probability space (Ω,F,P). The random variable eventsX1∈A1 and X2∈A2 where A1∈S1 and A2∈S2 are associated with the events E1,E2∈F respectively:
PX1(X1∈A1)=P(E1)PX2(X2∈A2)=P(E2).
The joint random variable event is (X1∈A1,X2∈A2) and corresponds to the intersection of the associated sample space events E1∩E2. The bivariate probability distribution for the bivariate random vector (X1,X2) is a joint pushforward probability measure:
Let (X1,X2) be a discrete random vector and x2 be a value with pX2(x2)>0. The conditional pmf of X1 given X2=x2 is the conditional probability of the event X1=x1 given the event X2=x2.
pX1∣X2(x1∣x2)=pX2(x2)pX1,X2(x1,x2)
Let (X1,X2) be a continuous random vector and x2 be a value with fX2(x2)>0. The conditional pdf of X1 given X2=x2 is defined by the same ratio of densities, even though the event X2=x2 has probability zero.
fX1∣X2(x1∣x2)=fX2(x2)fX1,X2(x1,x2)
The conditional distribution of X1 given X2=x2 is the probability distribution with this pmf or pdf. Rearranging gives fX1,X2=fX1∣X2fX2, and X1 and X2 are independent if and only if the conditional distribution of X1 given X2=x2 equals the marginal distribution of X1 for every x2. Bayes’ theorem for densities follows in the same way as for events.
Let X be a random variable and g:R→R be a function. The transformationY=g(X) is a random variable whose distribution is determined by that of X through FY(y)=P(g(X)≤y). If X is discrete then
pY(y)=x:g(x)=y∑pX(x).
If X is continuous and g is strictly monotonic and differentiable on the support of X then the change of variables formula gives
fY(y)=fX(g−1(y))dydg−1(y).
If g is not monotonic the formula is applied separately on each interval where g is monotonic and the contributions are summed; for example Y=X2 has fY(y)=2y1(fX(y)+fX(−y)) for y>0. For a continuous random vector X and a bijection g:Rn→Rn that is continuously differentiable with continuously differentiable inverse, the change of variables theorem for multiple integrals gives
fY(y)=fX(g−1(y))detJg−1(y)
where Jg−1 is the Jacobian matrix of the inverse transformation.