Random Variables
&
Probability Distributions
Mathematical Sciences Department
Outcomes
1. Define a Random Variable - RV
2. Described Types of RVs
3. Defined a Probability Distribution - PD
Random Variables & Probability
4. State the Conditions of a PD
5. Calculate the Expectation & Variance of a PD
Distributions
6. Describe the properties of the Expectation of a PD
Random Variable
Toss two coins:
Sample Space:
S = {HH, HT, TH, TT}
Random Variables & Probability
Now, let X = Number of heads obtained
Distributions
Sample point HH HT TH TT
Assigned X value 2 1 1 0
Mapping: HH
0 X : S 0,1, 2
HT
TH 1
2 Random
TT Variable
Random Variable cont…
Dfn:
A random variable is a function that associates each element
in a sample space with a real number i.e.
Random Variables & Probability
A r.v. is a function defined on a sample space that associates
real numbers to outcomes of an experiment.
A r.v. is a numerically valued function defined on a sample
Distributions
space and its value is determined by chance.
Notation:
X denotes the random variable (or any upper case letter)
x denotes a value assumed by the rv (i.e. corresponding
lower case letter)
Example
Let X be a r.v. representing the number of times the letter ‘e’
appears in a name. Evaluate x for each of the following names:
Mercy, Leshole, Hyacinta,
Random Variables & Probability
Rebeccah, Dumisan, and Subeda.
Distributions
Solution:
Name Mercy Leshole Hyacinta Rebeccah Dumisan Subeda
X=x 1 2 0 2 0 1
Types of Random Variables
Discrete R.V.:
A r.v. whose set of possible values is finite, x x1 , x2 , ..., xn
Values are obtained by counting and are clearly separate
Random Variables & Probability
E.g. number of children in a family, number of employees in a
department, number of defective items…
Continuous R.V.:
Distributions
A r.v. whose set of possible values is infinite i.e. values in a
continuous interval,
Values are obtained by measuring
E.g. height, salary, age, time taken to serve a customer,
temperature…
Discrete Probability Distribution
Recall the tossing of two coins:
Represent the distribution of X=x on a frequency distribution:
Random Variables & Probability
X=x 0 1 2
Frequency, f 1 2 1
Probabilities
Relative freq, r.f. 1/4 1/2 1/4
Distributions
The possible values of X with their probabilities are:
X=x 0 1 2
P(X=x) ¼ ½ ¼
Probability
Distribution
Probability Distribution
Dfn: Properties of a PD:
The probability distribution A function f(x) is a PD of a
of a discrete rv is a listing of discrete rv X if:
Random Variables & Probability
all possible values of the rv, Probability of each outcome
x, and their corresponding lies between 0 and 1
probabilities.
Distributions
0 f ( x) 1 or 0 P ( X x) 1
A probability distribution The sum of the probabilities
of all the individual
can be presented as a outcomes in the sample
table, a function, graph or space is 1
statement … f ( x) 1
x
Example
State whether each of these is a PD:
a) X=x 0 1 2
Yes
P(X=x) ¼ ½ ¼
Random Variables & Probability
b) Y=y 15 20 23 25 30
Yes
Distributions
f(y) 0.12 0.2 0.08 0.1 0.
5
c)
Weekly demand, X (ton) 5 12 14 17 19
No
f(x) 0.2 0.5 -0.2 0.25 0.25
Activity
a) Construct a PD table for the number of heads observed when
three fair coins are tossed. Y=y 0 1 2 3
f(y) 1/8 3/8 3/8 1/8
Random Variables & Probability
b) The MUBAS EDO’s office reported the following information for
a sample of 250 cars parked on campus. Convert the table to a PD.
Distributions
Number of days parked 1 2 3 4 5 6 7 8
Frequency (cars) 20 38 53 45 40 13 5 36
X=x 1 2 3 4 5 6 7 8
f(x) 0.08 0.152 0.212 0.18 0.16 0.052 0.02 0.144
Mean or Expectation of a Discrete RV
What are
Recall the tossing of 3 coins: Review these?
1 3 3 1
x 0 1 2 3
X=x 0 1 2 3 8 8 8 8
Random Variables & Probability
f 1 3 3 1
Probabili
Find the mean of the ties
Distributions
distribution. Ans: 1.5 X=x 0 1 2 3
Mean: f(x) 1/8 3/8 3/8 1/8
x
fx
0 1 1 3 2 3 3 1
f 8 x xf x
x
Expectati
1 3 3 1
0 1 2 3 on of x
8 8 8 8
1.5
Expectation
Dfn:
If X is a discrete r.v. with probability distribution or probability
mass function f(x), then the expectation or expected value of
Random Variables & Probability
x is
E X xf x Alternative presentation
x
X E X xf x
Distributions
x
n
X E X xi f xi
i 1
Variance and Standard Deviation
Dfn:
If X is a discrete r.v. with probability distribution or probability
mass function f(x), then the variance of x is
Random Variables & Probability
2
Recall from sem 1
Var X x f x xf x
2
2
x x fx 2
fx
Distributions
2
f
f
E X E X 2 X 2
2
Var X E X 2
xf x
NB: Var X X 2 x
Std Deviation, X Var X f x
x
x
2
f(x) = Probability
of x
Example
A random variable X has the following probability distribution
X 3 5 6 8
P(X = x) 0.4 0.5 0.03 0.07
Random Variables & Probability
Find:
Distributions
a) P(X = 6)
b) P(X > 5)
c) Var(X)
Solution X 3 5 6 8
a) P(X = 6)):
P(X = x) 0.4 0.5 0.03 0.07
P X 6 0.03
b) P(X > 5):
xP x 1.2 2.5 0.18 0.56
x2 P x
Random Variables & Probability
3.6 12.5 1.08 4.48
P ( X 5) P (6) P(8)
0.03 0.07 E X 1.2 2.5 0.18 0.56
Distributions
0.1 4.44
c) Var(X): E X 2 3.6 12.5 1.08 4.48
Var X E X 2 E X
2
21.66
E X xP x Var X 21.66 4.442
1.9464
E X 2 x P x
2
Example
A discrete r.v. Y has a pmf defined as
0.2, y 0
0.3, y 1
f y
Random Variables & Probability
0.1, 2 y 6
0, Otherwise
Distributions
Find:
a) f(5)
b) f(y < 4)
c) f(3 < y < 10)
d) E(Y) and Var(Y)
0.2, y 0
Solution 0.3,
y 1
f y
a) f(5): 0.1, 2 y 6
0, Otherwise
f 5 0.1
b) f(y < 4):
Random Variables & Probability
3
f ( y 4) f ( y ) f (0) f (1) f (2) f (3)
y 0
0.2 0.3 2 0.1
Distributions
0.7
c) f(3<y<10):
9 6
f 3 y 10 f y f y f 4 f 5 f 6
y 4 y 4
3 0.1 0.3
0.2, y 0
Solution cont… 0.3,
y 1
f y
d) E(Y) & Var(Y): 0.1, 2 y 6
0, Otherwise
E Y yf ( y )
Random Variables & Probability
y
Y=y 0 1 2 3 4 5 6
f(y) 0.2 0.3 0.1 0.1 0.1 0.1 0.1 Total
Distributions
yf ( y ) 0 0.3 0.2 0.3 0.4 0.5 0.6 2.3 E Y 2.3
y 2 f ( y) 0 0.3 0.4 0.9 1.6 2.5 3.6 9.3
Var y y 2 f ( y ) E 2 y
y
9.3 2.32
4.01 NB : Std Dev, Y = Var y 4.01 2.0025
Example
You are given K800,000 to invest.
You must choose between:
Random Variables & Probability
a) a sure gain of K400,000 and
b) a 0.4 chance of a gain of
K800,000 and a 0.6 chance to
Distributions
gain nothing.
What is the expected gain for each
strategy?
Solution
Let X be the r.v. representing gain
To find Expectation i.e. E(X)
Strategy a):
Random Variables & Probability
One possible gain: K400,000 with P(x) = 1 (i.e. sure gain)
E X xP ( x) 400, 000 1 K 400, 000
Distributions
x
Strategy b):
Two possible gains: K800,000 with P(x) = 0.4 & K0 with
P(x) = 0.6
X=x K800,000 K0
E X xP ( x) 800, 000 0.4 0 0.6
x P(x) 0.4 0.6
K 320, 000
Activity
1. Phillip bought 2 raffle draw tickets at K5,000 each. If a total of
210 tickets are sold and the only prize is dinner for two at Max
& Sherry valued at K50,000;
Random Variables & Probability
a) Construct a probability distribution for the gain, X.
b) Calculate Phillip’s expected gain. -K9,523.81
Distributions
2. X is a discrete r.v. whose pmf is defined as
f ( x) 5C x 0.4 x 0.65 x , where x 0,1, 2,3, 4,5
Find:
a) f 3 b) X c) X
a) 0.2304 b) 2 c) 1.0954
Probability Distribution for Continuous RV
Dfn:
The probability distribution of a continuous rv is a function f(x)
such that
Random Variables & Probability
1) 0 f (a x b) 1 0 f x dx 1
a
Distributions
2) f ( x ) 1 f x dx 1
Example
A continuous rv X has a probability density function (pdf)
defined as
0.125, 0 x 8
Random Variables & Probability
f x
0, Otherwise
Distributions
a) Show that satisfies the second condition for PDs.
b) Find
0.125, 0 x 8
Solution f x
0, Otherwise
a) Show that condition 2 for PDs holds: f(x) = 0 f(x) = 0.125 f(x) = 0
f x 1 - 0 8 ∞
0 0
Random Variables & Probability
Since X is 0 8
cont, use
integration
f x dx
f x dx f x dx f x dx
0 8
Distributions
8
f x dx
0
8
0.125dx
0
0.125x 0 0.125 8 0.125 0 1
8
0.125, 0 x 8
Solution cont… f x
0, Otherwise
b) :
6 6
f x dx 0.125dx
Random Variables & Probability
3 3
6
0.125x 3
Distributions
0.125 6 0.125 3
0.375
Expectation and Variance
Dfn:
If X is a continuous rv with a pdf f(x), then:
Random Variables & Probability
1) The expectation of X is
E X xf x dx
Distributions
2) The variance of X is
2
Var X x f x dx xf x dx
2
E X
2
Var X E X 2
Activity
A continuous r.v. X has a probability density function (pdf)
defined as
0.125, 0 x 8
Random Variables & Probability
f x
0, Otherwise
Distributions
Find
a) E(X) a) 4
b) b) 2.3094
Activity
In commuting to campus, a student first gets a Kabanza near her
house and then transfers to a minibus. If the total waiting time (in
minutes) for the Kabanza and minibus is a r.v. X with the pdf:
0.04 x, 0 x 5
Random Variables & Probability
f x 0.4 0.04 x, 5 x 10
0, Otherwise
Distributions
Find the probability that the total waiting time is
a) less than 3 minutes.
b) at most 8 minutes.
c) between 3 and 8 minutes.
d) either less than 2 minutes or more than 6 minutes.
Thank You.