Conditional Probability: Formula and Real-Life Examples

Conditional Probability

Investopedia / Madelyn Goodnight

Conditional probability is used when two or more events are not independent. This means the likelihood of one event is influenced by whether another event occurred. It asks, "If we know A has happened, what's the chance of B also happening?" It's calculated by multiplying the probability of the preceding event by the updated probability of the succeeding, or conditional, event. We'll walk you through the calculation below.

Key Takeaways

  • Conditional probability refers to the chances that some outcome (A) occurs given that another event (B) has also occurred.
  • In probability, this is written as A given B, or as this formula: P(A|B), where the probability of A depends on that of B happening.
  • Conditional probability can be contrasted with unconditional probability.
  • Probabilities are classified as conditional, marginal (the base probability without any dependence on another event), or joint (the probability of two events occurring together).
  • Bayes' theorem is a mathematical formula that forms out of and can be used to calculate conditional probabilities.

Conditional probability can be contrasted with unconditional probability. The latter is also called “marginal” probability, which measures the chance of a single event without depending on any other. In contrast, conditional probability determines the likelihood of one event given that another event has occurred, linking them.

Other terms for probabilities include independent probability, which doesn’t have that interconnectedness and instead looks at the probability of some event in isolation because it’s believed to be independent. A joint probability is the likelihood of two events occurring together. From these ideas, one can get to Bayes’ Theorem, which provides a way to flip conditional probabilities mathematically: if you know the chance of event B happening given event A, Bayes’ formula lets you reverse-calculate the conditional probability of A given B. Overall, while marginal and joint probabilities measure individual and paired events, conditional probability can measure precedence and dependence between events.

Understanding Conditional Probability

Conditional probabilities are contingent on a previous event. It measures the likelihood of an event or outcome based on the occurrence of some earlier event.

Two events are said to be independent if one event occurring does not affect the probability that the other event will occur. However, if one event occurring or not does affect the likelihood that the other event will happen, the two events are said to be dependent, for example, a company's stock price increasing after reporting higher-than-expected earnings. If events are independent, then the probability of some event B is not contingent on what happens with event A, for example, an increase in Apple's shares and a drop in wheat prices.

Conditional probability is often written as the "probability of A given B" and notated as P(A|B).

Conditional probability is used in a variety of fields, such as insurance, economics, politics, and different fields of mathematics.

Conditional Probability Formula

P ( B A ) = P ( A a n d B ) / P ( A ) P(B|A) = P(A and B) / P(A) P(BA)=P(AandB)/P(A)

Or:

P ( B A ) = P ( A B ) / P ( A ) P(B|A) = P(A∩B) / P(A) P(BA)=P(AB)/P(A)

Where the letters are for the following:

P = Probability

A = Event A

B = Event B

Unconditional probability is also known as marginal probability and measures the chance of something happening while ignoring any knowledge of previous or external events. Since this probability also ignores new information, it remains constant.

Examples of Conditional Probability

Example 1: Marbles in a bag

An example of conditional probability using marbles is illustrated below. The steps are as follows:

Step 1: Understand the scenario

Initially, you're given a bag with six red marbles, three blue marbles, and one green marble. Thus, there are 10 marbles in the bag.

Step 2: Identify the Events

Next, two events are defined:

  • Event A: Drawing a red marble from the bag
  • Event B: Drawing a marble that is not green

Step 3: Calculate the probability of event B: P(B)

Event B is drawing a marble that is not green. There are 10 marbles altogether, nine of which are not green: the six red and three blue marbles.

P ( B ) = ( N u m b e r o f m a r b l e s t h a t a r e n o t g r e e n ) / ( T o t a l n u m b e r o f m a r b l e s ) = 9 / 10 P(B) = (Number of marbles that are not green)/(Total number of marbles) = 9/10 P(B)=(Numberofmarblesthatarenotgreen)/(Totalnumberofmarbles)=9/10

Step 4: Identify the intersection of events A and B: P(A∩B)

The intersection of events A and B involves drawing a red marble that is also not green. Since all red marbles are not green, the intersection is simple: the event of drawing a red marble.

Step 5: Calculate the probability of the intersection of events A and B: P(A∩B)

P ( A B ) = ( N u m b e r o f r e d m a r b l e s ) / ( T o t a l n u m b e r o f m a r b l e s ) = 6 / 10 = 3 / 5 P(A∩B) = (Number of red marbles)/(Total number of marbles) = 6/10 = 3/5 P(AB)=(Numberofredmarbles)/(Totalnumberofmarbles)=6/10=3/5

Step 6: Calculate the conditional probability: P(A|B)

Using the conditional probability formula, P(A|B), that is, the probability of drawing a red marble given that the marble drawn is not green, the probability is calculated.

P ( A B ) = P ( A B ) / P ( B ) = ( 3 / 5 ) / ( 9 / 10 ) = 2 / 3 P(A|B) = P(A∩B)/P(B) = (3/5)/(9/10) = 2/3 P(AB)=P(AB)/P(B)=(3/5)/(9/10)=2/3

The conditional probability of drawing a red marble, given that the marble drawn is not green is 2/3.

Example 2: Rolling a fair die

Let's practice with another example of conditional probability using a fair die. The steps are as follows:

Step 1: Understand the scenario

You have a fair six-sided die. You want to determine the probability of rolling an even number, given that the number rolled is greater than four.

Step 2: Identify the events

The possible outcomes (sample space) for a six-sided die are the numbers one through six. From this list, you can define the two events:

  • Event A: Rolling an even number. Event A would mean rolling {2,4,6}.
  • Event B: Rolling a number greater than four. Event B would mean rolling {5,6}.

Step 3: Calculate the probability of each event

The probability of each event can be calculated by dividing the number of "favorable" outcomes (the ones you're looking for) by the total number of outcomes in the sample space.

P(A) is the probability of rolling an even number. There are three even numbers {2,4,6} out of the six possible outcomes. Thus, P(A) = 3/6 = 1/2.

P(B) is the probability of rolling a number greater than four. Two numbers are greater than four {5,6} out of the six possible outcomes. Thus, P(B) = 4/6 = 2/3.

Step 4: Identify the intersection of events A and B

The intersection of events A and B includes the outcomes that satisfy both conditions simultaneously. In this case, that means rolling a number that is even and also greater than four. The only outcome that does both is rolling a six.

Step 5: Calculate the probability of the intersection of events A and B

We'll spell this out, even if it's easy, given the above, because other examples might prove more difficult: P(A∩B) is the probability of rolling six since six is the only outcome that is both even and greater than six. There is one outcome out of six possibilities. So P(A∩B) = 1/6.

Step 6: Calculate the conditional probability: P(B|A)

The formula for conditional probability is as follows:

P ( B A ) = P ( A B ) / P ( A ) P(B|A) = P(A∩B) / P(A) P(BA)=P(AB)/P(A)

When the values are substituted into the formula, here is the result:

P ( B A ) = ( 1 / 6 ) / ( 1 / 2 ) = 1 / 3 P(B|A) = (1/6)/(1/2) = 1/3 P(BA)=(1/6)/(1/2)=1/3

This means that given the die rolled is even, the probability that this number is also greater than four is 1/3.

Example with multiple conditional probabilities

Another scenario involves a student applying for admission to a college who hopes to get a scholarship and a stipend for books, meals, and housing. The steps to determine the conditional probability of getting a stipend and the scholarship are as follows:

Step 1: Understand the scenario

First, the student wants to know the likelihood of being accepted to the university. Then, if accepted, the student would like to receive an academic scholarship. Moreover, if possible, the student would also like to receive a stipend for books, meals, and housing if they get the scholarship.

Step 2: Define the Events

There are three events:

  • Event A: Being accepted to the university.
  • Event B: Receiving a scholarship upon acceptance
  • Event C: Receiving a stipend for books, meals, and housing upon receiving a scholarship

Step 3: Calculating the probability of being accepted (event A)

The university accepts 100 out of every 1,000 applicants who have applications similar to the student's. Thus, the probability of a student being accepted is P(A) = 100/1000 = 0.10 or 10%.

Step 4: Determining the probability of receiving a scholarship once accepted: P(B|A)

It's known that out of the students accepted, 10 out of every 500 receive a scholarship. Thus the probability of receiving a scholarship given acceptance is as follows:

P ( B A ) = 10 / 500 = 0.02 = 2 P(B|A) = 10/500 = 0.02 = 2% P(BA)=10/500=0.02=2%

Step 5: Calculating the probability of being accepted and receiving a scholarship

To calculate the probability of being accepted and also receiving a scholarship, the likelihood of acceptance is multiplied by the conditional probability of receiving a scholarship given acceptance.

P ( A B ) = P ( A ) × P ( B A ) = 0.1 × 0.02 = 0.002 = 0.2 P(A∩B)=P(A)×P(B∣A)=0.1×0.02=0.002=0.2 P(AB)=P(A)×P(BA)=0.1×0.02=0.002=0.2%

Step 6: Determining the probability of receiving a stipend having gotten a scholarship: P(C|B)

It's also known that among the scholarship recipients, 50% receive a stipend for books, meals, and housing. Thus, P(C|B) = 0.5 = 50%.

Step 7: Calculating the probability of being accepted, receiving a scholarship, and receiving a stipend

To calculate the probability of a student being accepted, receiving a scholarship, and then also receiving a stipend, the probabilities of the events are multiplied.

P ( A B C ) = P ( A ) × P ( B A ) × P ( C B ) = 0.1 × 0.02 × 0.5 = 0.001 = 0.1 P(A∩B∩C)=P(A)×P(B∣A)×P(C∣B)=0.1×0.02×0.5=0.001=0.1% P(ABC)=P(A)×P(BA)×P(CB)=0.1×0.02×0.5=0.001=0.1%

This step-by-step breakdown illustrates how the probabilities for each scenario are calculated using basic probability formulas and conditional probability.

Conditional Probability vs. Joint Probability and Marginal Probability

Let's now differentiate calculating conditional probability from other kinds of probability.

Conditional probability

The example this time is a regular deck of cards. Two events are defined:

  • Event A: Drawing a four
  • Event B: Drawing a red card

A standard deck has 52 cards divided into four suits (hearts, diamonds, clubs, and spades). Hearts and diamonds are red, and clubs and spades are black. Each suit has 13 cards: Ace, then two through 10, and then the face cards Jack, Queen, and King.

The deck contains 26 red cards, 13 hearts, and 13 diamonds. Thus, the probability of drawing a red card is P(B) = 26/52 = 1/2.

Within the red cards are a four of hearts and a four of diamonds. Therefore, if a red card has to be drawn, a subset of the deck that includes only these 26 red cards needs to be considered.

Given that a red card has been drawn, the probability of it being a four is calculated as follows:

P ( A B ) = ( N u m b e r o f r e d f o u r s ) / ( T o t a l n u m b e r o f r e d c a r d s ) = 2 / 26 = 1 / 13 P(A|B) = (Number of red fours)/(Total number of red cards) = 2/26 = 1/13 P(AB)=(Numberofredfours)/(Totalnumberofredcards)=2/26=1/13

Marginal probability

The marginal probability, P(A), is the probability of an event A happening on its own. It does not consider the occurrence of any other event.

Since event A is drawing a four, P(A) is calculated by dividing the number of fours by the total number of cards in the deck.

P ( A ) = ( N u m b e r o f f o u r s i n t h e d e c k ) / ( T o t a l n u m b e r o f c a r d s i n d e c k ) = 4 / 52 = 1 / 13 P(A) = (Number of fours in the deck)/(Total number of cards in deck) = 4/52 = 1/13 P(A)=(Numberoffoursinthedeck)/(Totalnumberofcardsindeck)=4/52=1/13

Joint probability

Joint probability is the likelihood of two or more events happening at the same time. This is denoted as P(A∩B), the probability of events A and B occurring.

Assuming that the previous events are the same, that is, event A is the occurrence of drawing a card that is a four and event B is drawing a red card, we can find the joint probability of drawing a card that is both a four and red.

There are two cards that meet both criteria, the four of hearts and the four of diamonds. Thus, the joint probability of drawing a card that is both a four and red is calculated as follows:

P ( A B ) = ( N u m b e r o f r e d f o u r s ) / ( T o t a l n u m b e r o f c a r d s ) = 2 / 52 = 1 / 26 P(A∩B) = (Number of red fours)/(Total number of cards) = 2/52 = 1/26 P(AB)=(Numberofredfours)/(Totalnumberofcards)=2/52=1/26

Bayes' Theorem and Conditional Probability

Bayes’ theorem is used to calculate conditional probabilities when dealing with uncertain events. In investing, this allows you to update your probability estimates of a market outcome when you get new relevant data.

For example, suppose you wanted to know the probability that the S&P 500 would return a positive percentage this year, given initial gross domestic product (GDP) figures. In that case, you’d start with Bayes’ theorem, considering the index’s historical return rates to get an initial estimate of projected economic expansion. You would then revise this first probability using the latest GDP estimates to provide more refined probability assessments incorporating all evidence as the year progresses.

While a bit complex mathematically, Bayes’ theorem is quite logical—if an investor discovers new economic information relevant to potential market returns, it makes sense to integrate this data to get a more precise calculation. The 18th-century English minister Thomas Bayes devised this statistical technique, which remains central across financial modeling and other fields requiring predictions under uncertain conditions.

Bayes' theorem is well suited to and widely used in machine learning.

What Is a Conditional Probability Calculator?

A conditional probability calculator is an online tool that will calculate conditional probability. It will provide the probability of the first and second events occurring. A conditional probability calculator saves the user from doing the mathematics manually.

What Is the Difference Between Probability and Conditional Probability?

Probability looks at the likelihood of one event occurring. Conditional probability looks at two events occurring in relation to one another. It looks at the probability of a second event occurring based on the probability of the first event occurring.

What Is Prior Probability?

Prior probability is the probability of an event occurring before any data has been gathered. It is the probability as determined by a prior belief. Prior probability is a part of Bayesian statistical inference since you can revise these beliefs and arrive mathematically at a posterior probability.

What Is Compound Probability?

Compound probability looks to determine the likelihood of two independent events occurring. Compound probability multiplies the probability of the first event by the probability of the second event. The most common example is a coin flipped twice and finding if the second result will be the same as the first.

The Bottom Line

Conditional probability examines the likelihood of an event occurring based on the likelihood of a preceding event occurring. The second event is dependent on the first event. For example, we might want to know the probability that some stock will go up if the index for its sector is on the rise. The conditional probability calculation takes into account both how likely the first event is (the stock rising in price), as well as how much the two events overlap.

Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.
Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.