Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Manju, Associate Professor, CSE, IIUC

CHAPTER SIX
RANDOM VARIABLE AND MATHEMATICAL EXPECTATION
Mr. Mohammad Manjur Alam (Manju)
Associate professor
Department of Computer Science and Engineering
International Islamic University Chittagong.
FB and Email: manjuralam44@yahoo.com

Random variable with example.


A random variable is a real valued function whose values are determined with the
outcomes of a random experiment. It is usually denoted by X,Y,Z etc and the value of the
random variable denoted by x,y,z.

Let us consider the experiment of tossing two fair coins. The sample space of the
experiment is S= {HH, HT, TH, TT}

Let X denotes the number of heads. So,

Sample point Number of Head (X)


HH 2
HT 1
TH 1
TT 0

Here, X can take the values 0, 1 and 2. Therefore X is a random variable.

Types of random variable.


There are two types of random variable:

1. Discrete random variable.


2. Continuous random variable.

Discrete random variable: A random variable is called discrete random variable if it can
take only isolated values.

Example: Family members, mobile number etc.

Continuous random variable: A random variable is called continuous random variable


if it can take any values between certain limits.
Manju, Associate Professor, CSE, IIUC

Example: Age, weight, height etc.

Probability function and probability density function.


Probability function: A function f(x) of a discrete random variable X is called a
probability function if it satisfies the following two conditions:

(i) f (x ) ≥ 0
(ii) ∑ f (x ) = 1
Probability density function: A function f(x) of a continuous random variable X is
called a probability function if it satisfies the following two conditions:

(i) f (x) ≥ 0

(ii)∫ ∞ f (x)dx =1

Cumulative Distribution Function: The cumulative distribution function (cdf) F(x) of a


discrete random variable X with probability distribution f(x) is F x   P X  x    f t 
tx
Cumulative Distribution Function: The cumulative distribution function F(x) of a continuous
x
random variable X with density function f(x) is F x   P X  x    f (t )dt for    x  


The consequence of above definition


b a
Pa  x  b  
dF ( x)


f ( x)dx   f ( x)dx  F (b)  F (a)

and f ( x) 
dx
Application problem: A discrete random variable x has the following probability
function:

x 0 1 2 3 4
f (x) k 2k 3k 3k k
For what value of k the function will be a probability function?

Ans: Since, ∑ f (x ) = 1
Or, (K+2k+3k+3k+k) = 1

Or, 10k =1

Or, k = 0.10
Manju, Associate Professor, CSE, IIUC

Therefore,

x 0 1 2 3 4
f (x) 0.10 0.20 0.30 0.30 0.10
Application problem: A discrete random variable X has the following probability
function:

Values of X:x 0 1 2 3 4
f (x) 0.12 0.18 k 0.30 0.16
(i) Find the value of k, Compute (ii) P[X>3] ; (iii) P[1< X < 4] ; and (iv) P[X<1].
(i) Since, ∑ f (x ) = 1

Or, (0.76+k) = 1

Or, k =1-0.76

Or, k = 0.24

(ii) P[X>3] = P[X=4] = 0.16


(iii) P[1< X < 4]= P[X=2]+ P[X=3]

= k+0.30
= 0.24+0.30 = 0.54
(iv) P[X<1] = P[X=0]
= 0.12

Assignment problem: A discrete random variable X has the following probability


function:

Values of X:x 0 1 2 3 4
f (x) 0.10 0.30 0.20 0.25 0.15
Find the value of (i) P[X=1]; (ii) P[X>3] ; (iii) P[1< X < 4] ; and (iv) P[X<1].

Assignment problem: Suppose x is discrete random variable with probability function.

Values of -2 -1 0 1 2
X:x
f (x) 0.3 0.2 0.1 0.25 0.15
Find the value of (i) P[ X = 1]; (ii) P[-1< X <2]; (iii) P[ X >0] and P[ X<-1]

Application problem: A continuous random variable X has the following probability


density function:
Manju, Associate Professor, CSE, IIUC

f(x) = kx2 ; 0 ≤ x ≤ 1

(i) Find the value of K


(ii) probability that X lies between 0.2 and 0.50
(iii) probability that X less than 0.30 and
(iv) probability that X greater than 0.75

∫ f (x)dx =1

Ans:(i) Since, ∞

Or, ∫ kx dx =1
1
2
0

x3 1
Or, k[ ]0 =1
3

k
Or, =1
3

Or, k = 3

(ii) probability that X lies between 0.2 and 0.50

P[0.20< X < 0.50] = ∫0.20 kx 2 dx


0.50

x 3 0.50
= k[ ] 0.20
3

= 3[
1
3
(
0.50 3 - 0.20 3 )]
= 0.125-0.008 =0.117

(iii) probability that X less than 0.30


0.3
P[X<0.3] = ∫0
kx 2 dx

= k[
x 3 0.30
3
1
(
] 0 = 3[ 0.30 3 - 0 3
3
)]= 0.027
∫ kx
1
2
dx
(iv) probability that X greater than 0.75 is P[X > 0.75] = 0.75

= k[
x3 1
3
] 00.75 = 3[
1
3

0.30 3 - 0 3  ] = 0.578
Manju, Associate Professor, CSE, IIUC

Assignment problem: The following is the probability density function of a random


variable x:

3
f (x) = (2x-x2) ; 0< x <2
4

Find (i) the value of ‘K’ ; (ii) P(x>1) and (iii) P( 1.5 < x < 2.25)

Assignment problem: A continuous random variable X has the following probability


density function:

f (x)= K (x - 1); 2≤ x≤6

Compute (i) the value of ‘K’ ; (ii) P(X >3) and (iii) P(3 < X < 4)

Assignment problem: A continuous random variable X has the following probability


density function:

f (x) = K (x +1); 2≤ x≤5

Compute (i) the value of ‘K’ ; (ii) P(X >3); (iii) P(X = 4) and (iv) P(3 < X < 4)

Assignment problem: Let X be a continues random variable with probability density


function

f(x) = kx ; 0 ≤ x ≤4 Find (i) the value of k; (ii) P(x ≥ 1 ); (iii) P(x ≤ 2)


Manju, Associate Professor, CSE, IIUC

MATHEMATICAL EXPECTATION
If X is a discrete or continuous random variable with probability function or probability
density function f(x).then the mathematical expectation of X is usually denoted by E[X]
or µ and defined by

µ = E[X] = ∑ xf (x) ; If X is a discrete random variable.


= ∫ ∞ xf (x)dx ; If X is a continuous random variable.

Properties of mathematical expectation of a random variable:

(i) If b is a constant then E[b] = b


(ii) If X is a random variable with expectation E[X], then E[aX+b] = a E[X] + b,
Where a and b constant.
(iii) If X is a random variable with expectation E[X], then E[X-E(X)] = 0
(iv) If X and Y are random variables then E[X+Y] = E[X] + E[Y]
(v) If X and Y are random variables then E[X-Y] = E[X] - E[Y]

Properties of variance of a random variable:

(i) If b is a constant then V[b] = 0


(ii) If X is a random variable, then V [aX+b] = a2 V[X] , Where a and b constant.
(iii) If X is a random variable with expectation E[X], then
V(X) =E[X-E(X)] 2= E(X2)- [E(X)]2
(iv) If X and Y are random variables then V[X+Y] = V[X] + V[Y]
(v) If X and Y are random variables then V[X-Y] = V[X] + V[Y]

Application problem: Find mean variance and standard deviation of the following
probability function:

Or, Find (i) E[X] (ii) V(X) and (iii) standard deviation

Values of X:x 0 1 2 3
f(x) 0.125 0.375 0.375 0.125

Solution: (i) Mean:


Manju, Associate Professor, CSE, IIUC

We know, E[X] = ∑ xf (x)


= (0)(0.125)+(1)(0.375)+(2)(0.375)+(3)(0.125)

= 1.5

(ii) Variance:

We know, V(X) = E(X2)- [E(X)]2

Here, E(X2) = ∑ x f (x )
2

= (0)2(0.125) + (1)2(0.375) + (2)2(0.375) + (3)2(0.125)

= 3

V(X) = E(X2)- [E(X)]2

= 3-(1.5)2 = 0.75

(iii) Standard deviation: V (X ) = 0.75 = 0.87

Assignment problem: Suppose x is discrete random variable with probability function.

Values of -2 -1 0 1 2
X:x
f (x) 0.3 0.2 0.1 0.25 0.15

Compute (i) E[x] ; (ii) E[3x+3] ; (iii) V[x] and (iv) V[2x-3]

Assignment problem: Let X be a continues random variable with probability density


function

f(x) = kx ; 0 ≤ x ≤4 Find (i) the value of k; (ii) P(x ≥ 1 ); (iii) P(x ≤ 2)

(iv) Mean, variance and standard deviation of x

You might also like