Expand menu menu_open Minimize Start chapters Home History history History expand_more
{{ item.displayTitle }}
navigate_next
No history yet!
Progress & Statistics equalizer Progress expand_more
Student
navigate_next
Teacher
navigate_next
{{ filterOption.label }}
{{ item.displayTitle }}
{{ item.subject.displayTitle }}
arrow_forward
No results
{{ searchError }}
search
menu_open
{{ courseTrack.displayTitle }}
{{ statistics.percent }}% Sign in to view progress
{{ printedBook.courseTrack.name }} {{ printedBook.name }}
search Use offline Tools apps
Login account_circle menu_open

Finding the Probability of Two Events

Consider two events AA and B.B. The probability that AA or BB will occur is the probability of the union of AA and B,B, and can be found using the Addition Rule of Probability.

P(A or B)=P(AB)P(A \text{ or }B) = P(A \cup B)

Rule

Addition Rule of Probability

For two mutually exclusive events AA and B,B, the probability that AA or BB occur in one trial is the sum of the individual probability of each event.

P(A or B)=P(A)+P(B)P(A\text{ or }B)=P(A)+P(B)

For example, consider rolling a standard six-sided die. Let AA be the event that a 33 is rolled, and BB be the event that a 44 is rolled. The probaility of AA or BB can be found by adding the individual probabilities. P(3 or 4)=P(3)+P(4)=16+16P(3 or 4)=26=13 P(3 \text{ or }4) = P(3)+P(4) = \frac{1}{6} + \frac{1}{6}\\ \Downarrow\\ P(3 \text{ or }4)=\frac{2}{6}=\frac{1}{3} The formula above can be generalized to events that are not necessarily mutually exclusive. If events are overlapping, the probability of the common outcomes are counted twice in P(A)+P(B),P(A)+P(B), so an adjustment is needed.

P(A or B)=P(A)+P(B)P(A and B)P(A\text{ or }B)=P(A)+P(B)-P(A\text{ and }B)

For example, consider rolling a standard six-sided die. Let AA be the event that an even number is rolled, and BB be the event that a prime number is rolled.

Event Outcome(s) Probability
even 2,2, 4,4, 66 P(A)=36=12P(A)=\dfrac{3}{6}=\dfrac{1}{2}
prime 2,2, 3,3, 55 P(B)=36=12P(B)=\dfrac{3}{6}=\dfrac{1}{2}
even and prime 22 P(A and B)=16P(A\text{ and }B)=\dfrac{1}{6}

Using the formula gives the probability that the result of the roll is even or prime. P(A or B)=P(A)+P(B)P(A and B)P(even or prime)=12+1216=56 P(A\text{ or }B)=P(A)+P(B)-P(A\text{ and }B)\\ \Downarrow\\ P(\text{even or prime})=\frac{1}{2}+\frac{1}{2}-\frac{1}{6}=\frac{5}{6}

This can be verified by noticing that there are five outcomes that are even or prime, 2,2, 3,3, 4,4, 5,5, and 6.6.
Concept

Independent and Dependent Events

Sometimes, the occurrence of one event affects the occurrence of another. If this is the case, the events are said to be dependent. If not, they are independent.
Rule

Independent Events

Two events, AA and B,B, are independent if and only if the probability that both events occur is equal to the product of the individual probabilities.

P(A and B)=P(A)P(B)P(A\text{ and }B)=P(A)\cdot P(B)

If a coin is flipped two times, the outcome of the first flip does not affect the outcome of the second flip. For example, suppose the first flip is heads. This does not affect the likelihood that the second flip is also heads. P(H and H)=P(H)P(H) P(\text{H and H})=P(\text{H})\cdot P(\text{H}) By showing that the expressions are equal, it can be concluded that the events are independent. To find the probability of flipping heads twice a tree diagram can be drawn.

The number of possible outcomes when flipping two coins is 4.4. Additionally, the favorable outcome, two heads, is 1.1. P(H and H)=14 P(\text{H and H})=\frac{1}{4} Next, consider flipping a coin two separate times. The probability of flipping heads is P(H)=12.P(\text{H})=\frac{1}{2}. P(H)P(H)=1212=14 P(\text{H})\cdot P(\text{H}) = \frac{1}{2}\cdot\frac{1}{2}=\frac{1}{4}

The probability is the same for both expressions, 14.\frac{1}{4}. Therefore, because the rule is satisfied, the events are independent.
Concept

Dependent Events

Two events are said to be dependent when the occurrence of one affects the occurrence of the other. For example, consider drawing two marbles from a bowl, one at a time.

Bowl with marbles.svg

The probability of first picking a green marble can be calculated by dividing the favorable outcomes by the possible outcomes. There is 11 green marble and 33 total marbles. P(green)=13 P(\text{green})=\dfrac{1}{3} Suppose that the first marble is replaced before the second draw. Therefore, after the replacement, there is 11 purple marble and 33 total marbles. P(purple)=13 P(\text{purple})= \frac{1}{3} The combined probability of picking a green marble first and a purple marble second can be calculated using the Multiplication Rule of Probability. P(green then purple)=1313=19 P(\text{green then purple}) = \dfrac{1}{3} \cdot \dfrac{1}{3} = \dfrac{1}{9} These events are not dependent. Suppose instead that, after the green marble is picked, it is not replaced in the bowl.

Bowl with red and purple marble.svg

This affects the probability of picking a purple marble on the second draw. Now, there still is 11 purple marble but, instead of 3,3, there are 22 total marbles. P(purple)=12 P(\text{purple})=\dfrac{1}{2} With this information, the probability of picking green and then purple can be calculated. P(green then purple)=1312=16 P(\text{green then purple}) = \dfrac{1}{3} \cdot \dfrac{1}{2} = \dfrac{1}{6}

As can be seen, these events are dependent because the occurrence of the first affects the occurrence of the second.
Rule

Conditional Probability

The conditional probability of an event BB is the probability that BB will occur given that another event AA has already occurred. The probability of BB given AA is written P(BA). P(B|A). It can be calculated by dividing the probability for AA and BB with the probability of A.A.

P(BA)=P(A and B)P(A)P(B|A)=\dfrac{P(A\text{ and }B)}{P(A)}
Notice that P(A and B)P(A \text{ and }B) is an intersection and can be calculated using the Multiplication Rule of Probability.
Concept

Intersection - Probability

Consider two events AA and B.B. The probability that AA and BB will occur is the probability of the intersection of AA and B,B, and can be calculated using the Multiplication Rule of Probability.

P(A and B)=P(AB)P(A \text{ and }B) = P(A \cap B)

Rule

Multiplication Rule of Probability

For two independent events AA and B,B, the probability that AA and BB occur is the product of the individual probabilities.

P(A and B)=P(A)P(B)P(A\text{ and }B)=P(A)\cdot P(B)

For example, when rolling two dice, the probability of rolling two even numbers can be calculated using the individual probabilities. Note that there are 33 outcomes that are even — 2,4,2, 4, and 6.6. P(even)=36=12 P(\text{even})=\frac{3}{6}=\frac{1}{2} The probability of rolling two even numbers can be calculated using the formula. P(both are even)=1212=14 P(\text{both are even}) = \frac{1}{2} \cdot \frac{1}{2} =\frac{1}{4} For not necessarily independent events, the conditional probability formula can be rearranged to a product form.

P(A and B)=P(A)P(BA)P(A\text{ and }B)=P(A)\cdot P(B|A)

For example, consider a box with four red and six blue marbles. In an experiment two marbles are drawn randomly from the box. The formula can be used to find the probability that both marbles are red. Let AA and BB be the events that the first and second marbles are red.

  • The probability that the first marble is red is P(A)=44+6=25.P(A)=\frac{4}{4+6}=\frac{2}{5}.
  • Once a red marble is picked, the box only has three red and six blue marbles. The probability that the next marble is red is P(BA)=33+6=13.P(B|A)=\frac{3}{3+6}=\frac{1}{3}.

The formula gives the probability that both marbles are red.

P(A and B)=P(A)P(BA)P(both red)=2513=215 P(A\text{ and }B)=P(A)\cdot P(B|A)\\ \Downarrow\\ P(\text{both red})=\frac{2}{5}\cdot \frac{1}{3}=\frac{2}{15}
Concept

Two-Way Frequency Table

When categorical data belongs to two categories, such as if people are asked whether they own a car and whether they have a driver's license, it can be presented in a two-way frequency table. One of the categories is represented by the rows of the table, and the other by the columns. The above survey, with 100100 participants, could result in the following answers.

Driver's license
Yes No
Car Yes 4343 44
No 2424 2929

The two categories are then "car" and "driver's license," both with the possible answers "yes" and "no." The entries in the table are called joint frequencies. Often, two-way frequency tables include the total of the rows and columns. These totals are called marginal frequencies. The sum of the "total" row and "total" column are each equal to the sum of all joint frequencies, 100100 in this case.

Driver's license
Yes No Total
Car Yes 4343 44 4747
No 2424 2929 5353
Total 6767 3333 100100
From the table, it can, for instance, be read that 4343 out of the 100100 people both own a car and have a driver's license, and that 3333 of the 100100 do not have a driver's license.
Method

Drawing a Two-Way Frequency Table

Organizing data in a two-way frequency table can help with visualization, which in turn makes it easier to analyze and present the data. Consider the following survey.

5353 people took part in an online survey, where they got to choose their preferred hat, top hat or beret. Out of the 1818 males that participated, twelve of them prefer a beret. Fifteen of the females chose top hat as their preference.

1

Determine the categories

First, determine the two categories of the table and draw it without frequencies. Here, the participants gave their hat preference and their gender, which are then the two categories. Hat preference can be further divided into top hat and beret, and gender into female and male. This gives the following table.

Hat preference
Top hat Beret Total
Gender Male
Female
Total

The "total" row and columns are included to make room for the marginal frequencies.


2

Fill the table with given data


The given joint and marginal frequencies can now be added to the table.

Hat preference
Top hat Beret Total
Gender Male 1212 1818
Female 1515
Total 5353


3

Find any missing frequencies


Using the given frequencies, more information can potentially be found by reasoning. For instance, 1212 out of the 1818 males prefers berets, which means that 1812=6 18 - 12 = 6 males prefer top hats. Thus, there are 66 males and 1515 females who prefer top hats, making a total of 6+15=21 6 + 15 = 21 participants that prefer top hats. Continuing this reasoning, the entire table can be completed.

Hat preference
Top hat Beret Total
Gender Male 66 1212 1818
Female 1515 2020 3535
Total 2121 3232 5353


Concept

Joint and Marginal Relative Frequencies

A joint relative frequency is the ratio of a joint frequency and the total number of values or observations. Similarly, a marginal relative frequency is the ratio of a marginal frequency and the total. For the example above, the joint and marginal relative frequencies are found by dividing the frequencies by 53,53, the number of participants.

Hat preference
Top hat Beret Total
Gender Male 6530.11\dfrac{6}{53} \approx 0.11 12530.23\dfrac{12}{53} \approx 0.23 18530.34\dfrac{18}{53} \approx 0.34
Female 15530.28\dfrac{15}{53} \approx 0.28 20530.38\dfrac{20}{53} \approx 0.38 35530.66\dfrac{35}{53} \approx 0.66
Total 21530.40\dfrac{21}{53} \approx 0.40 32530.60\dfrac{32}{53} \approx 0.60 11
Notice that, ignoring the error margin introduced by rounding, a marginal relative frequency can be found by adding a row or column of joint marginal frequencies. This table shows, for instance, that female's with a preference for berets make up about 38%38 \, \% of the participants.
Concept

Conditional Relative Frequency

A conditional relative frequency is the ratio of a joint frequency and either of its corresponding two marginal frequencies. Alternatively, it can be calculated using relative joint and marginal frequencies. As an example, the following data will be used.

Driver's license
Yes No Total
Car Yes 4343 44 4747
No 2424 2929 5353
Total 6767 3333 100100

Using the column totals, the left column of joint frequencies should be divided by 67,67, and the right column by 33.33. Since the column totals are used, the sum of the conditional relative frequencies will be 1.1.

Driver's license
Yes No
Car Yes 43670.64\dfrac{43}{67} \approx 0.64 4330.12\dfrac{4}{33} \approx 0.12
No 24670.36\dfrac{24}{67} \approx 0.36 29330.88\dfrac{29}{33} \approx 0.88
This table shows that, for instance, out of all the participants with a driver's license, about 64%64 \, \% of them own a car, and out of those without a driver's license, 88%88 \, \% do not have a car.
fullscreen
Exercise

From the two-way frequency table, find the conditional relative frequencies based on the columns. Then, find the probability that a vegetarian has a pet.

Vegetarian
Yes No Total
Pet Yes 0.4560.456 0.1540.154 0.610.61
No 0.1230.123 0.2670.267 0.390.39
Total 0.5790.579 0.4210.421 11
Show Solution
Solution

To begin, recall that conditional relative frequencies can be calculated by dividing the joint relative frequencies by the marginal relative frequencies. Since it should be based on the columns, it's the totals of the vegetarians, 0.5790.579 and 0.421,0.421, that are used as the denominators.

Vegetarian
Yes No
Pet Yes 0.4560.5790.79\dfrac{0.456}{0.579}\approx0.79 0.1540.4210.37\dfrac{0.154}{0.421}\approx0.37
No 0.1230.5790.21\dfrac{0.123}{0.579}\approx0.21 0.2670.4210.63\dfrac{0.267}{0.421}\approx0.63
Total 0.5790.579 0.4210.421

Note that the sum of the conditional relative frequencies in each column is equal to 1.1. Now, to find the probability that a vegetarian has a pet, we look at the column for people who answered "Yes" on "Vegetarian".

Vegetarian
Yes No
Pet Yes 0.79{\color{#0000FF}{0.79}} 0.370.37
No 0.21{\color{#0000FF}{0.21}} 0.630.63
Total 1{\color{#0000FF}{1}} 11

In that column, 79%79\,\% said "Yes" to having a pet and 21%21\,\% said "no". Thus, the probability that a vegetarian has a pet is 79%.79\,\%.

{{ 'mldesktop-placeholder-grade-tab' | message }}
{{ 'mldesktop-placeholder-grade' | message }} {{ article.displayTitle }}!
{{ grade.displayTitle }}
{{ exercise.headTitle }}
{{ 'ml-tooltip-premium-exercise' | message }}
{{ 'ml-tooltip-programming-exercise' | message }} {{ 'course' | message }} {{ exercise.course }}
Test
{{ 'ml-heading-exercise' | message }} {{ focusmode.exercise.exerciseName }}
{{ 'ml-btn-previous-exercise' | message }} arrow_back {{ 'ml-btn-next-exercise' | message }} arrow_forward