IMOClass 12 › Probability

Probability

Conditional Probability

Conditional probability $P(A\mid B)$ is the probability of $A$ given that $B$ has occurred:

$$P(A\mid B)=\frac{P(A\cap B)}{P(B)},\qquad P(B)>0.$$

Multiplication rule

Rearranging gives the probability that both events happen:

$$P(A\cap B)=P(B)\,P(A\mid B)=P(A)\,P(B\mid A).$$

Independent events

Events $A$ and $B$ are independent if one does not affect the other:

$$P(A\cap B)=P(A)\,P(B)\quad\Longleftrightarrow\quad P(A\mid B)=P(A).$$

Do not confuse independent with mutually exclusive: mutually exclusive events ($P(A\cap B)=0$) with non-zero probabilities are in fact dependent.

Example 1: A die is rolled. Find $P(\text{number}>3 \mid \text{number is even})$.

Even outcomes: $\{2,4,6\}$, so $P(B)=\tfrac36$. Even and $>3$: $\{4,6\}$, so $P(A\cap B)=\tfrac26$. Thus $P(A\mid B)=\dfrac{2/6}{3/6}=\dfrac{2}{3}.$

Example 2: If $P(A)=0.5,\ P(B)=0.4,\ P(A\cap B)=0.2$, are $A,B$ independent?

$P(A)P(B)=0.5\times0.4=0.2=P(A\cap B)$. Yes, they are independent.

Example 3: Two cards are drawn without replacement from a deck. Find $P(\text{both kings})$.

$P=\dfrac{4}{52}\times\dfrac{3}{51}=\dfrac{12}{2652}=\dfrac{1}{221}.$

Example 4: If $P(A)=0.6,\ P(B\mid A)=0.5$, find $P(A\cap B)$.

$P(A\cap B)=P(A)P(B\mid A)=0.6\times0.5=0.3.$

Quick recap
  • $P(A\mid B)=\dfrac{P(A\cap B)}{P(B)}$.
  • Multiplication rule: $P(A\cap B)=P(B)P(A\mid B)=P(A)P(B\mid A)$.
  • Independent: $P(A\cap B)=P(A)P(B)$.
  • Mutually exclusive $\ne$ independent.
✓ Quick check
If X follows Binomial(3,0.2), then P(X=0) is:
(0.8)³=0.512.
A fair die is thrown 3 times. Probability of getting a six exactly once is:
³C₁(1/6)(5/6)²=75/216=25/72.

Multiplication Theorem and Independence

When an outcome can arise through several mutually exclusive "causes", two results let us move between forward and reverse probabilities.

Law of total probability

If $E_1,E_2,\dots,E_n$ partition the sample space (mutually exclusive, exhaustive), then for any event $A$:

$$P(A)=\sum_{i=1}^{n} P(E_i)\,P(A\mid E_i).$$

Bayes' theorem

Bayes' theorem reverses the conditioning — from $P(A\mid E_i)$ to $P(E_i\mid A)$:

$$P(E_k\mid A)=\frac{P(E_k)\,P(A\mid E_k)}{\displaystyle\sum_{i} P(E_i)\,P(A\mid E_i)}.$$

The $P(E_i)$ are called prior probabilities and $P(E_k\mid A)$ the posterior — updated belief after observing $A$. This is the basis of medical-test and quality-control problems.

Example 1: Bag I has 3 red, 2 black; Bag II has 1 red, 4 black. A bag is chosen at random and a red ball drawn. Find $P(\text{red})$.

$P(\text{red})=\tfrac12\cdot\tfrac35+\tfrac12\cdot\tfrac15=\tfrac{3}{10}+\tfrac{1}{10}=\dfrac{4}{10}=\dfrac{2}{5}.$

Example 2: For the bags above, given a red ball was drawn, find $P(\text{Bag I}\mid \text{red})$.

By Bayes: $P(\text{I}\mid \text{red})=\dfrac{\tfrac12\cdot\tfrac35}{\tfrac{2}{5}}=\dfrac{3/10}{4/10}=\dfrac{3}{4}.$

Example 3: State the difference between prior and posterior probability.

The prior $P(E_i)$ is the probability of a cause before observing evidence; the posterior $P(E_i\mid A)$ is the revised probability after observing $A$.

Example 4: If $P(E_1)=0.4,P(E_2)=0.6,P(A\mid E_1)=0.5,P(A\mid E_2)=0.5$, find $P(A)$.

$P(A)=0.4(0.5)+0.6(0.5)=0.2+0.3=0.5.$

Quick recap
  • Total probability: $P(A)=\sum_i P(E_i)P(A\mid E_i)$ over a partition.
  • Bayes: $P(E_k\mid A)=\dfrac{P(E_k)P(A\mid E_k)}{\sum_i P(E_i)P(A\mid E_i)}$.
  • Prior = before evidence; posterior = after observing $A$.
  • The $E_i$ must be mutually exclusive and exhaustive.
✓ Quick check
Urn I contains 4 White, 5 Black balls. Urn II has 3 White, 4 Black. One ball is transferred from Urn I to Urn II, then a ball drawn from Urn II is found to be White. The probability the transferred ball was White is:
P(W trans|W drawn) = [P(W drawn|W trans)P(W trans)] / Total P(W drawn) = [(4/8)×(4/9)] / [(4/8×4/9) + (3/8×5/9)] = 16 / (16 + 15) = 16/31.
If P(A|B)=0.8 and P(B)=0.25, then P(A∩B) is:
P(A∩B)=P(A|B)×P(B)=0.8×0.25=0.20.

Bayes’ Theorem and Distributions

A random variable $X$ assigns a number to each outcome of an experiment (e.g. the number of heads in two tosses). A probability distribution lists each value $x_i$ with its probability $p_i=P(X=x_i)$.

A valid distribution

Every $p_i\ge0$ and $\displaystyle\sum_i p_i=1$. This normalisation condition is the first check (and a frequent "find $k$" question).

Mean (expectation)

The mean or expected value is the probability-weighted average:

$$E(X)=\mu=\sum_i x_i\,p_i.$$

Variance

The variance measures spread:

$$\operatorname{Var}(X)=\sum_i x_i^2 p_i-\mu^2,\qquad \text{SD}=\sqrt{\operatorname{Var}(X)}.$$

Example 1: If $P(X=x)=kx$ for $x=1,2,3$, find $k$.

$\sum p_i=k(1+2+3)=6k=1\Rightarrow k=\dfrac16.$

Example 2: Find $E(X)$ for the distribution $X:1,2,3$ with $p:\tfrac16,\tfrac26,\tfrac36$.

$E(X)=1\cdot\tfrac16+2\cdot\tfrac26+3\cdot\tfrac36=\tfrac{1+4+9}{6}=\dfrac{14}{6}=\dfrac{7}{3}.$

Example 3: Two coins are tossed; $X$ = number of heads. Write the distribution.

$P(X=0)=\tfrac14,\ P(X=1)=\tfrac12,\ P(X=2)=\tfrac14$ (since outcomes are HH, HT, TH, TT).

Example 4: For the two-coin $X$, find $E(X)$.

$E(X)=0\cdot\tfrac14+1\cdot\tfrac12+2\cdot\tfrac14=\tfrac12+\tfrac12=1.$

Quick recap
  • A distribution lists $x_i$ with $p_i\ge0$ and $\sum p_i=1$.
  • Mean $E(X)=\sum x_i p_i$.
  • Variance $=\sum x_i^2 p_i-\mu^2$; SD $=\sqrt{\text{Var}}$.
  • Use $\sum p_i=1$ to find unknown constants.
✓ Quick check
A shop owner knows 60% customers buy notebooks and 40% buy pens. If 25% buy both, P(notebook|pen) is:
0.25/0.4=0.625.
A company has 70% male and 30% female employees. 20% males and 10% females know coding. Probability a randomly chosen coder is female is:
Bayes=(0.3×0.1)/(0.7×0.2+0.3×0.1)=3/17.
Ready to test this chapter?
Take the Chapter Test →