0% found this document useful (0 votes)
13 views21 pages

Mathematics For Computing

Mathematics for computing

Uploaded by

Yamuna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views21 pages

Mathematics For Computing

Mathematics for computing

Uploaded by

Yamuna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

MATHEMATICS FOR COMPUTING

Probability - Questions and Answers

Part 1

1. Define ‘conditional probability’ with suitable examples.

The chance of a event or outcome based on a pre-event or outcome is defined


as conditional probability. The probability of the preceding event is that the
reality, or probability, of the probability of the probable probability.
Formula of Conditional Probability

𝑃(𝐴 ∩ 𝐵)
𝑃 = (𝐴/𝐵) =
𝑃(𝐵)

Example:-
A bucket contains 5 red balls and 5 blue balls. Two balls are drawn without
replacement. If the primary (first) ball is blue find the probability that the
second ball is also blue.

5
Let A be the event of drawing first blue ball. Then P(A) =
10

Let B be the event of drawing another blue ball. Now we’ve not replaced back
the first ball. So number of blue balls is 4 now and total balls are 9.
4
𝐻𝑒𝑛𝑐𝑒 , 𝑃(𝐵/𝐴) =
9
2. A Faculty which has 100 students in its sixth form, 50 students study
mathematics, 29 study biology and 13 study both subjects. Find the
probability of the scholar studying mathematics given that the student
studies biology.

S=100
50 29

37 13 16

B
A 34

𝑃(𝑀 ∩ 𝐵)
𝑃(𝑀⁄𝐵) =
𝑃(𝐵)
13 100
= ×
100 29

13
=
29
3. A specific medical disease occurs in 1% of the population. An easy
screening procedure is available and in 8 out of 10 cases where the patient
has the disease, it produces a positive result. If the patient doesn’t have
the disease there is still a 0.05 chance that the test will provides a positive
result. Find the probability that a randomly selected individual:

(a) Doesn’t have the disease but gives a positive result in the screening test

𝑃 = (𝑐 ∩ 𝑠) = 𝑃(𝑠 ⁄ (𝑐) × 𝑃(𝑐)


8 1
= ×
10 100

5
𝑃(𝑠⁄𝑐′) =
100

𝑃(𝑐 ∩ 𝑠) = 𝑃(𝑠⁄𝑐′) × 𝑃(𝑐′)
5 99
= ×
100 100
495
=
10000

(b) Gives a positive result on the test

𝑃(𝑠) = 𝑃(𝑐 ∩ 𝑠) ∪ 𝑃(𝑐 ′ ∩ 𝑠)


𝑃(𝑐 ∩ 𝑠) + 𝑃(𝑐 ′ ∩ 𝑠)
𝑃(𝑠⁄𝑐) 𝑃(𝑐) + 𝑃(𝑠⁄𝑐′) 𝑃(𝑐′)
8 1 5 99
× = ×
10 100 100 100
8 495 575 23
+ = =
1000 10000 10000 400
(c) Nilu has taken the test and her result’s positive. Find the probability that she
has the disease.
Let C represent the event “the patient has the disease” and S represent the
event “the screening test gives a positive result”.

𝑃(𝑐 ∩ 𝑠)
𝑃(𝑐⁄𝑠) =
𝑃(𝑠)
𝑃(𝑠⁄𝑐 )𝑃(𝑐)
𝑃(𝑠)
8 1
×
10 100

8
1000

4. During a certain group of 15 students, 5 have graphics calculators and


three have a computer at home (one student has both). Two of the
scholars drive themselves to college each day and neither of them has a
graphics calculator nor a computer at home. A scholar is chosen at
random from the group.

(a) Find the probability that the scholar either drives to college or has a graphics
calculator.

S=15

4 1 2
G
H
2
D 6

𝑃(𝐺 ∪ 𝐷) = 𝑃(𝐺) + 𝑃(𝐷)


5 2
= +
15 15
7
=
15
(b) Show that the events “the student features a graphics calculator” and “the
student features a computer at home” are independent.
Let G represent the event “the student features a graphics calculator”
H represent the event “the student has a computer at home”
D represent the event “the student drives to school each day”
Represent the facts in this question by a Venn diagram. Use the above Venn
diagram to answer the questions.

𝑃(𝐴 ∩ 𝐵)
𝑃(𝐴⁄𝐵) =
𝑃(𝐵)
𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴⁄𝐵) 𝑃(𝐵)
𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴) × 𝑃(𝐵)
𝑃(𝐺 ∩ 𝐻) = 𝑃(𝐺) × 𝑃(𝐻)
1
𝑃(𝐺 ∩ 𝐻) =
5
5 3
𝑃(𝐺) × 𝑃(𝐻) = ×
15 15
1
=
15

If the probability of G & H are independent there should be equal to 𝑃(𝐺 ∩ 𝐻).
5. A bag contains 6 blue balls, 5 green balls and 4 red balls. Three are
selected at randomly without replacement. Find the probability that
(a) they’re all blue
(b) two are blue and one is green
(c) there’s one of each colour

4
13 5
13 4
B 13 5
13 4
B 13 4
13
5
5 B
B 13
14 5
5 13 5
14 13
4 5
B
14 13
4
6 6
13
15 B 14 B 4
6 13
5 4 B
133
15 G 14
4 13 4
4
15 R 13
14 B 6
6 13
5 14 B
3
14 B 13 5
3
3 5 13
14
13 13

6
4
B 13
3 13
6 13
5 13
2 13
13

Figure 1: Probability chart : Author create

(a) 𝑃(𝐵1 ∩ 𝐵2 ∩ 𝐵3 )

6 5 4 120
× × =
15 14 13 2730
6 5 5 6 5 3 5 6 5 450
b) ( × × )+( × × )+( × × ) =
15 14 13 15 14 13 15 14 13 2730

6 5 4 6 4 5 5 6 4 5 4 6 4 6 5
a) (15 × 14 × 13) + (15 × 14 × 13) + (15 × 14 × 13) + (15 × 14 × 13) + (15 × 14 × 13) +
4 5 6 700
(15 × 14 × 13) = 2730
Part 2

6. Differentiate between ‘Discrete’ and ‘Continuous’ random variables.


There are two kind of random variables. Like Discrete random
variable & Continuous Random variable.
Eg: X = The amount of members in family.

Continuous random variables : P = The height of a student in the class


Q = The distance from Kandy to the student’s
home

Discrete Continuous
Can counting Can Measure
Use probability Mass Function Probability Density function
P(X=x) F(X ≤ 𝑥)
Variable whose value is obtained by Variable whose value is obtained by
counting. measuring.
can take only distinct, separate values can take any value in some interval
Table 1: Differentiate of Discrete & Continuous

7. Two fair cubical dice are thrown: one is red and one is blue. The random
variable M represents the score on the red die minus the score on the blue
die.
(a) Find the distribution of M.

M= The score on the red die minus the score on the blue die
M= -5 to 5

Blue Die
1 2 3 4 5 6

1 0 -1 -2 -3 -4 -5
Red Die

2 1 0 -1 -2 -3 -4
3 2 1 0 -1 -2 -3
4 3 2 1 1 -1 -2
5 4 3 2 2 0 -1
6 5 4 3 3 1 0
Table 2:Table of Probability
The Probability Discrete of M
M -5 -4 -3 -2 -1 0 1 2 3 4 5
P(M=m) 1 2 3 4 5 6 5 4 3 2 1
36 36 36 36 36 36 36 36 36 36 36

(b) Write down E(M).


E(m) = ∑ 𝑚 × 𝑝 (𝑀 = 𝑚)
1 2 3 4 5
[(−5) × ] + [(−4) × ] + [(−3) × ] + [(−2) × ] + [(−1) × ]
36 36 36 36 36
6 5 4 3 2
+ [(0) × ] + [(1) × ] + [(2) × ] + [(3) × ] + [(4) × ]
36 36 36 36 36
1
+ [(5) × ]
36
=0

(c) Find Var(M).


Var (M) = Variance of m
𝑉𝑎𝑟(𝑀) = 𝐸(𝑚2 ) − [𝐸(𝑚)2 ]
[∑ 𝑚2 𝑝(𝑀 = 𝑚)] − [∑ 𝑚𝑝(𝑀 = 𝑚)2 ]

𝐸(𝑀)2 = ∑ 𝑚2 𝑃(𝑀 = 𝑚)
1 2 3 4 5
[(−5)2 × ] + [(−4)2 × ] + [(−3)2 × ] + [(−2)2 × ] + [(−1)2 × ]
36 36 36 36 36
6 5 4 3 2
+ [(0)2 × ] + [12 × ] + [22 × ] + [32 × ] + [42 × ]
36 36 36 36 36
2
1
+ [5 × ] = 5.824
36

Var(M) V(M)=E(𝑀2 ) − 𝐸(𝑀)2


𝑉(𝑚) = 5.824 − (0)2
= 5.824 − 0
= 5.824
8. Two 10p coins are tossed. The random variable X represents the total
value of each coin lands heads up.
(a) Find E(X) and Var(X).

X = The total value of each coin lands heads up

Coin 1
Head Tail

Head
20 10

Coin 2

Tail
10 0

X 0 10 20
P(X=x) 1 2 3
4 4 4

𝐸(𝑋) = ∑ 𝑥 × 𝑝(𝑋 = 𝑥)
1 2 1
= 0 × + 10 × + 20 ×
4 4 4
= 10

𝑉(𝑋) = 𝐸(𝑥 2 ) − [𝐸(𝑋)]2


1 1 1 1
𝐸(𝑋 2 ) = [ × (0)2 ] + [ × (10)2 ] + [ × (20)2 ] + [ × 100]
4 2 4 2
1
+ [ × 400]
4
V(X) = 150 − (10)2 − 𝐸(𝑥) = 10
= 150-100
= 50

The random variables S and T are defined as follows:


S = X-10 and T = (1/2)X-5
(b)Show that E(S) = E(T).

1
𝑆 = 𝑋 − 10 𝑡 = ( ) × −5
2
𝐸(𝑆) = 𝐸(𝑋 − 10)
= 𝐸(𝑋) − 𝐸(10)
= 10 − 10
=0
1
𝐸(𝑇) = 𝐸 [( ) × −5]
2
1
= 𝐸 [( ) 𝑋] − 𝐸(𝑆)
2
1
= ( ) 𝐸 (𝑥) − 5
2
1
= × 10 − 5
2
=5−5
=0

Therefore E(S) = E(T)

(c) Find Var(S) and Var (T).

Var (S) = Var (x-10)


= Var (X) – Var (10)
= 50 - 0
= 50

1
𝑉𝑎𝑟(𝑇) = 𝑉𝑎𝑟 [( ) × −5]
2
1
= 𝑉𝑎𝑟 [( ) 𝑥] − 𝑉𝑎𝑟 (5)
2
2
1
= ( ) 𝑉(𝑋) − 0
2
1
= × 50
4
= 12.5
(d) Susan and Thomas play a game using two 10p coins. The coins are tossed
and Susan records her score using the random variable S and Thomas uses
the random variable T. After a large number of tosses they compare their
scores. Comment on any likely differences or similarities.

After a large no. of tosses are equals


The Susan’s values are vary than the Thomas values.
E(S) = E(T)
Var (S) >Var (T)

9. A discrete random variable X has the following probability distribution:


x 1 2 3 4
P(X=x) 1/3 1/3 k 1/4

where k is a constant.

(a) Find the value of k.

∑ 𝑃 (𝑋 = 𝑥) = 1

Therefore;
𝑃(𝑋 = 1) + 𝑃(𝑋 = 2) + 𝑃(𝑋 = 3) + 𝑃(𝑋 = 4) = 1
1 1 1
+ +𝐾+ =1
3 3 4
1 1 1
𝐾 =1−( + + )
3 3 4
0.09

(b) Find P(X ≤3).

𝑃(𝑋 ≤ 3) = 𝑃[(𝑋 = 1) ∪ (𝑋 = 2) ∪ (𝑋 = 3)]


= 𝑃(𝑋 = 1) + 𝑃(𝑋 = 2) + 𝑃(𝑋 = 3)
1 1
= + + 0.09
3 3
= 0.75
Part 3

1. In a quality control analysis, the random variable X represents the number of


defective products per each batch of 100 products produced.
Defects (x) 0 1 2 3 4 5
Batches 95 113 87 64 13 8

(a) Use the frequency distribution above to construct a probability distribution


for X.

X = The number of defective products per each batch of 100 products


produced.

X 0 1 2 3 4 5
No of Batch 95 113 87 64 13 8
95 113 87 64 13 8
P(X=x)
380 380 380 380 380 380

Total no of Batches = 380

(b) Find the mean of this probability distribution.


𝐸(𝑋) = ∑ 𝑥 × 𝑝 (𝑋 = 𝑥)
95 113 87 64 13 8
0× + +2× +3× +4× +5×
380 380 380 380 380 380

1
= 95 + 113 + 174 + 102 + 62 + 40
380
1 586
=
380 1

1.49

(c) Find the variance and standard deviation of this probability distribution.
i. 𝑉(𝑋) = 𝐸(𝑥 2 ) − [𝐸(𝑥)]2
= 3.73 − (1.49)2
= 1.51

i. 𝑆𝐷(𝑋) = √𝑉(𝑥)
= √1.51
= 1.23
11. A surgery has a success rate of 75%. Suppose that the surgery is
performed on three patients.
(a) What is the probability that the surgery is successful on exactly 2
patients?

Probability of Success = 75%


75
= 0.75
100
Number of trials = number of patients = 3
X= The number of success

The probability mass function of x is


P(X=x) = 3Cx (0.75)x (1-0.75)3-x
X=0,1,2,3
P(X=2) = 3C2 (0.75)2 (1-0.75)3-2
3!
× (0.75)2 × (0.25)1
(3 − 2)! 2!

= 0.422

(b) Let X be the number of successes. What are the possible values of X?
P(X=x) = 3Cx (0.75)x (1-0.75)3-x

Possible Values for x are


X = 0,1,2,3

(c) Create a probability distribution for X.


P(x=0)= 3C0 (0.75)0 (0.25)3-0
3!
× (0.75)0 × (0.25)3 = 0.016
(3 − 0)!

P(x=1)= 3C1 (0.75)1 (0.25)3-1=0.141

P(x=2)= 3C2 (0.75)2 (0.25)3-2=0.422

P(x=3)= 3C3 (0.75)3 (0.25)3-3=0.422

X 0 1 2 3
P(X=x) 0.016 0.141 0.422 0.422
(d) Graph the probability distribution for X using a histogram.

0.45
0.4
0.35
Probability P(X=x)

0.3
0.25
0.2
0.15
0.1
0.05
0
0 1 2 3
Number of Successes (X=x)

Figure 2: Probability Chart - Author developed

(e) Find the mean of X.

Variance of a Binomial
Distribution = 𝜇 = 𝑛𝑝 𝑛 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑡𝑟𝑖𝑎𝑙𝑠 𝑝 = 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑜𝑓 𝑆𝑢𝑐𝑐𝑒𝑠𝑠
𝜇 =𝑛×𝑝
= 3 × 0.75
= 2.25

(f) Find the variance and standard deviation of X.

i. Variance of a binomial distribution


𝜎 2 = 𝑛𝑝𝑞
𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒 𝑜𝑓 𝑋; 𝜎 2 = 𝑛 × 𝑝 × 𝑞
= 3 × 0.75 × 0.25
= 0.5625

n= Number of trials
p=Probability of success
q=probability of failure

Standard deviation of a binomial distribution


𝜎 = √𝑛𝑝𝑞 ;
𝑆𝐷 𝑜𝑓 𝑥 ; 𝜎 = √𝑛 × 𝑝 × 𝑞
= √3 × 0.75 × 0.25
= √0.5625
9
= √16
= 0.75
12. Colombo City typically has rain on about 16% of days in November.
(a) What is the probability that it will rain on exactly 5 days in
November? 15 days?

x = The number of rainy days in November


n = Number of days in November , 30 days
p = 0.16

Probability mass function of X is,

P(X=x) = 30Cx (0.16)x (0-0.16)30-x

i. P(X=5) = 30C5 (0.16)5 × (0.16)5×(0.84)30-5


= 0.191

ii. P(X=15) = 30C15 × (0.16)15 × (0.84)30-15


= 0.00001508

(b) What is the mean number of days with rain in November?


Mean of X; 𝜇 = 𝑛 × 𝑝
= 30×0.16
= 4.80

(c) What is the variance and standard deviation of the number of days with rain
in November?

i. Variance of X;𝜎 2 = 𝑛𝑝𝑞 = 30 × 0.16 × 0.84


= 4.302

ii. SD of X;𝜎 2= √𝑛𝑝𝑞


√30 × 0.16 × 0.84
= 2.008
13. From past records, a supermarket finds that 26% of people who enter
the supermarket will make a purchase. 18 people enter the supermarket
during a one-hour period.

(a) What is the probability that exactly 10 customers, 18 customers and 3


customers make a purchase?

X= The number of people who did a purchase out of 18 people

N= 18
26
P = 26% = = 0.26
100

Probability mass function of x;

18
P(X=x) = Cx (0.26)x (1-0.26)18-x ;

i. P(x = 10) = 0.00555

ii. P(x=18) = 0.0000000000295

iii. P(x=3) = 0.157

(b) Find the expected number of customers who make a purchase.

Mean of x;𝜇 = 𝑛 × 𝑝
= 18 x 0.26
= 4.68

(c) Find the variance and standard deviation of the number of customers
who make a purchase.

i. Variance of x;𝜎 2 = 𝑛𝑝𝑞


= 18 x 0.26 x 0.74
= 3.46

ii. SD of X; 𝜎 = √𝑛𝑝𝑞
= √3.46
= 1.86
14. On a recent math test, the mean score was 75 and the standard deviation
was 5. Shan got 93.Would his mark be considered an outlier if the marks
were normally distributed? Explain.

X=93 𝜎 = 5 𝜇 = 75
-3 +3

Z score is 3.6 𝑍 > +3, Therefore 93 is an outlier

𝑥−𝜇
𝑍= 𝜎

93 − 75
𝑍=
5

18
=
8

= 3.6

15. For each question, construct a normal distribution curve and label the
horizontal axis and answer each question.
The shelf life of a dairy product is normally distributed with a mean of 12
days and a standard deviation of 3 days.

X= The self life of a dairy product


𝑥 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (12,9)

(a) About what percent of the products last between 9 and 15 days?

9 ≤ 𝑥 ≤ 15 𝑏𝑦 𝑠𝑡𝑎𝑛𝑑𝑎𝑙𝑖𝑧𝑖𝑛𝑔

9−𝜇 𝑥 − 𝜇 15 − 𝜇
≤ ≤
𝜎 𝜎 𝜎

9 − 12 15 − 12
≤ 𝑍 ≤
3 3

1 - ≤ 𝑍 ≤ +1 𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒 𝑡ℎ𝑒 𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑎𝑔𝑒 68%


Figure 3: Normal Distribution Curve 68%

(b) About what percent of the products last between 12 and 15 days?

12 ≤ 𝑥 ≤ 15 𝑏𝑦 𝑠𝑡𝑎𝑛𝑑𝑎𝑙𝑖𝑧𝑖𝑛𝑔

12 − 𝜇 𝑥 − 𝜇 15 − 𝜇
≤ ≤
𝜎 𝜎 𝜎

12 − 12 15 − 12
≤ 𝑍≤
3 3

0 ≤ 𝑍 ≤ +1

Therefore percentage of the product is 34%

Figure 4: Normal Distribution Curve 34%


(c) About what percent of the products last 6 days or less?

𝑥 ≤ 6 𝑏𝑦 𝑠𝑡𝑎𝑛𝑑𝑎𝑙𝑖𝑧𝑖𝑛𝑔

𝑥−𝜇 6−𝜇

𝜎 𝜎
6 − 12
𝑧 ≤
3
𝑧 ≤ −2
2 ≤ −2
2.35% + 0.15%
2.5%

Figure 5: Normal Distribution Curve 2.5%

(d) About what percent of the products last 15 or more days?


𝑥 ≥ 15
𝑥− 𝜇 15 − 4

𝜎 𝜎
15 − 12
𝑧 ≥
3
𝑧 ≥ +1
13.5% + 2.35% + 0.15%
16%

Figure 6: Normal Distribution Curve 16%


16. Statistics held by the Road Safety Division of the Police shows that 78%
of drivers being tested for their license pass at the first attempt.
If a group of 120 drivers are tested in one center in a year, find the
probability that more than 99 pass at the first attempt, justifying the
most appropriate distribution to be used for this scenario.

𝜇 = 𝑛𝑝 = 120 × 0.78 = 93.6

𝜎 2 = √𝑛𝑝𝑞 = √120 × 0.78 × (1 − 0.78)

√120 × 0.78 × 0.22

= 4.538

𝑃(𝑥 > 99)

𝑥−𝜇 99 − 𝜇
𝑃 [ > ]
𝜎 𝜎

99 − 93.6
𝑍 >
4.538

𝑃(𝑍 > 1.19)


Part 4

Evaluate probability theory to an example involving hashing and load


balancing.

The hash is an algorithm that calculates a fixed-length bitrate from a file. The file
basically contains datasets. Hashing converts this data into a very short length of
a fixed length or key that represents the original text. The gash value can be
summarized in the file.

In addition to load balancing, there are Hands Tones. The key you need to hashing
is that you have a well-functioning algorithm when the input data is random. This
is a clickable and additional algorithm, the creation of data structure and analysis,
and in many other places.

A good choking algorithm also shows a moving property. As a result, the hash
output will be significant or completely different. Each bit or data bit change in a
file varies. This has not been considered a hash function, which is considered to
have a weaker vibe, which would be easy to break by hackers.

Load balancing is the efficient distribution of incoming network streams through


post server groups, a servers' forum or a group of servers. To maximize profits to
meet these large volumes, the best practices of modern computing generally
require the addition of more servers.

The freight specialist acts as "traffic police" in front of his clients. The clients'
requests are fulfilled at maximum efficiency and at maximum efficiency and
speed. If one server drops, the load balancer redirects traffic to the remaining
Internet servers.
(Hasing and load balancing - Standford University , n.d.)

You might also like