Random Variables
Random Variables
Random Variables
Definition: The probability mass function of a discrete variable is a, table, formula or graph
that specifies the proportion (or probabilities) associated with each possible value the random
variable can take. The mass function P(X x) (or just p(x) has the following properties:
0 p(x) 1 and p(x) 1
all x
More generally, let X have the following properties
i) It is a discrete variable that can only assume values x1 , x2 , .... xn
70
ii) The probabilities associated with these values are P( X x1 ) p1 , P( X x2 ) p2 …….
P ( X xn ) p n
n
Then X is a discrete random variable if 0 pi 1 and p
i 1
i 1
Remark: We denote random variables with capital letters while realized or particular values
are denoted by lower case letters.
Example 1
Two tetrahedral dice are rolled together once and the sum of the scores facing down was
noted. Find the pmf of the random variable ‘the sum of the scores facing down.’
Solution
+ 1 2 3 4 x 2 3 4 5 6 7 8
1 2 3 4 5 1 1 3 1 3 1 1
P(X=x) 16 8 16 4 16 8 16
2 3 4 5 6 This can also be written as a function
3 4 5 6 7 x161 for x 2 , 3, 4 , 5
4 5 6 7 8 P ( X x ) 9 x
X = 1, 2, 3, 4 , 5 , 6 , 7 , 8 16 for x 6 , 7, 8
Therefore the pmf is given by the table below
Example 2
The pmf of a discrete random variable W is given by the table below
w -3 -2 -1 0 1
P(W=w) 0.1 0.25 0.3 0.15 d
Find the value of the constant d, P 3 w 0 , Pw -1 and P 1 w 1
Solution
p(W w) 1 0.1 0.25 0.3 0.15 d 1 d 0.2
all w
Example 3
A discrete random variable Y has a pmf given by the table below
y 0 1 2 3 4
P(Y=y) c 2c 5c 10c 17c
Find the value of the constant c hence computes P1 Y 3
Solution
p(Y y) 1 c(1 2 5 10 17) 1 c 351
ally
71
4. The pmf of a discrete random variable X is given by P( X x ) kx for x 1, 2 , 3, 4 , 5 , 6
Find the value of the constant k, P X 4 and P3 X 6
5. A fair coin is flip until a head appears. Let N represent the number of tosses required to
realize a head. Find the pmf of N c , PN 2 and PN 2
6. A discrete random variable Y has a pmf given by P(Y y ) c 34 x for y 0 ,1, 2 , .....
Find the value of the constant c , PX 3 and PX 3
2x
7. Verify that f(x) for y 0 ,1, 2 , .....k can serve as a pmf of a random variable X.
k (k 1)
8. For each of the following determine c so that the function can serve as a pmf of a random
variable X.
a. f(x) c for x 1, 2 , 3 , 4 , 5 f. f(x) ( x cx 1) for x 1, 2 , 3 , 4 , 5
2
d. f(x) 2c for x 1, 0, 1, 2
i. f(x) c 16 x for x 0 ,1, 2 , 3.....
( x 2)
e. f(x) c for x 1, 2 , 3 , 4 , 5 x
j. f(x) c2 for x for x 0 ,1, 2 , ....
72
b
i) f(x) 0 for all x , ii) pa x b f(x) dx 1 and iii) f(x) dx 1
a -
The support of a continuous random variable is the smallest interval containing all values of x
where f(x) >= 0.
Remark A crucial property is that, for any real number x, we have P(X x) 0 (implying
there is no difference between P(X x) and P(X x) ); that is it is not possible to talk about
the probability of the random variable assuming a particular value. Instead, we talk about the
probability of the random variable assuming a value within a given interval. The probability
of the random variable assuming a value within some given interval from x a to x b is
defined to be the area under the graph of the probability density function between
x a and x b .
Example
Let X be a continuous random variable. Show that the function
1 x, 0 x 2
f(x) 2 is a pdf of X hence compute P0 X 1 and P 1 X 1
0, elsewhere
Solution
2
2
x2
f(x) 0 for all x in the interval 0 x 2 and
0
1
2 xdx 1 . Therefore f(x)is indeed a
4 0
pdf of X.
1
1
x2 1
Now P0 X 1 xdx
1
2 and
0 0
4 4
P 1 X 1 P 1 X 0 P0 X 1 0 14 1
4
Exercise
cx, 0 x 1
1) Suppose that the random variable X has p.d.f. given by f(x) Find the
0, elsewhere
value of the constant c hence determine m so that PX m 12
x k, 0 x 3
2) Let X be a continuous random variable with pdf f(x) 5 Find the value
0, elsewhere
of the constant k hence compute P1 X 3
k (1 y ), 4 x 7
3) 2. A continuous random variable Y has the pdf given by f(y) Find
0, elsewhere
the value of the constant k hence compute PY 5 and P5 Y 6
k (1 x) 2 , 2 x 0
4) 3. A continuous random variable X has the pdf given by f(x) 4k 0 x 43
0, elsewhere
Find the value of the constant k hence compute P X 1 and P 1 X 1
73
kx, 0 x 2
5) 4. A continuous random variable X has the pdf given by f(x) k 4 x 2 x 4
0 , elsewhere
Find the value of the constant k hence compute P X 3 and P1 X 3
Reminder If the c.d.f. of X is F(x) and the p.d.f. is f(x), then differentiate F(x) to get f(x), and
integrate f(x) to get F(x);
Theorem: For any random variable X and real values a < b, Pa X b F(b) - F(a)
Example 1
1
1 x for x 1, 2 , 3 , 4 , 5
Let X be a discrete random variable with pmf given by f(x) 20 .
0 , elsewhere
Determine the cdf of X hence compute P X 3
Solution
x x
F(x) f(t) 1
20 (x 1) 1
20 (2 3 .... x) 1
20 2x 4 x 1 x( 40x3)
t t 1
0 for x 1
x 3)
F(x) x ( 40 for x 1, 2 , 3 , 4 , 5 Recall for an AP S n n
2 2a n 1d
1 for x 5
P X 3 1 P X 3 1
3(6) 11
40 20
Example 2
12 x, 0 x 2
Suppose is a continuous random variable whose pdf f(x) is given by f(x) .
0, elsewhere
Obtain the cdf of X hence compute P X 23
74
Solution
2 x
0, x 0
x x
t x 2
2
F(x) f(t)dt 12 tdt thus F(x) x4 , 0 x 2
- 0 4 0 4 1, x 2
P X 3 1 P X 3 1 4 3 9
2 2 1 2 2 8
Exercise
C , 0 x 4
1. The pdf of a continuous random variable X is given by f(x) x Find the
0, elsewhere
value of the constant C, the cdf of X and P X 1
kx(1 x), 0 x 1
2. The pdf of a random variable X is given by g(x) Find the value of the
0, elsewhere
constant k, the cdf of X and the value of m such that G(x) 12
3. Find the cdf of a random variable Y whose pdf is given by;
1 , 0 x 1
x 2 , 0 x 1
3 1 , 1 x 2
1 2
a) f(x) 3 , 2 x 4 b) f(x) (3 x )
0, elsewhere 2, 2 x3
0, elsewhere
9
4. If the cdf of a random variable Y is given by F(x) 1 2 for Y 3 and F(x) 0 for Y 3 ,
y
find P X 5 , P X 8 and the pdf of X.
Similarly for a continuous random variable X with pdf f(x), Eg(x) g(x) f( x)dx.
Theorem: Let X be a discrete r.v. with probability function p(x). Then
(i) E(c) = c, where c is any real constant;
75
(ii) Eax b a b where a and b are constants
(iii) Ekg(x) kEg(x) where g(x) is a real-valued function of X
n n
(iv) Eag1 (x) bg 2 (x) aEg1 (x) bEg 2 (x) and in general E cig i (x) ci Eg i (x)
i 1 i 1
where gi' s (x) are real-valued functions of X.
This property of expectation is called linearity property
Remark: This theorem will also hold for a continuous random variable but we need to
replace all the summation signs with integral signs.
Proof
(i) Ec cP( X x) c P( X x) c(1) c
all x all x
(iv) Eag1 (x) bg 2 (x) Eag1 (x) Ebg 2 (x) aEg1 (x) bEg 2 (x) from part iii
Remark
(i) The expected value of X always lies between the smallest and largest values of X.
(ii) In computations, bear in mind that variance cannot be negative!
Example 1
Given a probability distribution of X as below, find the mean and standard deviation of X.
x 0 1 2 3
P(X=x) 1/8 1/4 3/8 1/4
Solution
3
x 0 1 2 3 total E ( X ) xp( X x) 1.75 and
p ( X x) 1
8
1
4
3
8
1
4 1 x 0
xp( X x) 0 1
4
3
4
3
4
7
4
standard deviation
x p ( X x)
2
0 1
4
3
2
9
4 4 E ( X 2 ) 2 4 1.752 0.968246
76
Example 2
The probability distribution of a r.v X is as shown below, find the mean and standard
deviation of; a) X b) Y 12 X 6 .
x 0 1 2
P(X=x) 1/6 1/2 1/3
Solution
2
x 0 1 2 total E ( X ) xp( X x) 7 6 and
p ( X x) 1
6
1
2
1
3 1 x 0
xp( X x) 2
1 2 7
0 2 3 6
E ( X 2 ) x 2 p( X x) 11 6
x 2 p ( X x) 0 1
2
4
3
11
6 x 0
Standard deviation E ( X ) 2 2 11
6 (7 6) 2 17
6 1.6833
Now E (Y ) 12E( X ) 6 12(7 6 ) 6 20
Var (Y ) Var (12 X 6) 12 2 Var ( X ) 144 17
6 242.38812
Example 3
1 x, 0 x 2
A continuous random variable X has a pdf given by f(x) 2 , find the mean
0, elsewhere
and standard of X
Solution
2 2
2
x3 4
2
x4
E(x) xf( x)dx 1
2
x dx and E(x 2 ) x 2f( x)dx 12 x3dx 2
2
0 6 0 3 0 8 0
Standard deviation E ( X 2 ) 2 2 ( 4 3 )2 32
Exercise
1. Suppose X has a probability mass 2. Suppose X has a probability mass
function given by the table below function given by the table below
x 2 3 4 5 6 x 11 12 13 14 15
P(X=x) 0.01 0.25 0.4 0.3 0.04 P(X=x) 0.4 0.2 0.2 0.1 0.1
Find the mean and variance of; X Find the mean and variance of; X
3. Let X be a random variable with P(X = 1) = 0.2, P(X = 2) = 0.3, and P(X = 3) = 0.5. What is the
expected value and standard deviation of; a)X b) Y 5 X 10 ?
4. A random variable W has the probability distribution shown below,
w 0 1 2 3
P(W=w) 2d 0.3 d 0.1
Find the values of the constant d hence determine the mean and variance of W. Also find
the mean and variance of Y 10 X 25
5. A random variable X has the probability distribution shown below,
x 1 2 3 4 5
P(X=x) 7c 5c 4c 3c c
Find the values of the constant c hence determine the mean and variance of X.
6. The random variable Z has the probability distribution shown below,
z 2 3 5 7 11
1 1 1
P(Z=z) 6 3 4 x y
77
If E ( Z ) 4 23 , find the values of x and y hence determine the variance of Z
36m , m 1, 2 , 3 , ...,8
7. A discrete random variable M has the probability distribution f(m) ,
0 , elsewhere
find the mean and variance of M
510 y , y 1, 2 , 3 , 4
8. For a discrete random variable Y the probability distribution is f(y) ,
0 , elsewhere
calculate E(Y ) and var(Y)
kx for x 1, 2 , 3 , 4
9. Suppose X has a pmf given by f(x) , find the value of the constant k
0 , elsewhere
hence obtain the mean and variance of X
10. A team of 3 is to be chosen from 4 girl and 6 boys. If X is the number of girls in the team,
find the probability distribution of X hence determine the mean and variance of X
11. A fair six sided die has; ‘1’ on one face, ‘2’ on two of it’s faces and ‘3’ on the remaining
three faces. The die is rolled twice. If T is the total score write down the probability
distribution of T hence determine;
a) the probability that T is more than 4 b) the mean and variance of T
kr for 0 r 4
12. The pdf of a continuous r.v R is given by f(r) , (a) Determine c. hence
0 , elsewhere
Compute P(1 0 r 2) , E(X) and Var(X).
k (1 10m ) for M 10
13. A continuous r.v M has the pdf given by f(m) , find the value of
0 , elsewhere
the constant k, the mean and the variance of X
k (1 x) for 0 x 1
14. A continuous r.v X has the pdf given by f(x) , findt the value of
0 , elsewhere
the constant k. Also find the mean and the variance of X
d 2 if x 1
15. The lifetime of new bus engines, T years, has continuous pdf f(t) t find the
0, if x 1
value of the constant d hence determine the mean and standard deviation of T
16. An archer shoots an arrow at a target. The distance of the arrow from the centre of the
k (3 + 2x - x 2 ) if x 3
target is a random variable X whose p.d.f. is given by f(x) find
0 , i f x 3
the value of the constant k. Also find the mean and standard deviation of X
k (1 x) , 1 x 0
17. A continuous r.v X has the pdf given by f(x) 2k (1 x), 0 x 1 , find the value of the
0 , elsewhere
constant k. Also find the mean and the variance of X
e x for x 0
18. A continuous r.v X has the pdf given by f(x) , find the mean and
0 , elsewhere
3x
standard deviation of; a) X b) Y e 4
78