Documente Academic
Documente Profesional
Documente Cultură
Fakultt fr Informatik
Dr. Tobias Lasser
Richard Brosig, Jakob Vogel
WiSe 2011/12
Solution for Exercise Sheet 9
January 24, 2012
Assignment 1
Mississippi
1
4
4
2
11! 10! 6!
2!
= 34650 possibilities.
Assignment 2
Expected Value
Solution 9/ page 2
b) ...what is the expected number of persons having birthday on Christmas?
The expectation that a single person has birthday on Christmas is p = 1/365. This is also
Bernoulli Experiment. The expected value of multiple Bernoulli experiments is
np = 500
1
.
365
c) ...what is the expected number of days of the year that are birthdays of at least one person?
The expected value that no one has his birthday on a particular day is
364 500
365
so the probability that at least someone has birthday on a particular day is
pc = 1
364 500
365
since we have 365 days, each with a probability of pc we get an expected value of 365pc for
the number of days which are at least someones birthday.
d) ...what is the expected number of days of the year that are birthdays of more than one of
these persons?
365pa
with the same explanation of (c)
Assignment 3
Stochastic Independent
3 1
=
6 2
P(B) =
3 1
=
6 2
Solution 9/ page 3
To show that they are independent, we have to show
P(A B C) = P(A)P(B)P(C)
Starting with the pairwise independency
P(A B) = P(first odd and second odd) =
1 1
= = P(A)P(B)
2 2
P(A C) = P(first odd and the sum is odd) =
= P(first odd and the second even) =
= P(first odd and the second not odd) =
= P(A)P(Bc )
1 1
= = P(A)P(C)
2 2
P(B C) = P(second odd and the sum is odd) =
= P(second odd and the first even) =
= P(second odd and the first not odd) =
= P(B)P(Ac )
1 1
= = P(B)P(C)
2 2
P(A B C) = P(first is odd, second is odd and the sum is odd) = 0
1
6= P(A)P(B)P(C) =
8
Assignment 4
Distribution Functions
a) Suppose that a code with 300 methods contains 200 bugs. Use Poisson approximation to
write down the probability that there is more than one bug in a particular method.
Quite often, the computation of the complementary event is much easier, especially for
events like more than one or two. If you want to compute this directly, you have to
compute
P(More than one bug in a particular method)
=P(two bugs in a particular method)
+ P(three bugs in a particular method)
+ P(4 bugs in a particular method)
..
.
+ P(200 bugs in a particular method)
Solution 9/ page 4
This is the same as
P(More than one bug in a particular method)
=1 P(no bugs in a particular method)
P(one bug in a particular method)
0 2 1 2
5 2
e 3 e 3 = 1 e 3
0!
1!
3
b) Assume a city with two hospitals and 1000 patients per day. Suppose that each patient
chooses one of the two facilities with a chance of 50% independently from each other. How
many beds should each hospital have ready such that the probability to refuse a patient is
less than 1%?
This problem can also be seen as a flipping a coin 1000 times and summing up all heads.
Here, we assume the Bernoulli distribution for a single experiment. The sum of several
Bernoulli distributions is Binomially distributed. Since we want to have the probability of
refusing a patient to be less than 1%, we have to find
i
where
j=0
n i
B(i, p, n) =
p (1 p)ni
i
is the Binomial probability distribution function. Use Matlab for the computation.
x=0;
i=1001;
while(x<0.01)
i=i-1;
x=x+binopdf(i,1000,0.5);
end
fprintf(Both hospitals needs \%d beds$\backslash$ n,i);
c) In a school where 4% of the children write with their left hands, what is the probability that
there are no left-handed children in a class of 25?
Here, we have to compute
25
B(0, 0.04, 25) =
0.040 (1 0.04)25 = 0.9625 = 36%
0
Assignment 5
Three Dices
Solution 9/ page 5
Dice 3: 3,3,3,3,3,6
Compute the probabilities for these events:
a) A =The number on dice 1 is lower than on dice 2.
The number on dice 1 is lower than on dice 2 if
the face of dice 1 is 1
or the face of dice 1 is 4 and dice 2 is 5
So we get
P(A) =
5 3 21
1
1+ =
58.33%
6
6 6 36
3
3 1 21
1+ =
58.33%
6
6 6 36
5 5 25
=
69.44%
6 6 36
Given a game for two players, where one player has to choose a dice, and afterwards the other has
to choose one of the left dices, is never fair. If the second player has the right strategy, he is in
every case more likely to win.