Dependent events

Motivation

In previous lesson we explained independent events where the outcome of one of them doesn’t affect the outcome of another. However, in real life, sometimes we have events that are connected. For example, probability the person will walk to work given that they live close by. Event is walking to work, under the condition that they live close to it. We can add another condition, if the lived by and had broken a leg. As we can see, possibilities are endless.

Let’s say we have two events, $A$ and $B$, in sample space $S$. Let’s say event $B$ happened, represented orange on the Venn’s diagram. The probability of $A$ happening, given that we know that $B$ already happened is the ratio between the size of the region where $A$ is present in $B$, $(A$ and $B)$, and the size of all possible events $B$.

$P(A$ if $B$ already happened$)=\displaystyle{\frac{P(A\ and\ B)}{P(B)}}$

Explanation

In lesson independent events, we had an example where we picked marbles out of a bag. After each pick, we would replace picked marble with a new one. What would happen if we left the marbles outside of the bag instead of putting them back in? Would the possibility of picking the right colored marbles be the same, or would it change?

Let’s have a bag with $5$ yellow and $3$ blue marbles. We want to know the possibility of picking $2$ yellow marbles, but without returning them to the bag. Lets define two events:
Event $A = \{$the first marble is yellow$\}$ and event $B = \{$the second marble is yellow$\}$. The probability of $A$ is $\displaystyle{\frac{5}{8}}$ since $5$ out of $8$ marbles are yellow.

Now, what is the probability that both events occurred, $P(A$ and $B)$? The first idea that comes to our mind is to calculate the probability the way we learned before:

$P(A$ and $B)=P(A) \cdot P(B)$

The probability of $B$ would be the same as the probability of $A$ since there are $5$ yellow marbles in a bag of $8$. But is that correct? What’s important is what we did with the first marble. We didn’t pick it up, look at it and then put it back in like we did in the previous lesson. This time we chose to leave the marble out of the bag. Consequently, the number of marbles in the bag has changed and the probability of $B$ can’t be calculated the same way as $P(A)$. It also means events $A$ and $B$ are not independent, the second event is affected by the first event. We have two options:

1.) If the first pick is yellow, the bag now has $7$ marbles, $4$ of which are yellow.
2.) If the first pick isn’t yellow, we are left with $5$ yellow marbles in a bag of $7$.

Since we already said we want both marbles to be yellow, we will pick first option.

The probability that both events happened is equal to probability of picking the yellow marble, leaving it out and then picking out the second yellow marble. We picked the second yellow marble under condition that we already picked one in the first turn. We write it as:

$P(A$ and$B)=P(B$ if $A$ already happened$) \cdot P(A)$

Like we said before, if the first pick is yellow, the bag now has $7$ marbles, $4$ of which are yellow. Consequently, probability of $B$ given $A$ is

$P(B$ if $A$ already happened $)=\displaystyle{\frac{4}{7}}.$

The probability of both events, $A$ and $B$, occurring is:

$P(A$ and $B)=P(B$ if $A$ already happened$) \cdot P(A)= \displaystyle{\frac{4}{7} \cdot \frac{5}{8}=\frac{5}{14}}$

Conditional probability

Instead of always writing $P(B$ if $A$ already happened$)$ we write $P(B|A)$.

The notation $P(B|A)$ represents the probability of event $B$ given that event $A$ has already happened. In terms of previous example, it would mean “picking the second yellow marble given that the first one was yellow”.

Be careful, the notation used above doesn’t mean “probability of B divided by A”. The vertical line $|$ means “given“.

The quotient

$P(B|A)=\displaystyle{\frac{P(A\ and\ B)}{P(A)}}$

is conditional probability.

Usually, $P(A$ and $B)$ is written as $P(A \cap B)$, so we have

$P(B|A)=\displaystyle{\frac{P(A \cap B)}{P(A)}}$

For independent events, probability of $A$ given $B$ is the same as $P(A)$. The outcome of $B$ doesn’t affect the outcome of $A$ and in that case the outcome of $A$ depends solely on itself.

$$P(A|B)=P(A)$$

Analogously,

$$P(B|A)=P(B)$$

If we put the expressions back into the formula of conditional probability, we get multiplication rule for independent events: $$P(A \cap B)=P(A) \cdot P(B)$$

Examples

Example. The probability that it’s friday and the student is absent is 0.03. What is the probability that a student is absent given that today is friday.

We have two events: $A$=$\{$today is friday$\}$ and $B$=$\{$student is absent$\}$.  Since there are $5$ working days in a week, the probability of one of them being a friday is $$P(A)=\displaystyle{\frac{1}{5}}=0.2.$$ The probability of $P(B \cap A)=0.03$.

Using the conditional probability, we have:
$$P(A \cap B)=P(B|A) \cdot P(A)$$ $$\displaystyle{P(B|A) =\frac{P(A \cap B)}{P(A)} = \frac{0.03}{0.2} = 0.15 =15\%}$$

Example. A math teacher gave class two tests. $30\%$ of the class passed both exams, and $43\%$ passed the first one. What percent of those who passed the first test also passed the second test?

Lets say $A$=$\{$passed first exam$\}$ and $B$=$\{$passed second exam$\}$ are our events. Probability of passing both tests is $P(A \cap B)=0.3$. Probability of passing the first one is $P(A)=0.43$.

We need the probability of a passing the second test if we passed the first, $P(B|A)$. Using the conditional probability, we have:

$P(A \cap B)=P(B|A) \cdot P(A)$

$$\displaystyle{P(B|A) =\frac{P(A \cap B)}{P(A)} = \frac{0.3}{0.43} = 0.6977 =69.77\%}$$

Example. A box contains $5$ pens, $3$ pencils and $6$ markers. Sarah takes one item at random from the box and doesn’t return it back to the box. She then takes one more random item from the box. What is the probability that Sarah selects pencil first and then marker second.

Lets say event $A=\{$Sarah picked a pencil$\}$ and $B=\{$Sarah picked a marker$\}$. We need the probability that both happened, which is $P(A \cap B)$. The first event that happened is $A$, since we picked the pencil first. The probability of $A$ is $\frac{3}{14}$.
Afterwards, we had $13$ items left in the box. The probability of $B$ given that we already took one pencil is $\frac{6}{13}$. Finally, the probability that both events happened is:

$P(A$ \cap $B)=P(B|A) \cdot P(A) = \displaystyle{\frac{3}{14} + \frac{6}{13} = \frac{9}{91} }$