solution09_wise2011

  • Upload
    hisuin

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • 8/18/2019 solution09_wise2011

    1/5

    Technische Universität München WiSe 2011/12Fakultät für Informatik Solution for Exercise Sheet 9

    Dr. Tobias LasserRichard Brosig, Jakob Vogel

    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 rst letter, 10 for the second, ...) However, since we cannot distinguish identical letters we will haveless 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 · 9 · 8 · 74!

    = 10!

    (10 − 4)!4! =

    104

    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

    111

    ·104

    ·64

    ·22

    = 11!10!1!

    · 10!6!4!

    · 6!2!4!

    · 2!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 − B(0, 1365

    , 500 ) − B(1, 1365

    , 500 )

    = 1 − B(500 , 364365

    , 500 ) − B(499 , 364365

    , 500 )

    = 1 −364365

    500

    − 500364 499

    365 500

  • 8/18/2019 solution09_wise2011

    2/5

    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

    364365

    500

    so the probability that at least someone has birthday on a particular day is

    pc = 1 −364

    365

    500

    since we have 365 days, each with a probability of p c we get an expected value of 365 pc 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?

    365 pa

    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 rst throw is odd.”P ( A) =

    36

    = 12

    B: “The second throw is odd.”

    P ( B) = 36 =

    12

    C: “The sum of both is odd.”

    P (C ) = P(rst is even, second odd ) + P (rst is odd, second even )

    = 12

    ·12

    + 12

    ·12

    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)

  • 8/18/2019 solution09_wise2011

    3/5

    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( rst odd and second odd ) ==

    12

    ·12

    = P( A)P ( B)

    P ( A∩C ) = P( rst odd and the sum is odd ) == P( rst odd and the second even ) == P( rst odd and the second not odd ) == P( A)P ( Bc)

    = 1

    1

    2 = P( A)P (C )

    P ( B∩C ) = P(second odd and the sum is odd ) == P(second odd and the rst even ) == P(second odd and the rst not odd ) == P( B)P ( Ac)

    = 12

    ·12

    = P( B)P (C )

    P ( A∩ B∩C ) = P( rst is odd, second is odd and the sum is odd ) = 0

    = P( A)P ( B)P (C ) = 18

    Assignment 4 Distribution Functions

    a) Suppose that a code with 300 methods contains 200 bugs. Use Poisson approximation towrite 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 tocompute

    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 )

  • 8/18/2019 solution09_wise2011

    4/5

    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

    0!e−

    23 −

    λ 1

    1!e−

    23 = 1 −

    53

    e−23

    b) Assume a city with two hospitals and 1000 patients per day. Suppose that each patientchooses one of the two facilities with a chance of 50% independently from each other. Howmany 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 ipping 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 nd

    maxi

    (i

    ∑ j= 0

    B(i, p, n) < 0.01)

    where

    B(i, p, n) =ni p

    i

    (1 − p)n− i

    is the Binomial probability distribution function. Use Matlab for the computation.

    x=0;i=1001;while(x

  • 8/18/2019 solution09_wise2011

    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) = 16

    · 1 + 56

    ·36

    = 2136

    ≈ 58 .33%

    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) = 36

    · 1 + 36

    ·16

    = 2136

    ≈ 58 .33%

    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 4So we get

    P ( A) = 56

    ·56

    = 2536

    ≈ 69 .44%

    Given a game for two players, where one player has to choose a dice, and afterwards the other hasto choose one of the left dices, is never fair. If the second player has the right strategy, he is inevery case more likely to win.