MCA Mathematical Foundation For Computer Application 08
MCA Mathematical Foundation For Computer Application 08
Names of Sub-Units
Overview
This unit begins by discussing about the concept of random variables and probability distribution.
Next, the unit discusses the discrete probability distribution and continuous probability distribution.
Further the unit explains the mean variance and co-variance of random variables and binomial and
normal distribution. Towards the end, the unit discusses the exponential distribution.
Learning Objectives
Learning Outcomes
https://en.wikipedia.org/wiki/Probability_distribution
Random Variable
2
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Example 2: In an experiment of tossing two coins simultaneously the set of 4 possible outcomes, S = { HH,
TT, TH, HT }. If random variable X denotes the number of head in the experiment, then
X = 0 (for TT)
X =1 (for TH and HT) and
X = 2 (for HH)
3
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
X P(X)
0 1/16
1 4/16
2 6/16
3 4/16
4 1/16
P(X) = 1
0.35
0.3
0.25
0.2
P(X)
0.15
0.1
0.05
0
0 1 2 3
X
4
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
F x P a x b f x.dx 0
a
Distribution Plot
Normal, Mean = 180, StDev = 10
0.04
0.03
Density
0.02
0.135905
0.01
0.00
160 170 180
X
EX x px
For a continuous random variable X with probability density function f(x), the mean or expected value
of X is:
E X x.f x .dx
5
JGI JAIN DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
V X
x . f x .dx
2
E X 1 X 2 X 3 E X 1 E X 2 E X n E X i .
E aX
aE X
and E X
a E X
a , where a is a constant number.
For any random variable, X 0, E X 0.
V aX b a2 V X , where a and b are constants, X is random variable.
V a1 X 1 a2 X 2 an X n a21V X 1 a22V X 2 a2nV X n .
8.5.2 Co-Variance of Random Variable
Co-variance of two random variables is calculated to check how strongly they are related to each other.
Co-variance of two random variables X and Y with means X and Y respectively is denoted by Cov(X,Y)
or XY .
Cov X, Y E X X Y Y
When X and Y are discrete random variables with p(x, y) as the joint distribution function, then:
Cov X, Y x X y Y p x, y
When X and Y are continuous random variables with f(x, y) as the joint distribution function, then:
6
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Example 3: A petrol pump owner sells petrol on an average of ` 60000 on a rainy day and of ` 90000 on
normal day. The probability of rainy day is 0.4 on Saturday. Fine the mean.
Solution: According to question, Random variable X will take two possible values i.e. 60000 and 90000.
X P(X) X.P(X)
60000 0.4 24000
90000 1 – 0.4 = 0.6 54000
EX x px
Example 4: In a competitive examination 100 questions each with 4 multiple choices are asked. Four
marks are given for each correct answer and one mark is deducted for wrong answer. Find the expected
value if examiner gives the exam without preparation.
7
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
X P(X) X.P(X)
400 1/4 100
–100 3/4 –75
Example 5: A bag contains 3 blue and 2 green balls. Three persons Shyam, Rohan and Sohan draw one
ball each and do not replace it. The person who draws first green ball gets ` 150. Find their expectation.
Solution: First, Shyam draws a ball.
P(Blue ball) = 3/5 and P(Green ball) = 2/5
2
If Shyam draws Green ball, expectation for Shyam = 150 = ` 60
5
But, if Shyam draws a blue ball then Rohan will draw next ball.
3 2 6
Probability of Green ball drawn by Rohan =
5 4 20
6
Expectation for Rohan = 150 = ` 45
20
But, if Rohan draws a blue ball then Sohan will draw next ball.
3 2 2 12
Probability of Green ball drawn by Sohan =
5 4 3 60
12
Expectation for Sohan = 150 = ` 30
60
Example 6: Find the Mean and Variance of the following discrete probability distribution:
x 0 1 2 3 4
8
UNIT 08: Random Variables and Probability JGI JAIN DEEMED-TO-BE UNIVERSIT Y
X P(X) X.P(X)
0 1/5 0
1 1/5 1/5
2 1/5 2/5
3 1/5 3/5
4 1/5 4/5
EX x p x
1 2 3 4
0
5 5 5 5
10
2
5
2
For, V X E X x 2 p x
X P(X) x–µ (x – µ)2 (x – µ)2 p(x)
0 1/5 -2 4 4/5
1 1/5 -1 1 1/5
2 1/5 0 0 0
3 1/5 1 1 1/5
4 1/5 2 4 4/5
4 1 1 4
V X 0
5 5 5 5
=2
Example 7: Calculate the variance and the standard deviation for the following data:
X 0 1 2 3 4
Solution: Here,
X P(X) X.P(X)
0 0.16 0
1 0.53 0.53
2 0.2 0.40
9
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
X P(X) X.P(X)
3 0.08 0.24
4 0.03 0.12
EX x p x
S.D 0.87
0.93
10
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
where
n – number of trials
p – probability of success
q – probability of failure
P(x) – probability of x success in n trials
Binomial Distribution
n = 1, p = 0.5
0.30
0.25
0.30
P(X)
0.15
0.10
0.05
0.00
0 2 3 4 5 6 7 8 9 10
Number of Successes X
The variance of binomial distribution is npq and the standard deviation is npq.
The variance of binomial distribution is less than mean of binomial distribution.
11
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
Example 8: A fair coin is tossed five times. What is the probability of getting:
i. exactly 3 heads
ii. 3 or 4 heads
iii. atleast 3 heads
1
Solution: Probability of head, p =
2
1 1
q=1–p=1–
2 2
and, n = 5 , Using probability function of binomial distribution:
3 2 4 1 5
1 1 1 1 1
10 5 1
2 2 2 2
2
10 5 1
32 32 32
16
32
12
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Example 9: The mean of binomial distribution is 16 and its S.D. is 3. Find n, p and q.
Solution: In a binomial distribution
Mean = np
S.D. = npq
Variance = npq
Here, Mean = np =16 ...(1)
S.D. = npq 3
Variance = npq = 9 ...(2)
Dividing (2) by (1), we get:
npq 9
np 16
9
q
16
9 7
p=1–q= 1
16 16
256
n
7
Example 10: 8 coins are tossed at a time, 256 times. Find the expected frequencies of getting tails and
tabulate the results obtained.
Also calculate mean and variance of number of tails.
Solution: Given N = 256, n = 8
1 1 1
p = P( getting a tail) = , q = P(getting a head) = 1
2 2 2 8
1 1
for fitting binomial distribution, we have to expand 256
2 2
By expanding, we get expected frequencies of 0, 1, 2, 3, ……., 8 tails. As,
13
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
8
0
1 1
8
1
8
1
0
C
0 256 C8 1
0 2 2
02 2
8
1
1 1
7 1
1
1
7
C
1 256 C8 8
1 2 2 2 2
1
8
2
1 1
6
1
2
1
6
C
2 256 C8 28
2 2 2
2 2 2
8
3
1 1
5 1
3
1
5
C
3 256 C8 56
3 2 2
3 2 2
8
4
1 1
4
1 1
4 2
C
4 256 C8 70
4 2 2 2 2
4
8
5
1 1
3
1 1
5 3
C
5 256 C8 56
5 2 2
5 2 2
8
6
1 1
2
1
6
1
2
6 C 28
256 C
8
6 2 2
6 2 2
8
7
1 1
1
1
7
1
1
7 C 8
256 C
8
7 2 2 2 2
7
8
8
1 1
0 1
8
1
0
C
8 256 C8 1
8 2 2
82 2
1
For binomial distribution, mean = np = 8 4
2
1 1
Variance = npq = 8 2
2 2
14
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Where,
X – Value of continuous random variable
µ – Mean of random variable
– Standard deviation of random variable
The normal distribution plot is shown in Figure 6:
Inflection Inflection
Point Point
15
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
2
x
where Z , Z
–2.43 1.81 Z
Figure: 7(a)
We will find the area left of 1.81, and then subtract the area left of -2.43. Like this:
–2.43 1.81 Z
–
16
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
–2.43 1.81 Z
=
–2.43 1.81 Z
Figure: 7(b)
So, using the table of standard normal variate, the area between -2.43 and 1.81 = 0.9649 - 0.0075 = 0.9574
Example 11: Find the area to the right of Z = +1 and to the left of Z = -1.
Z = –1 0 Z = +1
Figure: 7(c)
Example 12: A normal curve has 20 and 10 . Find the area between X1 = 15 and X2 = 40.
Solution: Here, 20 and 10 . We have to find area between X1 = 15 and X2 = 40.
15 20 5
For X1 = 15, Z1 = 0.5
10 10
40 20 20
For X2 = 40, Z2 = 2.0
10 10
17
JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
–0.5 Z=0 +2
Figure 7: The area between the two points is shown in 7(a), 7(b), 7(c)
Required Area = (Area from Z = -0.5 to 0) + (Area from Z = 0 to2)
= 0.1915 + 0.4772
= 0.6687
1.50
= 0.5
=1
1.25
= 1.5
1.00
P(x)
0.75
0.50
0.25
0.00
0 1 2 3 4 5
x
18
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
E X x ex .dx
0
1 y
0
ye .dy
1 y
e yey
0
1
E x e
X2
0
2 x
.dx
1 2 y
2 0
y e .dy
1
2ey 2yey y2ey
2 0
2
2
V X E X 2 E X
2
2 1
2
2
1
2
19
JGI JAINDEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
P x 0.25e0.25x
Example 13: On the average, a certain computer part lasts ten years. The length of time the computer
part lasts is exponentially distributed. What is the probability that a computer part will work for more
than 7 years?
Solution: Let x = the amount of time (in years) a computer part lasts.
1 1
μ = 10, so 0.10
10
Since, P(X < x) = 1 ex then P(X > x) = 1 – 1 ex e x
0.1 7
P(x > 7) = e = 0.4966.
The probability that a computer part will work for more than seven years is 0.4966.
20
UNIT 08: Random Variables and Probability JGI JAIN
DEEMED-TO-BE UNIVERSIT Y
8.9 GLOSSARY
21
JGI JAINDEEMED-TO-BE UNIVERSIT Y
Mathematical Foundation for Computer Application
https://www.cuemath.com/learn/mathematics/probability-in-real-life/
https://en.wikipedia.org/wiki/Exponential_distribution#:~:text=The%20probability%20density%20
function%20%28pdf%29%20of%20an%20exponential,distribution%20is%20supported%20on%20
the%20interval%20%5B0%2C%20%E2%88%9E%29.
Discuss with your friends and classmates about the concept of random variable and probability
distribution. Also, discuss about the types of probability distribution and exponential distribution.
22