Statistics For Programmers - Conditional Probability

The conditional probability of an event is the probability of an event occuring given that another event has occured. The It is denoted as \(P(B|A)\) and is read as "the probability of B given A". That is the probability of event B occuring knowing that event A has occured.

The formula for conditional probability is

\[
P(B|A) = \frac{P(A \cap B)}{P(A)}
\]

Where (P(A \cap B)) is the probability of both events A and B occuring.

Let's break this down with an example. Given a standard 52 card deck of playing cards, we want to find the probability of drawing 2 aces in a row. We will be drawing cards without replacing them - this is an important detail.

The probability \(P(A)\) is the probability of the first event (drawing an ace).

\[
P(A) = \frac{4}{52} = \frac{1}{13}
\]

This post is for subscribers only

Already have an account? Sign in.

Subscribe to Another Dev's Two Cents

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe