Probability, Statistics and
Information
2024 - 2025 Fall
Course Objective: This course aims to teach
concepts and ideas about statistics and
probability, to establish meaningful relationships
between these concepts and ideas, and to
develop statistical thinking and reasoning skills.
Chapter 3
Random
Variables and
Probability
Distributions
Copyright © 2017 Pearson Education, Ltd. All rights reserved.
Section 3.1
Concept of a
Random Variable
Copyright © 2017 Pearson Education, Ltd. All rights reserved.
2-4
Definition of a Random Variable
• A random variable assigns a numerical value to each
outcome in a sample space.
• Random variables are ways to map outcomes of
random processes to real numbers.
• Let’s quantify the outcomes when you flip a coin:
X=0 if Head
S Real number
X=1 if Tail TT 0
• Y: total number of Heads HT 1
TH 1
HH 2
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-5
Definition of a Random Variable
• Random variable is a function that assigns each subset
of the sample space to a real-value.
• Notations:
− random variable X
− numerical value x
• 4 White 6 Black balls in a box. Two balls are selected.
S={WW, WB, BW, BB}
S Real number
X: number of black balls WW 0
WB 1
BW 1
BB 2
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-6
Definition of a Random Variable
• A random variable assigns a numerical value to each
outcome in a sample space.
• Several random variables can be defined on the same
sample space
– X: the weight of a newborn baby (kg)
– Y: the length of a newborn baby (cm)
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-7
Definition of a Random Variable
• Functions of random variables are also random
variables
– Y: the weight of a newborn baby (kg)
– Y=4.25 kg
– Z: the weight of a newborn baby (gr)
– Z=4250 gr
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-8
Definition of a Random Variable
• Mathematically; a random variable is a function from sample
space to real numbers.
– X: the number of defective products
– X: the number of COVID-19 cases in Turkey
– X: the number of deaths in Turkey
– Y:the weight of a newborn baby
– Y: proportion of the defective products in a production line
– Y: duration of quarantine because of the pandemic
• Random variables are classified into two groups:
– discrete
– continuous
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-9
Discrete Random Variables
Definition: A random variable is discrete if its
possible values form a discrete set. This means
that if the possible values are arranged in order
and there is a gap between each value and the
next one.
The set of possible values may be infinite; for
example, the set of all integers is a discrete set.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-10
Example
‘‘Tossing a coin five times’’ is a random experiment
and the sample space can be written as:
S = {TTTTT, TTTTH,...,HHHHH}
Note that here the sample space S has 25=32 outcomes.
Suppose that in this experiment, we are interested in the
number of heads (H). We can define a random variable
X whose value is the number of observed heads (H) in
each of the outcome.
The value of X will be one of 0, 1, 2, 3, 4 or 5
depending on the outcome of the random experiment.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-11
Example (Continued)
In the random experiment of ‘‘Tossing a coin five times’’, the
random variable X (whose value is the number of observed
heads) assigns:
• the value 0 to the outcome TTTTT,
• the value 1 to the outcome HTTTT, and so on till the value 5.
TTTTT X=0
HTTTT
THTTT
TTHTT X=1
TTTHT
TTTTH
Hence, the random variable X is a function that assigns a real number value to
an outcome (for this particular random variable, the values are always integers
between 0 and 5).
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-12
Range of Random Variables
‘‘A random variable is actually a real-valued function that
assigns a numerical value to each possible outcome of the
random experiment.’’
Since a random variable is a function, we can
talk about its range.
The range of a random variable X, (shown by
Range(X) or RX), is the set of possible values
for X.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-13
Example
Find the range for each of the following random
variables.
• I toss a coin 100 times. Let X be the number of heads
(H) I observe.
• I toss a coin until the first heads (H) appears. Let Y
be the total number of coin tosses.
• The random variable T is defined as the time (hours)
from now until the next earthquake occurs in a city.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-14
Example
Find the range for each of the following random
variables.
• I toss a coin 100 times. Let X be the number of heads
(H) I observe.
The random variable X can take any integer from 0 to 100, so RX ={0,1,2,...,100}.
• I toss a coin until the first heads (H) appears. Let Y
be the total number of coin tosses.
The random variable Y can take any positive integer, so RY ={1,2,3,...}.
• The random variable T is defined as the time (hours)
from now until the next earthquake occurs in a city.
The (continuous) random variable T can in theory get any positive real number, so
RT=[0, ∞).
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Section 3.2
Discrete
Probability
Distribution
Copyright © 2017 Pearson Education, Ltd. All rights reserved.
2-16
Probability Mass Function (pmf)
• The description of the possible values of X and
the probabilities of each has a name: the
probability mass function.
Definition: The probability mass function
(pmf) of a discrete random variable X is the
function:
f(x) = p(x) = P(X = x)
The probability mass function is sometimes
called the probability distribution.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-17
Definition 3.4
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-18
Example
Suppose that the possible values for X are {0, 1, 2, 3, 4}
and the probabilities for the possible values of X are:
Then the graph of the probability distribution will be:
p(x)
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-19
Cumulative Distribution Function
• The probability mass function specifies the
probability that a random variable is equal to a given
value.
• A function called the cumulative distribution
function (cdf) specifies the probability that a random
variable is less than or equal to a given value.
• The cumulative distribution function of the random
variable X is the function F(x) = P(X ≤ x).
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-20
Definition 3.5
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-21
Example
Recall the example of the number of flaws in a
randomly chosen piece of wire. The following is the
pmf: P(X = 0) = 0.48, P(X = 1) = 0.39, P(X = 2) = 0.12,
and P(X = 3) = 0.01.
For any value x, we compute F(x) by summing the
probabilities of all the possible values of x that are less
than or equal to x.
F(0) = P(X ≤ 0) = p(0) = 0.48
F(1) = P(X ≤ 1) = p(0) + p(1) = 0.48 + 0.39 = 0.87
F(2) = P(X ≤ 2) = 0.48 + 0.39 + 0.12 = 0.99
F(3) = P(X ≤ 3) = 0.48 + 0.39 + 0.12 + 0.01 = 1
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-22
Summary for Discrete Random Variables
Let X be a discrete random variable. Then
The probability mass function (pmf) of X is the
function f(x) = p(x) = P(X = x).
The cumulative distribution function (cdf) of X is the
function F(x) = P(X ≤ x).
F ( x) p(t ) P( X t ) .
t x t x
p( x) P( X x) 1 , where the sum is over all the
x x
possible values of X.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-23
PMF and CDF of a Discrete Random Variable
𝑃𝑀 𝐹
𝑝 ( 𝑥) F(x)
1
2/6
3/6
2/6 3/6
1/6
1/6
𝑥 𝑥
1 2 4 1 2 4
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-24
Summary for Discrete Random Variables
Let X be a discrete random variable. Then
The probability mass function (pmf) of X is the
function f(x) = p(x) = P(X = x).
The cumulative distribution function (cdf) of X is the
function F(x) = P(X ≤ x).
F ( x) p(t ) P( X t ) .
t x t x
p( x) P( X x) 1 , where the sum is over all the
x x
possible values of X.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-25
Summary
• Random variables: discrete and continuous
• Discrete random variables
– Probability mass function
– Cumulative distribution function of discrete
random variables
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Section 3.3
Continuous
Probability
Distributions
Copyright © 2017 Pearson Education, Ltd. All rights reserved.
2-27
Continuous Random Variables
• A continuous random variable may take any value in
a given interval.
• Examples:
– Y:the weight of a newborn baby
– Y: proportion of the defective products in a production line
– Y: duration of quarantine because of the pandemic
– Y: amout of sales in a month (in dollar value)
– Y: length of a conductor
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
3.3. Distributions of Continuous 2-28
Random Variables
• Since continuous random variable Y defined in
an interval, the probability of Y equals exactly
a specific value is zero.
• A random variable is continuous if its
probabilities are given by areas under a curve.
• The curve is called a probability density
function (pdf) for the random variable.
Sometimes the pdf is called the probability
distribution.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Distributions of Continuous 2-29
Random Variables
• The probability density function (pdf) for the
continuous random variable X is constructed so that
the area under its curve bounded by the x axis is
equal to 1 when computed over the range of X for
which f(x) is defined. The function f(x) is the
probability density function of X.
• Let X be a continuous random variable with
probability density function f(x). Then
f ( x)dx 1.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-30
Probability Density Function
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-31
Computing Probabilities
Let X be a continuous random variable with
probability density function f(x). Let a and b be
any two numbers, with a < b. Then b
P (a X b) P (a X b) P (a X b) f ( x)dx.
a
In addition,
a
P ( X a ) P ( X a ) f ( x)dx
P ( X a ) P ( X a ) f ( x)dx.
a
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-32
Example 3.11
b. P(0<X)=
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-33
Cumulative Distribution Function
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-34
Example 3.12
F(x)=
P(0<X)= F(1) - F(0)=
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Section 3.4
Joint Probability
Distributions
Copyright © 2017 Pearson Education, Ltd. All rights reserved.
Section 3.4. Joint Probability 2-36
Distributions
• In the previous section, we studied random variables
defined in one-dimensional sample space.
• We recorded the outcomes of an experiment as values
of a random variable.
• Sometimes we need to record more than one outcome
of a random experiment, simultaneously.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-37
Joint Random Variables-Examples
• Rolling two fair dice.
– (X,Y): outcomes of the first and the second die
• Hardness and tensile strength of cold-drawn copper
are measured.
– (H,T): Hardness and tensile strength of an item
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Joint Probability Distributions: 2-38
Discrete
• Let X and Y are jointly distributed discrete random
variables.
• The joint probability mass function of X and Y is
the function:
f ( x, y ) P ( X x , Y y )
• f(x,y) give the probability of the outcomes x and y
occur at the same time.
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
Jointly Distributed Discrete 2-39
Random Variables
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-40
Example 3.14
Two ballpoint pens are selected at random from
a box that contains 3 blue pens, 2 red pens, and 3
green pens. If X is the number of blue pens
selected and Y is the number of red pens
selected.
a) FindPthe joint probability
( X Y 1). function and show
it in a table,
b) Find
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-41
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.
2-42
Y=0 Y=1 Y=2 Row Total
X=0 3/28 6/28 1/28 10/28
X=1 9/28 6/28 0 15/28
X=2 3/28 0 0 3/28
Column Total 15/28 12/28 1/28 1
3 2 3
x y 2 x y
f ( x, y ) , x 0,1,2; y 0,1,2; 0 x y 2
8
2
McGraw-Hill ©2014 by The McGraw-Hill Companies, Inc. All rights reserved.