You are on page 1of 20

National University of Computer and Emerging Sciences

School of Engineering Islamabad Campus

EE319: Probability & Serial No:


Random Processes Midterm Exam
Total Time: 02 Hours
Thursday, March 21, 2019 Total Marks: 140
Course Instructors
Engr. Aamer Munir ___________________________
Engr. Moomal Bukhari Signature of Invigilator

_______SOLUTION_____________ ________ _______ ____________________________


Student Name Roll No Section Signature

OPEN NOTEBOOK (HAND WRITTEN) EXAM.


ONLY ONE NOTEBOOK IS ALLOWED. NO LOOSE PAGES.
THE NOTEBOOK SHOULD BEAR INSTUCTOR’S SIGNATURES ON A SIDE.

DO NOT OPEN THE QUESTION BOOK OR START UNTIL INSTRUCTED.

Instructions:
1. Verify at the start of the exam that you have a total of seven (7) questions printed on
eighteen (18) pages including this title page.
2. Attempt all questions on the question-book and in the given order.
3. Read the questions carefully for clarity of context and understanding of meaning and
make assumptions wherever important, for neither the invigilator will address your
queries, nor the teacher/examiner will come to the examination hall for any assistance.
4. Wherever computations are required, direct answers are not acceptable. You need to
show your working in a neat and concise way to get credited.
5. Fit in all your answers in the provided space. You may use extra space provided at the
end if required. If you do so, clearly mark question/part number on that page to avoid
confusion.
6. Use your own stationery and calculator only. If you do not have your own calculator, use
manual calculations.
7. Use permanent ink-pens. Questions attempted with lead-pencils will be considered for
checking but cannot be claimed for rechecking.

Q-1 Q-2 Q-3 Q-4 Q-5 Q-6 Q-7 Total


Total Marks 20 20 20 20 20 20 20 140
Marks Obtained
CLO Assessment CLO-01 CLO-01 CLO-02 CLO-02 CLO-03 CLO-03 CLO-03

Vetted By: ____________________________ Vetter's Signature: _____________________

Midterm Spring 2019 Page 1 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
CLOs tested in this exam:
CLO Description Coverage Questions
01 Develop a probabilistic model, including sample space, event space FULL 1, 2
and a probability measure, of a given situation of uncertainty with
statistical regularity.
02 Solve the probabilistic model with elementary probability theory FULL 3, 4
based on counting techniques, conditional probability and Bayes rule.
03 Solve the probabilistic model with advanced probability theory based PARTIAL 5, 6, 7
on random variables, probability distributions, and expectations.
Q1. [Marks: 20]
1
(i) A person thinks of a fraction where x is a single integer digit. Evaluate the following if
x
notation is correct. If not, mention what is wrong with the notation. [12 marks]

a. S= {11 , 12 , 13 , … , 19 }, 10 is not a fraction, it is not defined

b. p X ( 1x ), cannot determine since RV X is not defined.


c. P
[]1 1
, is not a valid event
x x

1
d. P [ { 1 } ] =
9

e. P {[ 12 }∩ {13 }]=P [ ∅ ]=0


f. P
[ { }]
1 1
, =
2 3
2
9

g. P
[ { }] [ ]
1 1
×
2 3
=P
1 1
=
6 9

h. P
[ { }] [ { }]
1
2
.P
1
3
1 1 1
= . =
9 9 81

[{ } ]
2
1
i. P ,cannot determine since square of a set is not defined
2

j. P P
[{ {[ 12 }]+ P [ {13 }]+ P [ {14 }]}]=P [{ 19 + 19 + 19 }]=P [ {13 }]= 19
[{∑ [{ }]}] [{∑ }] [{ }]
3 3
1 1 1 1
k. P P =P =P =
k=1 k k=1 9 3 9

[{ }]
4 4
1 1 4
l. ∑P k
=∑ =
k =1 k=1 9 9

Midterm Spring 2019 Page 2 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(ii) Convert the question asked into a mathematical expression. Do not solve. [4 marks]

a. Three friends Ava, Bob, and Chris put their names in a hat and each picks a name
from the hat randomly. (Assume Ava picks first, then Bob, then Chris). Event A : “Ava
picks her name”, event B: “Bob picks his name”, and event C : “Chris picks his
name”. Find the probability that everyone draws his own name.

P [ A ∩ B ∩C ]

b. Computer A and computer B are connected by two unreliable links, link 1 and link 2.
Computer A sends a message to computer B on both links simultaneously. Computer
B can detect when errors occur in either link. Let the probability of message
transmission error in link 1 and link 2 be q 1 and q 2, respectively. Computer B
requests retransmission until it receives an error-free message on either link. Find
the probability that more than k transmissions are required.

Partition, Ak : k-transmissions are required, for k =1,2,3 , …

P [ A k+1 ∪ A k +2 ∪ Ak +3 ∪ … ]OR

P [ ¿ n=k +1 ¿ ∞ A n ]

(iii) Convert the mathematical expression into a statement to explain what is being specified
in each of the following questions. Do not solve it. [4 marks]

a. Seven cards are drawn from a deck of 52 cards. If event A describes the seven cards
to be all possible combinations of being only from hearts and event B describes the
seven cards to be non-numeric cards (treat aces as numeric cards of value 1). What
does P[ A ∩B ] mean?

The probability that the seven cards are hearts AND non-numeric.

(In this case the event will be a null-set.)

b. A coin is tossed until a heads is obtained. If event A contains all sample points where
heads occur in more than 5 tosses but less than 10 tosses and event B contains all
sample points where heads occur in less than 5 tosses and more than 10 tosses,
what does P[ A c ∩ B c ] mean?

The probability that heads occur in 5-tosses OR in 10-tosses.

Midterm Spring 2019 Page 3 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus

Midterm Spring 2019 Page 4 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q2. [Marks: 20]
(i) A C++ function mint() returns a random 32-bit positive integer value greater than or
equal to 0. Maximum value possible is 231 −1. We need a prime number and need to use
this function, which is repeatedly called until the return value is a prime number.

a. Write S. [4 marks]

S={2 ,−2 ,−−2,−−−2 , … ,

3 ,−3 ,−−3 ,−−−3 , … ,

…,

p ,− p ,−−p ,−−− p , … }

where p is the last prime less than 231 −1. A dash ‘−¿ ‘ represents a call to the
function that does not return a prime number.

b. Write the event A2 where the returned prime value is 2. [2 marks]

A2={2 ,−2 ,−−2,−−−2 , … }

c. Create a partition, events N i based on number of calls to the function mint(). Clearly
write how many events will be there in this partition and how many sample points
will be there in each event? [4 marks]

Partition N i, where i=1,2,3 , …

N 1= {2 , 3 ,5 ,7 , 11 , … }

N 2={−2,−3 ,−5 ,−7 ,−11 , … }

N 3={−−2 ,−−3 ,−−5 ,−−7 ,−−11 , … }

As seen there are infinite sample points in each event and infinite events in the
partition.

Midterm Spring 2019 Page 5 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus

Midterm Spring 2019 Page 6 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
R
d. Create a partition, events i based on the prime number found. Clearly write how
many events will be there in this partition and how many sample points will be there
in each event? [4 marks]

Partition Ri , where i=2 , 3 ,5 , 7 , 11 ,… , p


Where each
Ri= {i ,−i ,−−i ,−−−i ,… }

As seen there are infinite sample points in each event but finite events in the
partition. Total number of events in the partition are equal to number of
primes in the range 1−231 −1.

(ii) A system has two key subsystems. The system is up if both subsystems are functioning.
Triple redundant systems are configured to provide high reliability. The overall system is
operational as long as one of the three systems is up. Let A jk corresponds to the event
“unit k in system j is functioning” for j=1 ,2 , 3 and k =1 ,2. Assume each subsystem
fails independently. Write an expression for the event “overall system is up”. [6 marks]

Event A : overall system is up


Event A jk : System j subsystem k is up
Thus
A=( A ¿ ¿ 11 ∩ A12)∪( A ¿ ¿ 21∩ A 22)∪( A ¿ ¿ 31∩ A 32)¿ ¿¿

Midterm Spring 2019 Page 7 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q3. [Marks: 20]
An urn has 3 red balls, one blue and one green. Do rough work on the pages at the end. Write
finalized steps here. Mark the rough work for this question clearly since that would also be checked.
(i) In how many ways we can arrange the 5 balls?

This is same as #ways we can put 3 red balls in 5 bins and for each of this assignment,
the number of ways blue and green ball can be arranged in the remaining 2 bins.

#ways 3 indistinguishable items are placed in 5 bins ¿ ( nk)=( 53)=5.2=10


n 2
#ways 2 distinct objects can be arranged ¿ Pk ¿ P2 =2
Thus

#ways to arrange 3 red, one blue and one green ¿ ( 53) . P =20
2
2

(ii) In how many ways we can have 2 balls picked from these five?

The word ‘have’ stresses that possession matters, not the order in which picked.

A : #ways to pick 2 balls from 3 red, 1 blue, 1 green

A0 : 0 balls picked from red, A1: 1 ball picked from red, A2: both balls picked from red.

A=A 0 ∪ A 1 ∪ A2 →| A|=| A 0|+| A 1|+|A 2|=1+ (1.2 ) +1=4

Verification: RR, RG, RB, GB

(iii) In how many ways we can order 2 balls picked from these five?

In addition to part (ii) above, there are GR, BR, BG, i.e., 3 more combinations. So there
are a total of 7 ways to pick and order 2 balls from these 5.

(iv) In how many ways we can have 2 balls picked from these five with replacement?

‘Have’ means unordered. With replacement means, we pick, note color, and pick from 5
again. So besides those in part (ii) above, there are GG, BB as well, i.e., 6 ways.

(v) In how many ways we can order 2 balls picked from these five with replacement?

So besides part (iii) above, there are GG, BB, as well, i.e., 9 ways.

Midterm Spring 2019 Page 8 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(vi) What is the probability that one picked is red ball if two are picked? [10 marks]

For independent picks,

P [ one picked isred if two are picked ] =P [ first picked is red ] . P [ second picked is not red ] + P [ first pic

3 2 2 3 12 3
¿ . + . = =
5 4 5 4 20 5

OR

E : two picked from five, with order matters, and without replacement.

|S|¿ n Pk ¿5 P 2=5.4=20

A : one picked is from red, other is not red

A1: first picked is red, other is not

A2: first picked is not red, other is red

A=A 1 ∪ A 2

| A|=| A 1|+|A 2|=3.2+2.3=12

| A| 12 3
P [ A ]= = =
|S| 20 5
Verification: Assume each red ball has a label

S={R1 R 2 , R1 R 3 , R2 R3 , R1 G , R2 G , R 3 G , R 1 B , R 2 B , R 3 B , BG ,

¿ same10 as above but order flipped >}

A={R1 G, R2 G , R3 G , R1 B , R2 B , R3 B ,

¿ same6 as above but order flipped >}

Midterm Spring 2019 Page 9 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q4. [Marks: 20]
(i) A special coin is tossed twice. It behaves fairly in the first toss but in the second toss the
probability to get the same result as in the first toss increases by 50 %. Make a tree
diagram to explain the experiment. List events at all nodes, probability expression in
terms of events and the value of their probability [4 marks]. Find if the events H 1: “first
coin toss is heads” and H 2: “second coin toss is heads” are independent or not. Prove
mathematically [6 marks].

P [ H 1 ]=0.5

P [ H 2 ] =P [ H 2 ∩ H 1 ] . P [ H 2 ∩T 1 ]=0.375+ 0.125=0.5

(
1 1
)
P [ H 1 ∩ H 2 ]=P [ { HH } ] = . ×1.5 =0.375
2 2

Since

P [ H1∩ H 2] ≠ P [ H 1]. P [ H2]

Therefore, the two events are not independent.

Midterm Spring 2019 Page 10 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(ii) 80 % students pass a course if it’s exam is based on homework. For closed book exams,
passing and failing is equally likely whereas 60 % students fail for open book exams.
40 % of the teachers provide homework based exams and only 25 % take open book
exams. (a) Formulate by making necessary events [2 marks], (b) make tree diagram (list
all nodes and probabilities and their values) [3 marks], and then (c) find the probability
that a student passes a course [3 marks]. (d) Knowing that the student failed, what is the
probability that the exam was open book [2 marks]?

(a) Event HW : Exam is HW based, Event CB : Exam is closed book, Event OB : Exam is
open book, Event F : student fail the course, Event F c: student pass the course.

(b)

(c) P [ F c ] =?

P [ F ] =P [ F ∩ H ] + P [ F ∩ C ] + P [ F ∩O ]=0.32+0.175+0.1=0.595
c c c c

(d) P [ O|F ] =?

P [ F|O ] . P [ O ] 0.6 ×0.25 0.6 ×0.25


P [ O|F ] = = = =0.3704
P[F] 1−0.595 0.405

Midterm Spring 2019 Page 11 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q5. [Marks: 20]
(i) A RV X has the pmf:

{
p X ( x )= x , x ∈ {0.1,0 .2,0 .3,0.4 }
0 , otherwise

Evaluate the following if they are in correct notation, otherwise mention what is wrong
[7 marks].

a. S X ={0.1, 0.2 , 0.3 ,0.4 }

b. p X ( 0.2 ) =0.2

c. E [ 0.2 ] =0.2

d. E [ { 0.2 } ] , expectation not defined for events or sets.

e. E [ X ] =( 0.1 )2 + ( 0.2 )2 + ( 0.3 )2 + ( 0.4 )2=0.3

f. P [ X=0.1 ]= p X ( 0.1 )=0.1

g. P [ X <0.3 ] = p X ( 0.1 )+ p X ( 0.2 )=0.1+0.2=0.3

(ii) Answer these questions briefly and concisely [3 marks]:

a. In performing an experiment 10 times a Geometric RV takes values as


1 ,2 , 2 ,1 , 1 ,1 , 2 ,1 , 1, 2. What would your approximation be for the parameter(s)
of the RV? Why?

1
The expectation of a geometric RV is . The sample mean of these 10 values is
p
14
=1.4 . If the sample mean is considered an approximation of the expectation
10
1
then 1.4 ≈ → p ≈ 0.714
p

Thus the parameter, p of the RV would be around 0.714 or we can approx. say it is
1
likely to be greater than .
2

b. If a RV takes up the values in 12 performing of the experiment


10 , 8 ,10 , 0 , 9 , 8 , 9 , 12, 2 ,11 , 10 , 9. What is your guess about the nature of the
RV? Why?

The RV cannot be Bernoulli (which can take up values of 0 or 1 only). The value of 0
eliminates the possibility that the RV is geometric. So either it can be a uniform RV
or Binomial RV. Based on the nature of the data, there are more chances of it being
Binomial than Uniform since more values around 10 occur.

c. How are Binomial and Bernoulli RVs related?

Midterm Spring 2019 Page 12 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
A Binomial RV is a sum of several Bernoulli RVs.

Midterm Spring 2019 Page 13 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(iii) What kind of random variable would X be, if [5 marks]:

a. X represents the waiting time (in integer minutes) for an empty taxi to come if the
passenger waits by the road and not at the taxi stand. Fractional time is rounded to
next minute.

X is geometric.

b. X represents the waiting time (in integer minutes) for an empty taxi at the taxi
1
stand. An empty taxi is already waiting with a probability of .
3

X is partly geometric, with X =0 also a value in the support of X .

c. There are 5 parking slots for taxis labelled 1 to 5. X represents the parking slot used
to engage an empty taxi.

X is uniform, with parameters 1 and 5.

d. X represents the direction a taxi moves after being engaged at a road side. 1 is
assigned if the taxi takes a U-turn whereas 0 is assigned if the taxi keeps moving in
the direction it was originally moving before being engaged.

X is Bernoulli.

e. X represents the number of days an empty taxi is engaged from booth 4 in a


month. Assume all months have 30 days.

X is Binomial, with n=30.

(iv) If the following random variables are legitimate, find their support and pmf. If not, write
why they are not legitimate. [5 marks]

a. U represents the binary status of an electrical switch. The switch controls a light
that is lit for 9 hours on average per day.

SU ={0 , 1}

pU (u)

9 9
pU ( 1 ) = , pU ( 0 )=1−
24 24

Midterm Spring 2019 Page 14 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus

Midterm Spring 2019 Page 15 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
b. V represents the blood group of patients.

SV =¿ Cannot describe the random variable since it does not take up real values.

pV (v )

c. X represents the salary of Academic Officer of the month of February 2019.

S X ={<salary amount >}

p X ( x ), p X ( salary amount ) =1

OR, it is a constant and not a Random Variable.

d. Y represents the #heads in largest sequence of consecutive heads in n-tosses.

SY ={0,1,2, … }

pY ( y ), finding this would be non-trivial and is not expected from students.


However, marks will only be given if the part is attempted and whatever written is
technically correct and in correct notation.
n
pY ( 0 )=( 1− p )

pY ( 1 ) =P ¿

As seen, the terms will get more complicated, so we leave it at that.

e. Z represents the number of trials until and including second success.

SZ ={2,3,4 ,… }

pZ ( z ), finding this is easy but validating the pmf is non-trivial too.

Let
2

() ()
P [ heads∈one toss ] =p , p Z ( 2 )= p2 , p Z ( 3 )= 3 ( 1− p ) p2 , p Z ( 4 ) = 4 ( 1− p ) p2.
2 2
There are 3 ways in which to have 2 Heads in 3 tosses etc. OR

()
pZ ( k ) = k ( 1− p ) p
2
k−2 2

∞ ∞

∑( )
k ( 1− p )k−2 p 2= p2
2
∑ ()
k ( 1− p )k−2= p2 [ 1+3 ( 1− p ) +6 ( 1− p )2 +10 ( 1− p )3 +… ]
k =2 k =2 2

Midterm Spring 2019 Page 16 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q6. [Marks: 20]
(i) Based purely on intuition, mark the value of the expectation on the plot of pmf of a
random variable: (treat expectation to be the pivot point from which a stick along
horizontal-axis will be balanced if pmf values are considered as weights. Larger the value
of pmf, larger the weight). [2 marks]

(a)
(b)

(c) (d)

(ii) Given a pmf as follows [6 marks]:

a. Find E [ X ] =0.2 ( 0.1 ) +0.4 ( 0.35 )+ 0.6 ( 0.1 )+ 0.8 ( 0.2 )+ 1.0 ( 0.25 )=0.63

b. Find P [ X ≤ E [ X ] ] =P [ X ≤ 0.63 ] = p X ( 0.2 ) + p X ( 0.4 ) + p X ( 0.6 ) =0.55

c. Plot the function g ( x ) where g ( x )=P [ X ≤ x ]

Midterm Spring 2019 Page 17 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(iii) A fair coin was tossed 50 times. The output of each toss is listed below in order:

HHHHHTTHTHHHHTHHHHTTHHHTHTHTHHTHHTHTHTHTHTHTHTTTTT

If RV X represents the outcome as a Bernoulli RV with heads taken as success [4 marks]:

(a) Find the sample mean of X .

29
⟨ X ⟩ n=
50

(b) Find expectation of X . Note, fair coin. So p=0.5

25
E [ X ] = p=0.5=
50

(iv) For each of the following cases, write 2 typical sample points ( si) of the sample space of
the underlying experiment, and the value of the random variable X for each sample
point chosen. Choose si such that X ( si ) maps each to different value of X . [8 marks]:

(a) X :¿ heads ∈5 tosses , X Binomial 5 , ( 101 )


s1=TTTHT s2=TTTTT

X ( s1 ) =1 X ( s2 ) =0

(b) X :¿ tosses until∧including first head , X Geometric ( 109 )


s1=H s2=TH

X ( s1 ) =1 X ( s2 ) =2

(c) An Urn has 100 balls labelled in binary from 0000001 to 01100100 .

X :decimal equivalent of label of a ball picked , X U ( 1,100 )

s1=0011001 s2=0000100

X ( s1 ) =25 X ( s2 ) =4

(d) X :¿ trials for two consecutive successes

s1=SFFSFFSS s2=SFSFSFSFFFSS

X ( s1 ) =8 X ( s2 ) =12

Midterm Spring 2019 Page 18 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
Q7. [Marks: 10 + 10 = 20]
(i) A die is rolled twice by paying $ 1. If the first roll results in a 1 the player pays another
$ 1. The house rewards the player with $ 100 if sum of both rolls is greater than 10. (a)
If a random variable X represents net gain of the player (in $), describe X (i.e., find its
support and pmf) [6 marks]. (b) Find expectation of X . [4 marks]

The player may loose his $1 (gain of -1), loos $2 (gain of -2) or give $1 to get $100, i.e.,
gain of $99.

S X ={−2 ,−1 , 99 }

To get $100, the player rolls a sum of 11 or 12, i.e., {( 5,6 ) , ( 6,5 ) ,(6,6) }

The following tree-diagram would elaborate on what can happen:

1 6
p X (−2 ) =P [ X =−2 ] =P [ 11 ]= =
6 36

3 5 4 18+5+
p X (−1 )=P [ X =−1 ] =P [(21 ∩31 ∩ 4 1)∪ ( ( 1,2,3,4,5 )2 ∩5 1)∪( ( 1,2,3,4 )2 ∩61 ) ]= + + =
6 36 36 36

p X ( 99 )=P [ X=99 ] =P [ ( 51 ∩6 1 ) ∪ ( 6 1 ∩5 1) ∪ ( 6 1 ∩6 2 ) ]=P ¿

(b) E [ X ] =(−2 ) ( 366 )+(−1) ( 2736 )+99 ( 363 )=7.167


Since the expectation of X (expected gain of player) is positive, this game of chance
favours the players.

Midterm Spring 2019 Page 19 of 20


National University of Computer and Emerging Sciences
School of Engineering Islamabad Campus
(ii) Random variable X and Y are related as follows:

X
X Geometric ( p ) , Y =⌊ ⌋
2

where ⌊ a ⌋ is the floor function that equals the largest integer equal to or less than a .

Find the pmf of Y [6 marks] and prove that it is a legitimate pmf [4 marks].

SY = {0 , 1 , 2, … }

pY ( 0 )=P [ Y =0 ]=P [ X =1 ] = p X ( 1 )= p

pY ( 1 ) =P [ Y =1 ] =P [ X =2 ] + P [ X =3 ] = p X ( 2 ) + p X ( 3 )=( 1− p ) p+ ( 1− p )2 p

pY ( 2 ) =P [ Y =2 ] =P [ X =4 ] + P [ X=5 ] = p X ( 4 )+ p X (5 )=( 1− p )3 p+ ( 1− p )4 p

Thus
2 y−1 2y
pY ( y ) =P [ Y = y ] =P [ X =2 y ] + P [ X =2 y +1 ]= p X ( 2 y ) + p X ( 2 y +1 )=( 1− p ) p + ( 1− p ) p

Proof of validity:
∞ ∞ ∞

∑ pY ( y )= pY ( 0 )+ ∑ p Y ( y )= p+∑ ( 1− p )2 y−1 p +( 1− p )2 y p
y=0 y=1 y=1

¿ p+ [ ( 1− p ) p + ( 1− p ) p ]+ [ ( 1− p ) p+ ( 1− p ) p ] +…
1 2 3 4

¿ p [ 1+ ( 1− p ) + ( 1− p )2 + ( 1− p )3 + … ]= p
( 1−( 1−p
1
))
=1

Just the same as for Geometric RV.

Midterm Spring 2019 Page 20 of 20

You might also like