random variable
Random variable
A random variable is a mathematical formalisation of a quantity or object which depends on random events. The term "random variable" does not refer to randomness or variability, but instead is a mathematical function in which the domain is the set of possible outcomes in a sample space (e.g. the set \[\left\{ H,T \right\}\] as the result from tossing a coin) and the range is a measurable space (say \[\left\{ -1,1 \right\}\], assuming we map heads to 1 and tails to -1).
Formally, a random variable is a measurable function. However, from a more philosophical perspective, there is a subjective difference between their underlying domains. A random variable operates on a set of outcomes of a random experiment or process. A measurable function generally does not. This isn't a mathematical difference, per-se, as the underlying domains are just sets, and the sigma-algebra and measures provide the relevant mathematical structure.
Definition
A random variable on a probability space \[(\Omega,\mathcal{F},P)\] is a function \[X:\Omega\to S\], where \[S\] is any set (although its a function, for historical reasons it's defined as \[X\], not \[f\] or \[g\]). In statistics, \[X\] is very often just defined as a measurable function from a probability space into the real numbers \[\mathbb{R}\] (i.e. the probabilities), i.e. a random variable is often a function that maps the outcome of a random experiment to a real number.
Although a random variable is defined as a function, we usually think of it as a variable that depends on the outcome \[\omega\in \Omega\]. In particular, we will often write \[X\] when we really mean \[X(\omega)\]. \[X(\omega)\] refers to the value of the random variable \[X\] at the event \[\omega\in \Omega\]; when flipping a coin, \[\Omega=\left\{ H,T \right\}\], assuming \[H=1\] and \[T=-1\], \[X(\omega)=\left\{ -1,1 \right\}\] with \[X(H)=1\] and \[X(T)=-1\], or when throwing two dices simultaneously, the sum of the results from both dice \[\Omega= \left\{ 1,2,3,4,5,6 \right\}\times \left\{ 1,2,3,4,5,6 \right\}\] and \[X(\Omega)=\left\{ 2,3,4,\dots,12 \right\}\] with \[X(\omega)=\alpha+\beta\] if \[\omega=\left( a,\beta \right)\].
To truly understand what \[X\] actually is, take a simple model of a coin flip. \[\Omega=\left\{ \text{Heads},\text{Tails} \right\}\], then \[X\] is what maps the actual physical outcome to say \[\left\{ 1,0 \right\}\], i.e. \[X(\omega)=\begin{cases}1\quad\text{if the outcome is Heads}\\0\quad\text{if the outcome is Tails}\end{cases}\]. We could also define \[\Omega=\left\{ 1,0 \right\}\], then \[X\] would just be mapping \[X(0)=0\] and \[X(1)=1\], and we would just lose any extra physical detail, which is often unnecessary for a single Bernoulli trial. It is even possible to define \[\Omega\] to contain many different sorts of trajectories and initial conditions to get a head or a tail, and \[X\] would just be a many to one map that maps all of those to either a one or a zero.
Assuming \[X\] is a real-valued random variable, then the probability that \[X\] has values smaller than three from a fair six-sided die toss, \[P(X\le3)\] would refer to \[P(\left\{ \omega\in\Omega\mid X(\omega)\le3 \right\})\]. Similarly, if we were to write \[P(X=2)\], that would refer to \[P(\left\{ \omega\in \Omega\mid X(\omega)=2 \right\})\]. However, we often ignore \[\Omega\], so it's unnecessary to write it in such a rigorous manner.
Additionally, when we write \[x=X(\omega)\] where \[\omega\in \Omega\], \[x\] is known as the realization of \[X\]. In simple words, the realization of a random variable is the value of what actually happened.
Distribution of a random variable
The distribution of a random variable \[X:\Omega\to S\] is the probability measure \[P_{x}\] on \[S\] defined by \[P_{x}(T)=P(X\in T)\] for any measurable set \[T\subset S\]. The expression \[P(X\in T)\] in the definition refers to the probability of the event \[X^{-1}(T)\].
It is to note that the cumulative distribution function always exists for any given distribution, and is given as \[F_{X}(x)=P(X\le X)=P_{X}(\left(-\infty, x\right])\].
Support of a random variable
Formally, the support of a random variable \[X\] can be defined as the smallest closed set \[\mathcal{X}\in \mathcal{R}\] (sometimes denoted as \[R_{X}\]) such that \[P(X\in\mathcal{X})=1\]. While there are many sets, call it \[C\], that yield \[P(X\in C)=1\], we look for the one specific set that is contained within all these possible sets. In other words, \[\mathcal{X}\] is the smallest (or most minimal) set that still yields \[P(X\in\mathcal{X})=1\].