Learn

If we want to calculate the probability that a pair of dependent events both occur, we need to define conditional probability. Using a bag of marbles as an example, let’s remind ourselves of the definition of dependent events:

A diagram of the possible outcomes of pulling two marbles out of a bag when pulling them out without replacement.

If we pick two marbles from a bag of five marbles without replacement, the probability that the second marble is red depends on the color of the first marble. We have a special name for this: conditional probability. In short, conditional probability measures the probability of one event occurring, given that another one has already occurred.

Notationally, we denote the word “given” with a vertical line. For example, if we want to represent the probability that we choose a red marble given the first marble is blue, we can write:

P(Red SecondBlue First)P(\text{Red Second} \mid \text{Blue First})

From the above diagram, we know that:

P(Red SecondBlue First)=34P(\text{Red Second} \mid \text{Blue First}) = \frac{3}{4}

What if we picked out two marbles with replacement? What does the conditional probability look like? Well, let’s think about this. Regardless of which marble we pick out first, it will be put back into the bag. Therefore, the probability of picking out a red marble or a blue marble second is unaffected by the first outcome.

Therefore, for independent events, we can say the following:

P(AB)=P(A)andP(BA)=P(B)\begin{aligned} P(A \mid B) = P(A) \\ \text{and} \\ P(B \mid A) = P(B) \\ \end{aligned}

Instructions

To the right is an applet that contains a bag of blue and orange marbles. When you click on any marble, it is removed from the bag, and the probability of selecting either color is updated.

Remove two blue marbles from the bag. What is the probability of selecting an orange marble randomly now? Did it increase or decrease?

Reset the applet by clicking the Reset button. Remove one blue marble and one orange marble now. Did the probability of selecting a blue marble randomly increase or decrease? Did the probability of selecting an orange marble randomly increase or decrease?

Feel free to play around with the applet as much as you want!

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?