Sunteți pe pagina 1din 5

Technische Universitt Mnchen

Fakultt fr Informatik
Dr. Tobias Lasser
Richard Brosig, Jakob Vogel

WiSe 2011/12
Solution for Exercise Sheet 9
January 24, 2012

Exercises in Basic Mathematical Tools

Assignment 1

Mississippi

How many possibilities are there to order the letters of Mississippi?


If we could distinguish all letters we would have 11! possibilities. (11 possibilities for the first
letter, 10 for the second, ...) However, since we cannot distinguish identical letters we will have
less options to sort the letters.
Starting with the single M, we have 11 options to place it on one of the 11 spots.
Next, we have 10 free spots to place the four i letters, yielding exactly
 
10!
10
10 9 8 7
=
=
4!
(10 4)!4!
4
options. (If we could distinguish the single letters, there would be 10!/6! options. Since we cannot,
we have to divide by the number of permutations, which are exactly 4!.)

We continue like that for the remaining letters: For the 4 s characters, we have 64 spots, and

for the two p letters, there are 2 spots left ( 22 = 1).
In the end, we have
      
11
10
6
2

1
4
4
2

11! 10! 6!
2!

10!1! 6!4! 2!4! 2!0!

= 34650 possibilities.

Assignment 2

Expected Value

Given 500 randomly picked persons,...


a) ...what is the probability that more than one of them have birthday on Christmas?
pa = 1 P(No person has birthday on Christmas)
P(One person has birthday on Christmas)
1
1
= 1 B(0,
, 500) B(1,
, 500)
365
365
364
364
= 1 B(500,
, 500) B(499,
, 500)
365
365




364 500
364499
= 1
500
365
365500

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

We are throwing two dices.


a) Compute the probabilities of the following events:
A: The first throw is odd.
P(A) =

3 1
=
6 2

P(B) =

3 1
=
6 2

B: The second throw is odd.

C: The sum of both is odd.


P(C) = P(first is even, second odd) + P(first is odd, second even)
1 1 1 1
= +
2 2 2 2
b) Show that the events A, B and C are pairwise independent, but not independent!
To show it this events are pairwise independent, we have to show that
P(A B) = P(A)P(B)
P(A C) = P(A)P(C)
P(C B) = P(C)P(B)

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)

Assuming a Poisson Distribution with expected value = 200/300 we get


P(More than one bug in a particular method) = 1

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

max( B(i, p, n) < 0.01)


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

Given are three dices with special labellings:


Dice 1: 1,4,4,4,4,4
Dice 2: 2,2,2,5,5,5

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

b) B =The number on dice 2 is lower than dice 3.


The number on dice 2 is lower than on dice 3 if
the face of dice 2 is 2
or the face of dice 2 is 5 and dice 3 is 6
So we get
P(A) =

3
3 1 21
1+ =
58.33%
6
6 6 36

c) C =The number on dice 3 is lower than dice 1.


The number on dice 3 is lower than on dice 1 if
the face of dice 3 is 3 and dice 1 is 4
So we get
P(A) =

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.

S-ar putea să vă placă și