Conditional Probability Formula

5/5 - (1 bình chọn)

Conditional Probability: Definition & Real Life Examples

Events in Conditional Probability

Conditional probability could describe an event like:

  • Event A is that it is raining outside, and it has a 0.3 (30%) chance of raining today.
  • Event B is that you will need to go outside, and that has a probability of 0.5 (50%).

A conditional probability would look at these two events in relationship with one another, such as the probability that it is both raining and you will need to go outside.

The formula for conditional probability is:

P(B|A) = P(A and B) / P(A)

which you can also rewrite as:

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

Conditional Probability Formula Examples

Example 1

In a group of 100 sports car buyers, 40 bought alarm systems, 30 purchased bucket seats, and 20 purchased an alarm system and bucket seats. If a car buyer chosen at random bought an alarm system, what is the probability they also bought bucket seats?

Step 1: Figure out P(A). It’s given in the question as 40%, or 0.4.

Step 2: Figure out P(A∩B). This is the intersection of A and B: both happening together. It’s given in the question 20 out of 100 buyers, or 0.2.

Step 3: Insert your answers into the formula:
P(B|A) = P(A∩B) / P(A) = 0.2 / 0.4 = 0.5.

The probability that a buyer bought bucket seats, given that they purchased an alarm system, is 50%.

Venn diagram for 90 buyers, showing that 20 alarm buyers also purchased bucket seats.

Example 2:

This question uses the following contingency table:

What is the probability a randomly selected person is male, given that they own a pet?

Step 1: Repopulate the formula with new variables so that it makes sense for the question (optional, but it helps to clarify what you’re looking for). I’m going to say M is for male and PO stands for pet owner, so the formula becomes:
P(M|PO) = P(M∩PO) / P(PO)

Step 2: Figure out P(M∩PO) from the table. The intersection of male/pets (the intersection on the table of these two factors) is 0.41.

Step 3: Figure out P(PO) from the table. From the total column, 86% (0.86) of respondents had a pet.

Conditional Probability: Definition & Real Life Examples

Share on

Conditional probability is the probability of one event occurring with some relationship to one or more other events.

Events in Conditional Probability

Conditional probability could describe an event like:

  • Event A is that it is raining outside, and it has a 0.3 (30%) chance of raining today.
  • Event B is that you will need to go outside, and that has a probability of 0.5 (50%).

A conditional probability would look at these two events in relationship with one another, such as the probability that it is both raining and you will need to go outside.

The formula for conditional probability is:

P(B|A) = P(A and B) / P(A)

which you can also rewrite as:

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

Conditional Probability Formula Examples

Example 1

In a group of 100 sports car buyers, 40 bought alarm systems, 30 purchased bucket seats, and 20 purchased an alarm system and bucket seats. If a car buyer chosen at random bought an alarm system, what is the probability they also bought bucket seats?

Step 1: Figure out P(A). It’s given in the question as 40%, or 0.4.

Step 2: Figure out P(A∩B). This is the intersection of A and B: both happening together. It’s given in the question 20 out of 100 buyers, or 0.2.

Step 3: Insert your answers into the formula:
P(B|A) = P(A∩B) / P(A) = 0.2 / 0.4 = 0.5.

The probability that a buyer bought bucket seats, given that they purchased an alarm system, is 50%.

Venn diagram for 90 buyers, showing that 20 alarm buyers also purchased bucket seats.

Conditional Probability in Real Life

Conditional probability is used in many areas, in fields as diverse as calculus, insurance, and politics. For example, the re-election of a president depends upon the voting preference of voters and perhaps the success of television advertising—even the probability of the opponent making gaffes during debates!

The weatherman might state that your area has a probability of rain of 40 percent. However, this fact is conditional on many things, such as the probability of…

  • …a cold front coming to your area.
  • …rain clouds forming.
  • …another front pushing the rain clouds away.

We say that the conditional probability of rain occurring depends on all the above events.

More Conditional Probability Real Life Examples

  • Imagine that you’re a furniture salesman. The probability of a new customer to your store purchasing a couch on any particular day is 30%. However, if they are entering your store in the month leading up to the Super Bowl, the probability might be 70%. We can represent the conditional probability of selling a couch if it is the month leading up to Super Bowl as P(Selling a couch | Super Bowl month) where the | symbol means “given that”. This conditional probability gives us a way to express probabilities when our beliefs change about the probability of one event happens (a couch sale in this example) given that a certain event has happened (in this case, the advent of the month preceding the Super Bowl).
  • The probability of a woman between 40 and 50 years of having breast cancer is about 1%. However, this probability changes if a woman has a positive mammogram: the probability a woman has cancer if she has a positive mammogram result rises to about 8.3% [1].
  • Four candidates A, B, C, and D are running for a political office. Each has an equal chance of winning: 25%. However, if candidate A drops out of the race due to ill health, the probability will change: P(Win | One candidate drops out) = 33.33%.
  • If you’re pregnant, the probability of having a boy or girl is the same: 50%. However, if you already have one child (say, a boy), your odds change. Given that your first child is a boy, your odds of having another boy drop to one third (33.33%). The reason for this is that the sample space for the event you have one boy out of two is S = {BB, BG, GB}. If you have one boy, the only possible event within this space is BB, which is one third of the sample space [2].

Where does the Conditional Probability Formula Come From?

The formula for conditional probability is derived from the probability multiplication rule, P(A and B) = P(A)*P(B|A). You may also see this rule as P(A∪B). The Union symbol (∪) means “and”, as in event A happening and event B happening.

Step by step, here’s how to derive the conditional probability equation from the multiplication rule:

Step 1: Write out the multiplication rule:
P(A and B) = P(A)*P(B|A)

Step 2: Divide both sides of the equation by P(A):
P(A and B) / P(A) = P(A)*P(B|A) / / P(A)

Step 3: Cancel P(A) on the right side of the equation:
P(A and B) / P(A) = P(B|A)

Step 4: Rewrite the equation:
P(B|A) = P(A and B) / P(A)

Conditional Probability

The conditional probability of an event B is the probability that the event will occur given the knowledge that an event A has already occurred. This probability is written P(B|A), notation for the probability of B given A. In the case where events A and B are independent (where event A has no effect on the probability of event B), the conditional probability of event B given event A is simply the probability of event B, that is P(B).

If events A and B are not independent, then the probability of the intersection of A and B (the probability that both events occur) is defined by
P(A and B) = P(A)P(B|A).

From this definition, the conditional probability P(B|A) is easily obtained by dividing by P(A):

Note: This expression is only valid when P(A) is greater than 0.

Examples

In a card game, suppose a player needs to draw two cards of the same suit in order to win. Of the 52 cards, there are 13 cards in each suit. Suppose first the player draws a heart. Now the player wishes to draw a second heart. Since one heart has already been chosen, there are now 12 hearts remaining in a deck of 51 cards. So the conditional probability P(Draw second heart|First card a heart) = 12/51.

Suppose an individual applying to a college determines that he has an 80% chance of being accepted, and he knows that dormitory housing will only be provided for 60% of all of the accepted students. The chance of the student being accepted and receiving dormitory housing is defined by
P(Accepted and Dormitory Housing) = P(Dormitory Housing|Accepted)P(Accepted) = (0.60)*(0.80) = 0.48.

To calculate the probability of the intersection of more than two events, the conditional probabilities of all of the preceding events must be considered. In the case of three events, AB, and C, the probability of the intersection P(A and B and C) = P(A)P(B|A)P(C|A and B).

Consider the college applicant who has determined that he has 0.80 probability of acceptance and that only 60% of the accepted students will receive dormitory housing. Of the accepted students who receive dormitory housing, 80% will have at least one roommate. The probability of being accepted and receiving dormitory housing and having no roommates is calculated by:
P(Accepted and Dormitory Housing and No Roommates) = P(Accepted)P(Dormitory Housing|Accepted)P(No Roomates|Dormitory Housing and Accepted) = (0.80)*(0.60)*(0.20) = 0.096. The student has about a 10% chance of receiving a single room at the college.

Another important method for calculating conditional probabilities is given by Bayes’s formula. The formula is based on the expression P(B) = P(B|A)P(A) + P(B|Ac)P(Ac), which simply states that the probability of event B is the sum of the conditional probabilities of event B given that event A has or has not occurred. For independent events A and B, this is equal to P(B)P(A) + P(B)P(Ac) = P(B)(P(A) + P(Ac)) = P(B)(1) = P(B), since the probability of an event and its complement must always sum to 1. Bayes’s formula is defined as follows:

Example

Suppose a voter poll is taken in three states. In state A, 50% of voters support the liberal candidate, in state B, 60% of the voters support the liberal candidate, and in state C, 35% of the voters support the liberal candidate. Of the total population of the three states, 40% live in state A, 25% live in state B, and 35% live in state C. Given that a voter supports the liberal candidate, what is the probability that she lives in state B?

By Bayes’s formula,

P(Voter lives in state B|Voter supports liberal candidate) =
P(Voter supports liberal candidate|Voter lives in state B)P(Voter lives in state B)/
	(P(Voter supports lib. cand.|Voter lives in state A)P(Voter lives in state A) + 
	 P(Voter supports lib. cand.|Voter lives in state B)P(Voter lives in state B) +
	 P(Voter supports lib. cand.|Voter lives in state C)P(Voter lives in state C))
= (0.60)*(0.25)/((0.50)*(0.40) + (0.60)*(0.25) + (0.35)*(0.35)) 
= (0.15)/(0.20 + 0.15 + 0.1225) = 0.15/0.4725 = 0.3175.

The probability that the voter lives in state B is approximately 0.32.

Conditional Probability

In this section, we discuss one of the most fundamental concepts in probability theory. Here is the question: as you obtain additional information, how should you update probabilities of events? For example, suppose that in a certain city, 23 percent of the days are rainy. Thus, if you pick a random day, the probability that it rains that day is 23 percent:

P(R)=0.23,where R is the event that it rains on the randomly chosen day.

Now suppose that I pick a random day, but I also tell you that it is cloudy on the chosen day. Now that you have this extra piece of information, how do you update the chance that it rains on that day? In other words, what is the probability that it rains given that it is cloudy? If C is the event that it is cloudy, then we write this as P(R|C), the conditional probability of R given that C has occurred. It is reasonable to assume that in this example, P(R|C) should be larger than the original P(R), which is called the prior probability of R. But what exactly should P(R|C) be? Before providing a general formula, let’s look at a simple example.

Example 

I roll a fair die. Let A be the event that the outcome is an odd number, i.e., A={1,3,5}A={1,3,5}. Also let B be the event that the outcome is less than or equal to 3, i.e., B={1,2,3}. What is the probability of A, P(A)? What is the probability of AA given B, P(A|B)?

This is a finite sample space, so

Although the above calculation has been done for a finite sample space with equally likely outcomes, it turns out the resulting formula is quite general and can be applied in any setting. Below, we formally provide the formula and then explain the intuition behind it.

Fig. 1.21 – Venn diagram for conditional probability, P(A|B).

It is important to note that conditional probability itself is a probability measure, so it satisfies probability axioms. In particular,

Axiom 1: For any event A, P(A|B)≥0.
Axiom 2: Conditional probability of B given B is 1, i.e., P(B|B)=1.
Axiom 3: If A1,A2,A3,⋯ are disjoint events, then P(A1∪A2∪A3⋯|B)=P(A1|B)+P(A2|B)+P(A3|B)+⋯.In fact, all rules that we have learned so far can be extended to conditional probability. For example, the formulas given in Example 1.10 can be rewritten:

This makes sense. In particular, since A and B are disjoint they cannot both occur at the same time. Thus, given that B has occurred, the probability of A must be zero.

When B is a subset of A: If B⊂A, then whenever B happens, A also happens. Thus, given that B occurred, we expect that probability of A be one. In this case A∩B=B, so

Example
I roll a fair die twice and obtain two numbers X1= result of the first roll and X2= result of the second roll. Given that I know X1+X2=7, what is the probability that X1=4 or X2=4?

Let A be the event that X1=4 or X2=4 and B be the event that X1+X2=7. We are interested in P(A|B), so we can use

Let’s look at a famous probability problem, called the two-child problem. Many versions of this problem have been discussed [1] in the literature and we will review a few of them in this chapter. We suggest that you try to guess the answers before solving the problem using probability formulas.

Example
Consider a family that has two children. We are interested in the children’s genders. Our sample space is S={(G,G),(G,B),(B,G),(B,B)}. Also assume that all four possible outcomes are equally likely.

What is the probability that both children are girls given that the first child is a girl?
We ask the father: “Do you have at least one daughter?” He responds “Yes!” Given this extra information, what is the probability that both children are girls? In other words, what is the probability that both children are girls given that we know at least one of them is a girl?

Let A be the event that both children are girls, i.e., A={(G,G)}. Let B be the event that the first child is a girl, i.e., B={(G,G),(G,B)}. Finally, let C be the event that at least one of the children is a girl, i.e., C={(G,G),(G,B),(B,G)}. Since the outcomes are equally likely, we can write

Discussion: Asked to guess the answers in the above example, many people would guess that both P(A|B) and P(A|C) should be 50 percent. However, as we see P(A|B) is 50 percent, while P(A|C) is only 33 percent. This is an example where the answers might seem counterintuitive. To understand the results of this problem, it is helpful to note that the event B is a subset of the event C. In fact, it is strictly smaller: it does not include the element (B,G), while C has that element. Thus the set C has more outcomes that are not in A than B, which means that P(A|C) should be smaller than P(A|B).

It is often useful to think of probability as percentages. For example, to better understand the results of this problem, let us imagine that there are 4000 families that have two children. Since the outcomes (G,G),(G,B),(B,G), and (B,B) are equally likely, we will have roughly 1000 families associated with each outcome as shown in Figure 1.22. To find probability P(A|C), we are performing the following experiment: we choose a random family from the families with at least one daughter. These are the families shown in the box. From these families, there are 1000 families with two girls and there are 2000 families with exactly one girl. Thus, the probability of choosing a family with two girls is 1/3.

Fig.1.22 – An example to help the understanding of P(A|C) in Example 1.18.

Chain rule for conditional probability:

Let us write the formula for conditional probability in the following formatP(A∩B)=P(A)P(B|A)=P(B)P(A|B)(1.5)This format is particularly useful in situations when we know the conditional probability, but we are interested in the probability of the intersection. We can interpret this formula using a tree diagram such as the one shown in Figure 1.23. In this figure, we obtain the probability at each point by multiplying probabilities on the branches leading to that point. This type of diagram can be very useful for some problems.

Fig.1.23 – A tree diagram.

The point here is understanding how you can derive these formulas and trying to have intuition about them rather than memorizing them. You can extend the tree in Figure 1.22 to this case. Here the tree will have eight leaves. A general statement of the chain rule for n events is as follows:

Given that the first and second chosen items were okay, the third item will be chosen from 93 good units and 5 defective units, thus

What Is Conditional Probability?

Conditional probability is defined as the likelihood of an event or outcome occurring, based on the occurrence of a previous event or outcome. Conditional probability is calculated by multiplying the probability of the preceding event by the updated probability of the succeeding, or conditional, event.

For example:

  • Event A is that an individual applying for college will be accepted. There is an 80% chance that this individual will be accepted to college.
  • Event B is that this individual will be given dormitory housing. Dormitory housing will only be provided for 60% of all of the accepted students.
  • P (Accepted and dormitory housing) = P (Dormitory Housing | Accepted) P (Accepted) = (0.60)*(0.80) = 0.48.

A conditional probability would look at these two events in relationship with one another, such as the probability that you are both accepted to college, and you are provided with dormitory housing.

Conditional probability can be contrasted with unconditional probability. Unconditional probability refers to the likelihood that an event will take place irrespective of whether any other events have taken place or any other conditions are present.

How Do You Calculate Conditional Probability?

Conditional probability is calculated by multiplying the probability of the preceding event by the probability of the succeeding or conditional event. Conditional probability looks at the probability of one event happening based on the probability of a preceding event happening.

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 event and the second event 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 to determine the probability. It is the probability as determined by a prior belief. Prior probability is a component of Bayesian statistical inference.

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 that of a coin flipped twice and the determination if the second result will be the same or different than the first.

Conditional Probability

How to handle Dependent Events

Life is full of random events! You need to get a “feel” for them to be a smart and successful person.

Independent Events

Events can be “Independent”, meaning each event is not affected by any other events.

Dependent Events

But events can also be “dependent” … which means they can be affected by previous events …

This is because we are removing marbles from the bag.

So the next event depends on what happened in the previous event, and is called dependent.

Dependent events are what we look at here.

Tree Diagram

A Tree Diagram: is a wonderful way to picture what is going on, so let’s build one for our marbles example.

There is a 2/5 chance of pulling out a Blue marble, and a 3/5 chance for Red:

If a blue marble was selected first there is now a 1/4 chance of getting a blue marble and a 3/4 chance of getting a red marble.

If a red marble was selected first there is now a 2/4 chance of getting a blue marble and a 2/4 chance of getting a red marble.

Big Example: Soccer Game

You are off to soccer, and want to be the Goalkeeper, but that depends who is the Coach today:

  • with Coach Sam the probability of being Goalkeeper is 0.5
  • with Coach Alex the probability of being Goalkeeper is 0.3

Sam is Coach more often … about 6 out of every 10 games (a probability of 0.6).

So, what is the probability you will be a Goalkeeper today?

Let’s build a tree diagram. First we show the two possible coaches: Sam or Alex:

The tree diagram is complete, now let’s calculate the overall probabilities. Remember that:

An 0.4 chance of Alex as Coach, followed by an 0.3 chance gives 0.12

And the two “Yes” branches of the tree together make:

0.3 + 0.12 = 0.42 probability of being a Goalkeeper today

(That is a 42% chance)

Check

One final step: complete the calculations and make sure they add to 1:

Friends and Random Numbers

Here is another quite different example of Conditional Probability.

4 friends (Alex, Blake, Chris and Dusty) each choose a random number between 1 and 5. What is the chance that any of them chose the same number?

Let’s add our friends one at a time …

First, what is the chance that Alex and Blake have the same number?

Blake compares his number to Alex’s number. There is a 1 in 5 chance of a match.

As a tree diagram:

Now, let’s include Chris …

But there are now two cases to consider:

  • If Alex and Blake did match, then Chris has only one number to compare to.
  • But if Alex and Blake did not match then Chris has two numbers to compare to.

And we get this:

For the top line (Alex and Blake did match) we already have a match (a chance of 1/5).

But for the “Alex and Blake did not match” there is now a 2/5 chance of Chris matching (because Chris gets to match his number against both Alex and Blake).

And we can work out the combined chance by multiplying the chances it took to get there:

Also notice that when we add all chances together we still get 1 (a good check that we haven’t made a mistake):

(5/25) + (8/25) + (12/25) = 25/25 = 1

Now what happens when we include Dusty?

It is the same idea, just more of it:

OK, that is all 4 friends, and the “Yes” chances together make 101/125:

Answer: 101/125

And that is a popular trick in probability:

It is often easier to work out the “No” case
(and subtract from 1 for the “Yes” case)


Application of Conditional Probability Formula

A few of the most common applications of conditional probability formula include the prediction of the outcomes in the case of flipping a coin, choosing a card from the deck, and throwing dice. It also helps Data Scientists to get better results as they analyze the given data set. For machine learning engineers, it helps to prepare more accurate prediction models.

Let us understand the conditional probability formula using solved examples.

Examples Using Conditional Probability Formula

Example 1: In a group of 10 people, 4 people bought apples, 3 bought oranges, and 2 bought apples and oranges. If a buyer chose randomly bought apples, using the conditional probability formula find out what is the probability they also bought oranges?

Solution:
Let people who bought apples are A and who bought oranges are O.
It’s given that
P(A) = 4 out of 10 = 40% = 0.4
P(O) = 3 out of 10 = 30% = 0.3

Hence,
P(A∩O) = 2 out of 10 = 20% =  0.2

Now, using the conditional probability formula
P(O|A) = P(A∩O) / P(A) = 0.2 / 0.4 = 0.5 = 50%

Answer: The probability that a buyer bought oranges, given that they bought apples, is 50%.

Example 2: My neighbor has 2 children. I learn that she has a son, Adam. What is the probability that Adam’s sibling is a boy?

Solution:
Let the boy child be B and the girl child is G.
The sample space is S = {BB,BG,GB,GG}
Assume that boys and girls are equally likely to be born, the 4 elements of S are equally likely.
The event, X, that the neighbor has a son is the set X = {BB,BG,GB} 
Hence, P(X) = 3/4
The event, Y, that the neighbor has two sons is the set Y = {BB} 
Then, P(Y ∩ X) = 1/4
Now, using the conditional probability formula
P(Y | X) = P(Y ∩ X) / P(X) = (1/4) / (3/4) = 1/3

Answer: The probability that Adam’s sibling is a boy is 1/3.

Example 3: A fair die is rolled. What is the probability of A given B where A is the event of getting an even number and B is the event of getting a number less than or equal to 2?

Solution:
To find: P(A | B) using the given information.
When a die is rolled, the sample space = {1, 2, 3, 4, 5, 6}.
A is the event of getting an even number. Thus,  A = {2, 4, 6}.
B is the event of getting a number less than or equal to 3. Thus, B = {1, 2}.
Then, A ∩ B = {2}.

Now, using the conditional probability formula,

P(A | B) = P(A∩B) / P(B)
P(A | B) = (1/6)/(3/6) = 1/3

Answer: The probability of A given B is 1/3.


FAQs on Conditional Probability Formula

What Is Conditional Probability Formula?

The conditional probability formula refers to the formula that provides the measure of the probability of an event given that another event has occurred. It is calculated using the formula, P(A|B)=P(A∩B)/P(B)

How To Derive Conditional Probability Formula?

To derive the formula of conditional probability, the probability multiplication rule is used, P(A and B) = P(A)*P(B|A). 

What Are the Applications of Conditional Probability Formula?

Applications of the conditional probability formula include the prediction of the outcomes

  • flipping a coin
  • choosing a card from the deck
  • throwing dice
  • used by Data Scientists as they analyze the given data set. 
  • used by Machine Learning Engineers to prepare more accurate prediction models.

How To Use Conditional Probability Formula?

To use conditional probability formula

  • Step 1: Find P(A)
  • Step 2: Find P(B)
  • Step 3: Find P(A∩B)
  • Step 4: Put the values in the formula, P(A|B)=P(A∩B)P(B)

Probability, Conditional Probability and Bayes Formula

Math Formulas ⭐️⭐️⭐️⭐️⭐

Hãy bình luận đầu tiên

Để lại một phản hồi

Thư điện tử của bạn sẽ không được hiện thị công khai.


*