Skip to content
UoL CS Notes

Events

COMP111 Lectures

An event is a subset $E ⊆ S$ of the sample space $S$. The probability of the even $E$ is given by:

\[P(E)=\sum_{x\in E}P(x)\]
  • $0 ≤ P(E) ≤ 1$ for every event $E$
  • $P(\emptyset) = 0$ and $P(S) = 1$

Example - Fair Dice

If I roll a die three times, the event $E$ of rolling at least one 6 is given by:

  • The set of sequences of length 4 over $\{1,\ldots,6\}$ containing at least one 6.
  • $P(E)$ is the number of sequences containing at least one 6 divided by $6\times6\times6\times6=216$.

If we roll a fair die, then the event E of rolling an odd number is given by:

  • The set $E=\{1,3,5\
  • $P(E)=P(1)+P(3)+P(5)=\frac{1}{6}+\frac{1}{6}+\frac{1}{6}$ $=\frac{1}{2}$

Probability of Composed Events

  • The complement of an event can be computed from the probability of the event.
  • The union of events can be computed from the probabilities of the individual events.

Complement

Let $\neg E = S - E$. Then $P(\neg E)=1-P(E)$

Venn Diagram 1

Additionally, $S=\neg E\cup E$.

Proof

\[1=\sum_{x\in S}P(x)=\sum_{x\in E}P(x)+\sum_{x\in \neg E}P(x)\]

Thus,

\[\sum_{x\in\neg E}P(x)=1-\sum_{x\in E}P(x)\]

Example

What is the probability that at least one bit in a randomly generated sequence of 10 bits is 0?

  • $S = \{0, 1\}^{10} =$ all sequences of 0 and 1 of length 10.
  • For every $x ∈ S, P(x) = (\frac{1}{2})^{10} = \frac{1}{2^{10}}$.
  • $E =$ all sequences of 0 and 1 of length 10 containing at least one 0.
  • $\neg E=\{1111111111\}$
  • $P(\neg E)=\frac{1}{2^{10}}$
  • $P(E)=1-\frac{1}{2^{10}}$

Union

\(P(E_1\cup U_2)=P(E_1)+P(E_2)-P(E_1\cap E_2)\)

Venn Diagram 2

Additionally, $\vert E_1\cup E_2\vert = \vert E_1\vert +\vert E_2\vert -\vert E_1\cap E_2\vert $

Proof

  • $P(E_1)=\sum_{x\in E_1}P(x)$
  • $P(E_2)=\sum_{x\in E_2}P(x)$
  • $P(E_1\cup E_2)=\sum_{x\in E_1\cup E_2}P(x)$

Thus,

\[\begin{aligned} P(E_1\cup E_2)=&\sum_{x\in E_1\cup E_2}P(x)\\ =&\sum_{x\in E_1}P(x)+\sum_{x\in E_3}P(x)\\ &-\sum_{x\in E_1\cup E_2}P(x)\\ =&P(E_1)+P(E_2)-P(E_1\cap E_2) \end{aligned}\]

Example

Suppose I have a jar of 30 sweets:

  Red Blue Green
Circular 2 4 3
Square 6 7 8

The sample space $S$ has 30 elements and if one chooses a sweet uniformly at random then then the probability for all $x\in S$ is:

\[P(x)=\frac{1}{30}\]

What is the probability of choosing a red or circular sweet?

  • The probability that it is red is $\frac{2+6}{30}=\frac{8}{30}(P(R)=\frac{8}{30})$
  • The probability that it is cicular is $\frac{2+4+3}{30}=\frac{9}{30}(P(C)=\frac{9}{30})$

Then $P(R\cup C)$ is the probability that the sweet is red or circular:

\[\begin{aligned} P(R\cup C) &= P(R)+P(C)-P(R\cap C)\\ &= \frac{8}{30}+\frac{9}{30}-\frac{2}{30}\\ &=\frac{15}{30}=\frac{1}{2} \end{aligned}\]