P(>=2) = 1 - [P(==0) + P(==1)]
P(==0) means you didn't get even a single night's full sleep. ie, dog woke you up on 5 days.
P(==1) means you were able to sleep well on one day, but the dog woke you up on the other 4 days.
P(==0) = 5C5 * (2/3)⁵
Number of sleepless nights = 5 days
5 days can be chosen in 5C5 ways
--
P(==1) = 5C4 * (2/3)⁴ * (1/3)
Number of sleepless nights = 4 days
5 days can be chosen in 5C4 ways
Therefore,
P(>=2) = 1 - [P(==0) + P(==1)]
= 1 - [(2/3)⁵ + 5*(1/3)*(2/3)⁴]
= 0.54
Generally,
Independent events:
Dependent events:
Independent events and disjoint events are not same
If two events are disjoint, they are dependent unless one of the event is of zero probability.
A coin fip and a die roll simultaneously:
Example:
P(coin=H ∧ die=1)
= P(coin=H)* P(die=1)
= 1/2 * 1/6
= 1/12
---
P(die=3 ∨ die=5)
= P(die=3)+ (die=5)
= 1/6 + 1/6
= 1/3
—
Probability of event union for non-disjoint events:
P(A ∪ B) = P(A) + P(B) - P(A ∩ B)
P(coin=H)
and P(die=1)
in our example are not disjoint events.
∵ Coin can be head while die shows 1.
P(coin=H ∨ die=1)
= P(coin=H) + P(die=1) - P(coin=H ∧ die=1)
= P(coin=H) + P(die=1) - [P(coin=H) * P(die=1)]
= (1/2) + (1/6) - (1/2)*(1/6)
= (4/6) - (1/12)
= 7/12
Could also be done like:
P(coin=H ∨ die=1)
= 1 - P(¬(coin=H ∨ die=1))
= 1 - P(¬(coin=H) ∧ ¬(die=1))
= 1 - [P(¬(coin=H)) * P(¬(die=1))]
= 1 - [1 - P(coin=H)] * [1 - P(die=1)]
= 1 - [1 - (1/2)] * [1 - (1/6)]
= 1 - [1/2] * [5/6]
= 1 - [5/12]
= 7/12
P(A ∧ ¬A) = 0
Dependent events.
P(A ∩ ¬A)
= P(A) * P(¬A/A)
= P(A) * 0
= 0
—
P(A ∨ ¬A) = 1
Dependent events.
P(A ∪ ¬A)
= P(A) + P(¬A) - P(A ∩ ¬A)
= x + (1-x) - 0
= 1
Puzzle:
Four people are playing rock-paper-scissors. They each play one of the three options (rock, paper, or scissors) independently at random, with equal probability of each choice. Compute the probability that someone beats everyone else.
Solution:
Scissor
∧ ∨
Stone < Paper
Observe that:
—
Let player 1 choose a particular move => 1/3
The other 3 players have to choose the same move and there is only one such move => (1/3)³
There are 4 players and player-1 can start with one of 3 possible moves
P = 4*3 * (1/3 * (1/3)³)
= 12/81 = 4/27
—
Related:
Puzzle:
Solution:
n!
General forumla:
∞ │ n │
Σ │───│
i=1 │ 5ⁱ│
└ ┘
—
Example: 100!
100/5 + 100/5² + 100/5³ + ....
= 20 + 4
= 24
So, there are 24 trailing zeros in 100!
—
An easier way: Keep dividing recursively to get the numbers and sum up.
100/5 = 20
20/5 = 4
4/5 = 0
─────
24
ie, f(n) = n/5 + f(n/5)
—
Consider 25!.
25/4 is 5
Likewise 4 consists of two 2s too. But we needn't care in this case, because number of 5s will always be lesser than that of 2s.
See:
See:
2^H