PROBABILITY AND RANDOM VARIABLES -
UNIT I
March 4, 2021
Continuous Random Variable 1/1
Continuous Random variables
A random variable X is said to be continuous if it
takes all possible values between certain limits from the Real
number 0 a0 to a real number 0 b0 .
Continuous Random Variable 2/1
Probabiltiy Density Function
For a Continuous random variable X, the probability
density function is a function such that
f (x) = 0
R∞
f (x)dx = 1
−∞
Cumulative distribution function
The cumulative distribution function of a continuous random
Rx
variable X is defined as F(x) = P(X ≤ x) = f (x)dx = 1
−∞
Continuous Random Variable 3/1
Mean or Expectation of a continuous random variable
The mean or expected value of X denoted by µ or
R∞
E(X) is E(X) = xf (x)dx
−∞
Variance of a continuous random variable
The variance of X denoted by V (X) or σ2 is
V (X) = σ2 = E[X2 ] − (E[X])2 .
Continuous Random Variable 4/1
Problem 1
A continuous random variable X has pdf f (x) = k, 0 < x < 1,
1
determine the constant k and hence find P(X ≤ )
4
R∞
Solution: We know that f (x)dx = 1
−∞
R1
kdx = 1
0
k x|10 = 1
⇒k=1
Continuous Random Variable 5/1
1
1 R4
Now, P(X ≤ )= f (x)dx
4 0
1
R4
= dx
0
1
= x|1/4
0 =
4
Continuous Random Variable 6/1
Problem 2
A random variable X has the probability density function f(x)
cxe−x , x ≥ 0
given by f (x) = Find the value of c and CDF of
0, elsewhere
X.
R∞
Solution: We know that f (x)dx = 1
−∞
R∞
f (x)dx = 1
0
R∞
cxe−x dx = 1
0
∞
c [−xe−x − e−x ]0 = 1
c(0 + 1) = 1
c=1
Continuous Random Variable 7/1
We know that the CDF is given by F(x) = P(X ≤ x)
Rx
P(X ≤ x) = f (x)dx
−∞
Rx
= xe−x dx
0
x
= [−xe−x + e−x ]0
= 1 − xe−x − e−x
Continuous Random Variable 8/1
Problem 3
A continuous
random variable X has the distribution function
0, x ≤1
F(x) = k(x − 1)4 , 1 < x ≤ 3 Find the value k, probability
0, x > 3
density function f (x) and P(X < 2).
d
Solution: we know that f (x) = [F(x)]
dx
d
f (x) = [k(x − 1)4 ] = 4k(x − 1)3
dx
0, x ≤ 1
Therefore, f (x) = 4k(x − 1)3 , 1 < x ≤ 3
0, x > 3
Continuous Random Variable 9/1
R∞
WKT f (x)dx = 1
−∞
R3
⇒ 4k(x − 1)3 dx = 1
1
3
(x − 1)3
⇒ 4k =1
4
1
⇒ 16k = 1
1
⇒k=
16
Continuous Random Variable 10/1
Problem 4
If the density function of a continuous random variable X is
ax, 0 ≤ x ≤ 1
a, 1 ≤ x ≤ 2
given by f (x) = Find the value of a and
3a − ax, 2 ≤ x ≤ 3
0, elsewhere
the CDF of X.
R∞
Solution: We know that f (x)dx = 1
−∞
Now we have the limits between 0 and 3, therefore,
R3
f (x)dx = 1
0
Continuous Random Variable 11/1
R1 R2 R3
⇒ axdx + adx + (3a − ax)dx = 1
0 1 2
1 3
x2 x2
2
⇒a + ax |1 + 3ax − a =1
2 0 2 2
a 9
⇒ + 2a − a + 9a − a − 6a + 2a = 1
2 2
1
⇒ 2a = 1 ⇒ a =
2
Continuous Random Variable 12/1
Now to find the CDF
If x < 0, the F(x) = 0
Rx Rx 1 1 x2 x x2
If 0 ≤ x ≤ 1, then F(x) = xdx =
axdx = |0 =
0 0 2 2 2 4
R1 Rx
If 1 ≤ x ≤ 2, then F(x) = axdx + adx
0 1
R1 1 Rx 1
= xdx + dx
0 2 1 2
1 x2 1 1 x 1 (x − 1)
= | + x| = + .
2 2 0 2 1 4 2
Continuous Random Variable 13/1
R1 R2 Rx
If 2 ≤ x ≤ 3, then F(x) = axdx + adx + (3a − ax)dx
0 1 2
R1 R2 Rx 3 1
= (1/2)xdx + (1/2)dx + ( − x)dx
0 2 2
1 2
x 2
1 1 3 1x
= + + x−
4 2 2 2 2 2
x 3 5
− + x−
4 2 4
R1 R2 R3 Rx
For x > 3, then F(x) = axdx + adx + (3a − ax)dx + 0dx
0 1 2 3
1 1 1
= + + +0 = 1
4 2 4
Continuous Random Variable 14/1
Problem 5
The diameter of an electric cable X is a continuous random
variable with PDF f (x) = kx(1 − x), 0 < x ≤ 1. (i) Find the
value of k. (ii) CDF of X (iii) the value of a such that
1 1 2
P(X < a) = P(X > a) (iv) P X ≤ / < X <
2 3 3
R∞
Solution: (i) WKT f (x)dx = 1
−∞
R1
k(x − x2 )dx = 1
0
1
x2 x3
k − =1
2 3 0
1
k =1⇒k=6
6
Continuous Random Variable 15/1
(ii) CDF F(x) = P(X ≤ x)
Rx
= 6(x − x2 )dx
0
x2 x3 x
=6 − |
2 3 0
= (3x2 − 2x3 )
Continuous Random Variable 16/1
(iii) P(X < a) = P(X > a)
Ra R1
6(x − x2 )dx = 6(x − x2 )dx
0 a
x2 x3 a
2
x3 1
x
6 − | =6 − |
2 3 0 2 3 a
3a2 − 2a3 = 3 − 2 − 3a2 + 2a3
6a2 − 4a3 − 1 = 0
1
Solving we have a =
2
Continuous Random Variable 17/1
1 1 2
P X≤ / <X<
2 3 3
1 1 2
P X≤ ∩ <X<
2 3 3
=
1 2
P <X<
3 3
1 1
P <X<
3 2
=
1 2
P <X<
3 3
Continuous Random Variable 18/1
1 1 1/2 13
P <X< = 3x2 − 2x3 1/3 =
3 2 54
1 2 2/3 13
= 3x2 − 2x3 1/3 =
P <X<
3 3 27
1 1 2 1
P X≤ / <X< =
2 3 3 2
Continuous Random Variable 19/1
Problem 6
xe−x2 /2 x≥0
If p(x) = .
0 x<0
(i) show that is a pdf (ii) find its distribution function.
R∞
Solution: (i) To prove f (x)dx = 1
−∞
R∞ R∞ 2 /2
Now f (x)dx = xe−x dx
−∞ 0
x2 dt
putting t = ⇒ dt = xdx ⇒ dx =
2 x
When x = 0, t = 0 and When x = ∞, t = ∞
Continuous Random Variable 20/1
Problem 6
R∞ R∞ 2 /2
Hence, f (x)dx = xe−x dx
−∞ 0
R∞
= e−t dt
0
∞
e−t
=
−1 0
= − e − ∞ − e0 = − ( 0 − 1 ) = 1
R∞ 2
⇒ xe−x /2 dx = 1
0
⇒ p(x) is a pdf of X.
Continuous Random Variable 21/1
Problem 6
(ii) Distribution function of X:
Rx
F (x) = P (X ≤ x) = f (x)dx
0
Rx −x2 /2
R∞ x2
= xe dx = e−t dt by putting t =
0 0 2
x x2
−
e−t
= −1 0 = 1−e 2
x2
−
⇒ F (x) = 1 − e 2 x≥0
Continuous Random Variable 22/1
Problem 7
A continuous random variable X that can assume any value
between x = 2 and x = 5 has a density function given by
f (x) = k (1 + x). Find P (X < 4). Solution: (i) WKT
R∞
f (x)dx = 1, X takes values between 2 and 5
−∞
R5
⇒ k (1 + x)dx = 1
2
5
x2
⇒ k x+ =1
2 2
52 22
⇒ k 5+ − 1+ =1
2 2
27
⇒ k=1
2
2
⇒k=
27
Continuous Random Variable 23/1
Problem 7
To find P (X < 4):
R4
P (X < 4) = k (1 + x)dx
2
4
x2
2
= x+
27 2 2
42 22
2 16
= 4+ − 1+ =
27 2 2 27
16
⇒ P (X < 4) =
27
Continuous Random Variable 24/1
Problem 8
A continuous random variable X has pdf f (x) = kx2 e−x x > 0.
Find k, mean and variance.
R∞ R∞
Solution: (i) WKT f (x)dx = 1, ⇒ kx2 e−x dx = 1
−∞ 0
2 ∞
e−x e−x e−x
⇒ k x2 − 2x +2 =1
(−1) (−1 (−1)3 0
∞
⇒ k −x2 e−x − 2xe−x − 2e−x 0 = 1
⇒ k (0 − 2) = 1 sin ce e−∞ = 1 and e0 = 1
⇒ 2k = 1
1
⇒k=
2
Continuous Random Variable 25/1
Problem 8
R∞
Mean E (X) = xf (x)dx
−∞
R∞ 1 R∞ 3 −x
E (X ) = xf (x)dx = x e dx
0 20
!∞
1 e−x e−x e−x e−x
= x3 − 3x2 + 6x − 6
2 (−1) (−1)2 (−1)3 (−1)4 0
1 ∞
= −x3 e−x − 3x2 e−x − 6xe−x − 6e−x 0
2
1
= − (0 − 6) sin ce e−∞ = 1 and e0 = 1
2
=3
⇒ E (X ) = 3
Continuous Random Variable 26/1
Problem 8
Var (X) = E X2 − [E (X)]2
R∞ 2
Where E X2 =
x f (x)dx
−∞
R∞ 1 R∞ 4 −x
X2 x2 f
E = (x)dx = x e dx
0 20
= !∞
1 4 e−x 3 e−x 2 e−x e−x e−x
x − 4x + 12x − 24x + 24
2 (−1) (−1)2 (−1)3 (−1)4 (−1)5 0
1 ∞
= −x4 e−x − 4x3 e−x − 12x2 e−x − 24xe−x − 24e−x 0
2
1
= − (0 − 24) sin ce e−∞ = 1 and e0 = 1
2
= 12 ⇒ E X2 = 12
Var (X) = E X2 − [E (X)]2
= 12 − 32 = 12 − 9 = 3 ⇒ Var (X) = 3
Continuous Random Variable 27/1
Problem 9
The distribution function of a random variable X is
F(x) = 1 − (1 + x)e−x x ≥ 0. Find the density function of X.
Also find the mean and variance of X
Solution:
Given the distribution function of a random variable X is
F(x) = 1 − (1 + x)e−x x ≥ 0.
d [F (X)]
we know that f (x) =
dx
⇒ f (x) = (1 + x)e−x − e−x = xe−x , x ≥ 0
Continuous Random Variable 28/1
Problem 9
R∞ R∞
E (X ) = xf (x)dx = x2 e−x dx
0 0 !∞
−
e x e−x e−x
= x2 − 2x +2
(−1) (−1)2 (−1)3 0
∞
= −x2 e−x − 2xe−x − 2e−x 0
= − (0 − 2) sin ce e−∞ = 1 and e0 = 1
= 2 ⇒ E (X ) = 2
Continuous Random Variable 29/1
Problem 9
Var (X) = E X2 − [E (X)]2
R∞ 2
Where E X2 =
x f (x)dx
−∞
R∞ R∞
X2 x2 f x3 e−x dx
E = (x)dx =
0 0 !∞
e − x e−x e−x
−x
= x3 − 3x2 2
+ 6x 3
−6 e 3
(−1) (−1) (−1) (− 1)
∞ 0
= −x3 e−x − 3x2 e−x − 6xe−x − 6e−x 0
= − (0 − 6) sin ce = 1 and e− ∞ e0 =1
2
=6⇒E X =6
Var (X) = E X2 − [E (X)]2
= 6 − 22 = 6 − 4 = 2
⇒ Var (X) = 2
Continuous Random Variable 30/1
Problem 10
The distribution
function of a continuous random variable X is
0 x<0
x2
0 ≤ x < 1/2
given by F(x) = 3 .
1 − (3 − x)2 1/2 ≤ x < 3
25
x≥3
1
Find the pdf of X and evaluate P (|X| ≤ 1) and P (1/3 < X < 4)
using both the pdf and cdf.
Solution:
d [F (X)]
we know that f (x) =
dx
Continuous Random Variable 31/1
Problem 10
0 x<0
2x 0 ≤ x < 1/2
The pdf of X is given f (x) = 6
(3 − x) 1/2 ≤ x < 3
25
x≥3
0
Now using pdf to find P (|X| ≤ 1)
P (|X| ≤ 1) = P (−1 ≤ x ≤ 1)
R1 1/2
R R1 6 13
= f (x) dx = 2xdx + 25 (3 − x)dx = 25
−1 0 1/2
13
Using cdf, P (|X| ≤ 1) = P (−1 ≤ x ≤ 1) = F (1) − F (−1) =
25
Continuous Random Variable 32/1
Problem 10
Now using pdf,
R4
P (1/3 ≤ X < 4) = f (x) dx
1/3
1/2
R R3 6 8
= 2xdx + (3 − x)dx =
1/3 1/2 25 9
Using cdf,
1 1 8
P (1/3 ≤ X < 4) = F (4) − F = 1− =
3 9 9
Continuous Random Variable 33/1
Moments
If X is a continous RV with PDF f (x) defined in an
interval (a, b), then
0 Rb
1 the moment µr = xr f (x)dx
a
0 Rb
2 moment about the point A µr = (x − A)r f (x)dx
a
0 Rb
3 moment about mean µr = (x − µ)r f (x)dx
a
Continuous Random Variable 34/1
Moment Generating Functions
If X is a RV with PDF f (x) defined in an interval (a, b),
then
1 the MGF MX (t) = E[etx ] = ∑ etx P(X = x) for discrete RV
x
Rb
2 the MGF MX (t) = E[etx ] = etx f (x)dx for Continuous RV
a
Continuous Random Variable 35/1
Also, MGF = MX (t) = E(etx ) can be expanded about
exponential to find the moments. !
2 3
tx ( tx ) ( tx )
MX (t) = E(etx ) = E 1 + + + + ...
1! 2! 3!
t t2 t3
= E(1) + E(x) + E(x2 ) + E(x3 ) + ...
1! 2! 3!
t 0 t2 0 t3 0
= 1 + µ1 + µ2 + µ3 + ...
0
1! 2! 3!
Where µr = rth moment about origin.
tr 0
Therefore, the coefficient of gives the value of µr .
r!
Note:
0 d
µr = [Mx (t)]t=0
dt
Continuous Random Variable 36/1
Properties of MGF:
(i) MCX (t) = MX (ct) where c is a constant.
(ii) if X1 , X2 , X3 , ...Xn are independent RVs then
MX1 +X2 +X3 +...+Xn (t) = MX1 (t) MX2 (t) MX3 (t) ...MXn (t).
Continuous Random Variable 37/1
Problem 1
Find the MGF of the RV X whose PDF
1
P(X = x) = x , x = 1, 2, 3, .... Hence find the Mean.
2
Solution:
MX (t) = E(etx ) = ∑ etx P(X = x)
x
t x
∞ 1 ∞ e
= ∑ e x = ∑ tx
x=1 2 x=1 2
t
t 2 t 3 t 4
e e e e
= + + + + ...
2" 2 2 2
2 4
#
et et et et
= 1+ + + + ...
2 2 2 2
−1 −1
et et et 2 − et et
2
= 1− = =
2 2 2 2 2 2 − et
e t
=
2 − et Continuous Random Variable 38/1
To find Mean we make use of the Note
0 d
i.e., µr = [Mx (t)]t=0
dt t
0 d d e
µ1 = [Mx (t)]t=0 =
dt dt 2 − et t=0 !
(2 − et )et − et (0 − et )
=
( 2 − et ) 2 t=0
(2 − 1) + 1
= =2
(2 − 1)2
Continuous Random Variable 39/1
Problem 2
x, 0 < x ≤ 1
For the triangular distribution f (x) = 2 − x, 1 ≤ x < 2 Find
0, otherwise
the mean, variance and MGF.
Solution:
R∞
MX (t) = E(etx ) = etx f (x)dx
−∞
R1 R2
= etx xdx + etx (2 − x)dx
0 1
1 2
etx etx etx etx
= x − 2 + (2 − x) − (0 − 1) 2
t t 0 t t 1
t
et et et
2t
e 1 e
= − 2+ 2 + 2 − − 2
t t t t t t
e2t − 2et + 1
=
t2 Continuous Random Variable 40/1
0 R
Mean E(X) = µ1 = xf (x)dx
R1 R2
= [Link] + x(2 − x)dx
0 1
1 2
x3 2x2 x3
= + −
3 0 2 3 1
1 8 1
= +4− −1+ = 1
0 R3 3 3
E(X2 ) = µ2 = x2 f (x)dx
R1 R2
= x2 .xdx + x2 (2 − x)dx
0 1
1 2
x4 2x3 x4
= + −
04 3 4 1
1 16 2 1 7
= + −4− + =
4 3 3 4 6
Continuous Random Variable 41/1
Variance σ2 = E(X2 ) − (E(X))2
7 1
= −1 =
6 6
Continuous Random Variable 42/1
Problem 3
Let the
random variable X has the PDF
1 e−x/2 , x > 0
f (x) = 2 . Find the MGF, mean and variance.
0, elsewhere
Solution:
MX (t) = E(etx ) = etx f (x)dx
R
1
!
R∞ 1 x 1 R∞ −x
2
−t
= etx e− /2 dx = e dx
0 2 20
! ∞
1
− −t x
1 e 2 1 1
= = 0−
2 1 2 1
− −t − −t
2 0
2
1 2 1
= =
2 1 − 2t 1 − 2t
Continuous Random Variable 43/1
1
we have MX (t) = = (1 − 2t)−1
1 − 2t
expanding we have MX (t) = 1 + 2t + (2t)2 + (2t)3 + ...
t
Mean = E(X) = coefficient of =2
1!
t2
E(X2 ) = coefficient of =8
2!
Variance = E(X ) − (E(X))2 = 8 − 4 = 4
2
Continuous Random Variable 44/1
Problem 4
The density function of a random variable X is given by
f (x) = kx(2 − x), 0 ≤ x ≤ 2. Find the value of k, rth moment,
mean and variance.
R∞
WKT f (x)dx = 1
−∞
R2
⇒ k(2x − x2 )dx = 1
0
2
2x2 x3
⇒k − =1
2 3 0
8
⇒ k 4− =1
3
3
⇒k=
4
Continuous Random Variable 45/1
0
rth moment µr = E(xr ) = xr f (x)dx
R
R2 3
= xr (2x − x2 )dx
0 4
3R 2
2xr+1 − xr+2 dx
=
40
r+2 2
xr+3 3 2r+3 2r + 3
3 2x
= − = −
4 r+2 r+3 0 4 r+2 r+3
3 ∗ 2r + 3
=
4(r + 2)(r + 3)
0 3 ∗ 24
When r = 1, mean µ1 = =1
4(3)(4)
0 3 ∗ 25 6
µ2 = =
4(4)(5) 5
2 0
0 2 6 1
Variance σ = µ2 − µ1 = − 1 =
5 5
Continuous Random Variable 46/1
Problem 5
If the random variable X has the moment generating function
2
MX ( t ) = , determine the mean and variance of X
2−t
Solution:
2
MX ( t ) = = 2 (2 − t ) −1
2−t
t −1
2 3
t t t
= 1− = 1+ + + + ...
2 2 2 2
1 1
E(X ) = , E(X2 ) =
2 2
2
1 1 1
σ2 = − =
2 2 4
Continuous Random Variable 47/1
Problem 6
2(1 − x) 0<x<1
If the pdf of X is given by f (x) = , (i)
0 otherwise
2
show that E[Xr ] = (r+1)(r+2)
(ii) use this result to evaluate E[(2X + 1)2 ]
R1
Solution: E[Xr ] = xr f (x)dx
0
R1
=2 xr (1 − x)dx
0
R1
xr − xr+1 dx
=2
0
1
xr+1 xr + 2
=2 −
r + 1 r + 2 0
1 1
=2 −
r+1 r+2
Continuous Random Variable 48/1
Problem 6
2
E[Xr ] =
(r + 1)(r + 2)
1
when r = 1, E[X] =
3
2 1
when r = 2, E[X ] =
6
E[(2X + 1)2 ] = E 4X2 + 4X + 1
2 + 4E X + 1
= 4E
X ( )
1 1
= 4× + 4× +1
6 3
2 4
= + +1 = 3
3 3
⇒ E[(2X + 1)2 ] = 3
Continuous Random Variable 49/1