A random variable is a formal mapping function from the sample space of an experiment to the set of real numbers.
It allows analysts to apply calculus, algebra, and numerical summaries to outcomes that originate as qualitative events.
In standard notation, capital letters like X denote the random variable itself, while lowercase letters like x denote specific values.
Random variables are categorised broadly into discrete and continuous types depending on the nature of their possible values.
Discrete random variables take values from a countable set, which can be finite or countably infinite.
Examples of discrete random variables include the number of defective parts in a shipment or website visits per hour.
Continuous random variables take values from an uncountable continuum, typically spanning real numerical intervals.
Examples of continuous random variables include customer transaction amounts, waiting times, and sensor voltages.
Mixed random variables combine discrete point masses with continuous intervals, such as insurance claims that are zero with positive probability.
Functions of random variables, such as squaring a variable or taking its logarithm, create new random variables with altered distributions.
The cumulative distribution function defines the probability that a random variable takes a value less than or equal to a given number.
Every valid random variable possesses a unique cumulative distribution function that is non-decreasing and bounded between zero and one.
Joint random variables describe multidimensional observations where multiple characteristics are recorded simultaneously on each subject.
In machine learning, feature vectors and target labels are treated formally as collections of joint random variables.
A common error is treating a random variable as a single static number rather than as a function across an entire sample space.