# Methodology of Scientific Research

## Complex events

We are interested in non-trivial events, that are usually combinations of smaller events

For example, we may ask “what is the probability that, in a group of 𝑛 people, at least two persons have the same birthday”

Fortunately, any complex event can be decomposed into simpler events, combined with and, or and not connectors

Exercise: decompose the birthday event into simpler ones

## Probability of not 𝐴

If the event 𝐴 becomes more and more plausible, then the opposite event not 𝐴 becomes less and less plausible

It can be shown that we always have $ℙ(\text{not } A) = 1-ℙ(A)$

## Probability of 𝐴 and 𝐵

$ℙ(A\text{ and } B)=\frac{\text{Number of cases where }(A\text{ and } B)\text{ is true}}{\text{Total cases of combinations of }A\text{ and } B}$

If $$n_A$$ and $$n_B$$ are the total number of cases for $$A$$ and $$B$$, then the total number of cases is $$n_A⋅n_B$$

In the same way, if $$m_A$$ and $$m_B$$ are the number of cases where $$A$$ and $$B$$ are true, respectively, then the number of cases where $$(A\text{ and }B)$$ is true is $$m_A⋅m_B$$

$ℙ(A\text{ and } B)=\frac{m_A⋅m_B}{n_A⋅n_B}=\frac{m_A}{n_A}⋅\frac{m_B}{n_B}$

## Interpretation

We could say that $\frac{m_A}{n_A}=ℙ(A)\qquad\frac{m_B}{n_B}=ℙ(B)$ but we have to be careful. The result of A may affect $$m_B$$ and $$n_B$$. We better write $\frac{m_A}{n_A}=ℙ(A)\qquad\frac{m_B}{n_B}=ℙ(B|A)$

## Rewriting the Probability of 𝐴 and 𝐵

$ℙ(A\text{ and } B)=\frac{m_A}{n_A}⋅\frac{m_B}{n_B}=ℙ(A)⋅ℙ(B|A)$ To simplify, instead of $$ℙ(A\text{ and } B)$$ we write $$ℙ(A, B)$$

Thus, we write $ℙ(A,B)=ℙ(A)⋅ℙ(B|A)$ “Prob that (𝐴 and 𝐵) happens is Prob that 𝐴 happens times Prob that 𝐵 happens given that A happens”

## Joint Probability

We know that $$(A\text{ and } B)$$ is always the same as $$(B\text{ and } A)$$

There are two ways to calculate the probability of of 𝐴 and 𝐵 happening simultaneously

• Start with the prob. of $$A$$ and then of $$B$$ given that $$A$$ is true $ℙ(A,B)=ℙ(A)⋅ℙ(B|A)$
• Start with the prob. of $$B$$ and then of $$A$$ given that $$B$$ is true $ℙ(A,B)=ℙ(B)⋅ℙ(A|B)$

## Exercises

• Prob of getting heads twice when throwing coins
• Prob of getting 6 and 6 on two dice
• Prob of getting heads and a 6
• Prob of getting a green card

## Probability of 𝐴 or 𝐵

We know how to calculate $$ℙ(A\text{ and } B)$$ and $$ℙ(\text{not } A)$$

We also know the De Morgan’s law, to swap ANDs with ORs
$\text{not } (A \text{ or } B) = (\text{not } A) \text{ and } (\text{not } B)$

Therefore we can write

\begin{aligned} ℙ(A \text{ or } B) & = 1 - ℙ(\text{not }(A \text{ or } B))\\ & = 1-ℙ( (\text{not } A) \text{ and } (\text{not } B)) \end{aligned}

## Using the multiplication rule

$ℙ(A \text{ or } B) = 1-ℙ( (\text{not } A) \text{ and } (\text{not } B)) \\ = 1-ℙ(\text{not } A)⋅P(\text{not } B|\text{not } A)$

using negation rule \begin{aligned} ℙ(A \text{ or } B) & = 1-ℙ(\text{not } A)⋅(1- ℙ(B|\text{not } A)) \\ & = 1-ℙ(\text{not } A) + ℙ(\text{not } A)⋅P(B|\text{not } A) \end{aligned}

## Using the multiplication rule again

\begin{aligned} ℙ(A \text{ or } B) & = 1 -ℙ(\text{not } A) + ℙ(\text{not } A,B) \\ ℙ(A \text{ or } B) & = 1 -(1-ℙ(A)) + ℙ(\text{not } A|B)ℙ(B) \\ ℙ(A \text{ or } B) & = ℙ(A) + (1-ℙ(A|B))ℙ(B) \\ ℙ(A \text{ or } B) & = ℙ(A) + ℙ(B)-ℙ(A|B)ℙ(B) \\ ℙ(A \text{ or } B) & = ℙ(A) + ℙ(B)-ℙ(A,B) \end{aligned} You need to remember only the last line

The previous lines justify why the last one is always true

## Do not count twice

If A and B can happen at the same time, then $$ℙ(A) + ℙ(B)$$ counts the intersection twice

So we have to take out the intersection $$ℙ(A,B)$$ $ℙ(A \text{ or } B) = \\ ℙ(A) + ℙ(B)-ℙ(A,B)$

## It gets complicated

If there are three compatible events, things get messy

\begin{aligned} & ℙ(A \text{ or } B \text{ or } C) \\ & ℙ(A) + ℙ(B \text{ or } C)-ℙ(A,(B \text{ or } C)) \\ & ℙ(A) + ℙ(B) + ℙ(C)-ℙ(B,C) - ℙ(A,B \text{ or } A,C) \\ & ℙ(A) + ℙ(B) + ℙ(C)-ℙ(B,C) - (ℙ(A,B) + ℙ(A,C) - ℙ(A,B,C)) \\ & ℙ(A) + ℙ(B) + ℙ(C)-ℙ(B,C) - ℙ(A,B) - ℙ(A,C) + ℙ(A,B,C) \end{aligned}

It gets worse with more events

## If A and B are incompatible

if A and B cannot happen at the same time, then $$(A \text{ and } B)$$ is impossible, therefore $$ℙ(A,B)=0$$

In that case (and only in that case) $ℙ(A \text{ or } B) = ℙ(A) + ℙ(B)$

## Splitting a set into pieces

In particular we have $ℙ(A) = ℙ(A\text{ and } (B \text{ or } \text{not } B)) = ℙ(A,B) + ℙ(A, \text{not } B)$ because

• $$(A \text{ and } B)$$ is incompatible with $$(A \text{ and } \text{not } B)$$,
• $$(A \text{ and } (B \text{ or } \text{not } B))$$ is equal to $$A$$

## Splitting $$Ω$$

If we partition Ω into 𝑛 subsets $$A_i$$, such that they cover all Ω $\Omega=A_1 ∪ A_2 ∪ … ∪ A_n$ and each pair of events are mutually incompatible $A_i ∩ A_j=\phi$ then we have $ℙ(\Omega)=ℙ(A_1) + ℙ(A_2) + … + ℙ(A_n)=1$

## There is an easier way

Using De Morgan’s rule

\begin{aligned} & ℙ(A \text{ or } B \text{ or } C) \\ & 1 - ℙ((\text{not } A) \text{ and } (\text{not } B) \text{ and } (\text{not } C))\\ & 1 - ℙ(\text{not } A)⋅ℙ(\text{not } B | \text{not } A)⋅ℙ(\text{not } C | \text{not } A, \text{not } B)\\ & 1 - (1-ℙ(A))⋅(1-ℙ(B | \text{not } A))⋅(1-ℙ(C | \text{not } A, \text{not } B)) \end{aligned}

This is often easier to calculate

## Example: Multiple Birthdays

Let’s say we have three people, with birthday $$x_1, x_2$$ and $$x_3.$$

The probability that there are at least two people with the same birthday is $ℙ(x_2=x_1 \text{ or } x_3=x_2 \text{ or } x_3=x_1)$ which can be rewritten as $1-ℙ(x_2≠x_1 \text{ and } x_3≠x_2 \text{ and } x_3≠x_1)$

## Now we onlu have and combinations

We want to calculate $1-ℙ(x_2≠x_1 \text{ and } x_3≠x_2 \text{ and } x_3≠x_1)$ We can separate like this (only the first and) $1-ℙ(x_2≠x_1)⋅ℙ(x_3≠x_2 \text{ and } x_3≠x_1|x_2≠x_1)$ Assuming 365 possible birthdays, we have $1-\frac{364}{365}⋅\frac{363}{365}$

## Exercise

• What is the probability that, in a group of N people, at least two of them share the same birthday?

• How many people do we need to have at least 50% probability of least two of them sharing the same birthday?