Skip to content
Glacius
ProbabilityConcept reference

Random variables

A random variable is a real-valued function on the sample space.

On this page 7 sections
  1. Overview
  2. A random variable assigns a number to every possible outcome of an experiment
  3. An outcome can be a whole record
  4. The letter X names the rule; a lowercase x often names one possible value
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01A random variable assigns a number to every possible outcome of an experiment#

A random variable assigns a number to every possible outcome of an experiment. The rule is fixed; the outcome determines which assigned number you observe.

Schematic map on outcomes A,B,C. X(A)=2, X(B)=5, X(C)=2. A and C have the same score. Horizontal position encodes no distance.Schematic map on outcomes A,B,C. X(A)=2, X(B)=5, X(C)=2. A and C have the same score. Horizontal position encodes no distance.
Figure 1Schematic map on outcomes A,B,C. X(A)=2, X(B)=5, X(C)=2. A and C have the same score. Horizontal position encodes no distance.
Link to this figure ↗Download SVGDownload PNG

Here X(A)=2X(A)=2, X(B)=5X(B)=5, and X(C)=2X(C)=2. Before observing the outcome, XX is the whole mapping. If outcome BB occurs, the realized value is 55.

The possible numerical values are 2 and 5. Repeated outputs are allowed.

Check your reasoning

Outcomes: (2,1,4)(-2, 1, 4). X(s)=s2X(s)=s^2. Give outputs in this order.

  1. A(2,1,4)(-2, 1, 4)
  2. B(4,1,16)(-4, 1, 16)
  3. C(4,1,16)(4, 1, 16)
Show answer and explanation
(4,1,16)(4, 1, 16)

Squares: (4,1,16)(4, 1, 16).

02An outcome can be a whole record#

An outcome can be a whole record. Choosing one numerical field, such as its score, defines a random variable on those records.

Specify one number for every outcome. The mapping does not need to assign different numbers to different outcomes.

Check your reasoning

Records A, B, C have scores 33, 00, 33, respectively. Define XX as the score. Give (X(A),X(B),X(C))(X(A),X(B),X(C)).

  1. A(3,0,3)(3, 0, 3)
  2. B(3)(3)
  3. C(0,3,3)(0, 3, 3)
Show answer and explanation
(3,0,3)(3, 0, 3)

Scores: (3,0,3)(3, 0, 3).

03The letter X names the rule; a lowercase x often names one possible value#

The letter XX names the rule; a lowercase xx often names one possible value. A single observed number does not specify the whole random variable.

To check a proposed map, go through the entire sample space and apply the stated rule to each outcome.

Check your reasoning

Outcomes: (4,1,2)(-4,1,2). X(s)=s2X(s)=s^2. A map gives X(4)=16X(-4)=-16. Repair its output triple.

  1. A(4,1,2)(-4, 1, 2)
  2. B(16,1,4)(16, 1, 4)
  3. C(16,1,4)(-16, 1, 4)
Show answer and explanation
(16,1,4)(16, 1, 4)

Squares: (16,1,4)(16, 1, 4).

Key takeaway

Define one numerical value for every outcome; a realized value is only one result of that map.

  • Define a numerical random variable on a finite sample space.

Sources & further reading

  1. [1]
    Pishro-Nik, Introduction to Probability: Random VariablesPishro-Nik: Introduction to Probability · Article

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Random variables.” Math behind ML. /learn/p-random-variable