oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Multiplication Rule #418

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Multiplication Rule

We have looked at the addition rule, which describes the probability one event or another event (or both) occurs. What if we want to calculate the probability that two events happen simultaneously? For two events, A and B, this is P(A and B) or the probability of the intersection of A and B.

General Formula

The general formula for the probability that two events occur simultaneously is:

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

However, for independent events, we can simplify this formula slightly.

oldoc63 commented 1 year ago

Dependent Events

Let's go back to our bag of marbles example. We have five marbles: two are blue, and three are red. We pick two marbles without replacement. What if we want to know the probability of choosing a blue marble first AND a blue marble second?

$$ P(Blue 1st and Blue 2nd) = P(Blue 1st).P(Blue 2nd|Blue 1st) $$

$$ P(Blue 1st and Blue 2nd) = \frac{2}{5}.\frac{1}{4} $$

$$ P(Blue 1st and Blue 2nd) = \frac{1}{10} $$

This is one potential outcome when picking two marbles out of the bag. One way to visualize all possible outcomes of a pair of events is a tree diagram.

Tree diagrams have the following properties:

oldoc63 commented 1 year ago

Independent Events

For two independent events, the multiplication rule becomes less complicated. The probability of two independent events occurring is:

$$ P(A and B) = P(A).P(B) $$

This is because the following is true for independent events:

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

Let's look at the simplest example: flipping a fair coin twice. Event A is that we get tails on the first flip, and event B is that we get tails on the second flip. P(A) = P(B) = 0.5, so according to our formula, the probability of getting tails on both flips would be:

$$ P(A and B) = 0.5 * 0.5 = 0.25 $$

Visually on a tree diagram, we see:

Image