# 6.3: The Union and Intersection of Two Sets - Mathematics

Learning Outcomes

1. Find the union of two sets.
2. Find the intersection of two sets.
3. Combine unions intersections and complements.

All statistics classes include questions about probabilities involving the union and intersections of sets. In English, we use the words "Or", and "And" to describe these concepts. For example, "Find the probability that a student is taking a mathematics class or a science class." That is expressing the union of the two sets in words. "What is the probability that a nurse has a bachelor's degree and more than five years of experience working in a hospital." That is expressing the intersection of two sets. In this section we will learn how to decipher these types of sentences and will learn about the meaning of unions and intersections.

## Unions

An element is in the union of two sets if it is in the first set, the second set, or both. The symbol we use for the union is (cup). The word that you will often see that indicates a union is "or".

Example (PageIndex{1}): Union of Two sets

Let:

[A=left{2,5,7,8 ight} onumber]

and

[B=lbrace1,4,5,7,9 brace onumber ]

Find (Acup B)

Solution

We include in the union every number that is in A or is in B:

[Acup B=left{1,2,4,5,7,8,9 ight} onumber ]

Example (PageIndex{2}): Union of Two sets

Consider the following sentence, "Find the probability that a household has fewer than 6 windows or has a dozen windows." Write this in set notation as the union of two sets and then write out this union.

Solution

First, let A be the set of the number of windows that represents "fewer than 6 windows". This set includes all the numbers from 0 through 5:

[A=left{0,1,2,3,4,5 ight} onumber ]

Next, let B be the set of the number of windows that represents "has a dozen windows". This is just the set that contains the single number 12:

[B=left{12 ight} onumber ]

We can now find the union of these two sets:

[Acup B=left{0,1,2,3,4,5,12 ight} onumber ]

## Intersections

An element is in the intersection of two sets if it is in the first set and it is in the second set. The symbol we use for the intersection is (cap). The word that you will often see that indicates an intersection is "and".

Example (PageIndex{3}): Intersection of Two sets

Let:

[A=left{3,4,5,8,9,10,11,12 ight} onumber ]

and

[B=lbrace5,6,7,8,9 brace onumber ]

Find (Acap B).

Solution

We only include in the intersection that numbers that are in both A and B:

[Acap B=left{5,8,9 ight} onumber ]

Example (PageIndex{4}): Intersection of Two sets

Consider the following sentence, "Find the probability that the number of units that a student is taking is more than 12 units and less than 18 units." Assuming that students only take a whole number of units, write this in set notation as the intersection of two sets and then write out this intersection.

Solution

First, let A be the set of numbers of units that represents "more than 12 units". This set includes all the numbers starting at 13 and continuing forever:

[A=left{13,:14,:15,:... ight} onumber ]

Next, let B be the set of the number of units that represents "less than 18 units". This is the set that contains the numbers from 1 through 17:

[B=left{1,:2,:3,:...,:17 ight} onumber ]

We can now find the intersection of these two sets:

[Acap B=left{13,:14,:15,:16,:17 ight} onumber ]

## Combining Unions, Intersections, and Complements

One of the biggest challenges in statistics is deciphering a sentence and turning it into symbols. This can be particularly difficult when there is a sentence that does not have the words "union", "intersection", or "complement", but it does implicitly refer to these words. The best way to become proficient in this skill is to practice, practice, and practice more.

Example (PageIndex{5})

Consider the following sentence, "If you roll a six sided die, find the probability that it is not even and it is not a 3." Write this in set notation.

Solution

First, let A be the set of even numbers and B be the set that contains just 3. We can write:

[A=left{2,4,6 ight},:::B:=:left{3 ight} onumber ]

Next, since we want "not even" we need to consider the complement of A:

[A^c=left{1,3,5 ight} onumber ]

Similarly since we want "not a 3", we need to consider the complement of B:

[B^c=left{1,2,4,5,6 ight} onumber ]

Finally, we notice the key word "and". Thus, we are asked to find:

[A^ccap B^c=:left{1,3,5 ight}capleft{1,2,4,5,6 ight}=left{1,5 ight} onumber ]

Example (PageIndex{6})

Consider the following sentence, "If you randomly select a person, find the probability that the person is older than 8 or is both younger than 6 and is not younger than 3." Write this in set notation.

Solution

First, let A be the set of people older than 8, B be the set of people younger than 6, and C be the set of people younger than 3. We can write:

[A=left{xmid x>8 ight},:::B:=:left{xmid x<6 ight},:C=left{xmid x<3 ight} onumber ]

[Acupleft(Bcap C^c ight) onumber ]

Notice that the complement of "(< )" is "(ge)". Thus:

[C^c=left{xmid xge3 ight} onumber ]

Next we find:

[Bcap C^c=left{xmid x<6 ight}capleft{xmid xge3 ight}=left{xmid3le x<6 ight} onumber ]

Finally, we find:

[Acupleft(Bcap C^c ight)=:left{xmid x>8 ight}cupleft{xmid3le x<6 ight} onumber ]

The clearest way to display this union is on a number line. The number line below displays the answer:

Exercise

Suppose that we pick a person at random and are interested in finding the probability that the person's birth month came after July and did not come after September. Write this event using set notation.

• Ex: Find the Intersection of a Set and A Complement Using a Venn Diagram
• Intersection and Complements of Sets

## The Union and Intersection of Two Sets

• Contributed by Larry Green
• Professor (Math) at Lake Tahoe Community College
1. Find the union of two sets.
2. Find the intersection of two sets.
3. Combine unions intersections and complements.

All statistics classes include questions about probabilities involving the union and intersections of sets. In English, we use the words "Or", and "And" to describe these concepts. For example, "Find the probability that a student is taking a mathematics class or a science class." That is expressing the union of the two sets in words. "What is the probability that a nurse has a bachelor's degree and more than five years of experience working in a hospital." That is expressing the intersection of two sets. In this section we will learn how to decipher these types of sentences and will learn about the meaning of unions and intersections.

## Intersection of sets

Given two sets A and B, the intersection is the set that contains elements or objects that belong to A and to B at the same time.

Basically, we find A ∩ B by looking for all the elements A and B have in common.  Next, we illustrate with examples.

To make it easy, notice that what they have in common is in bold.

Find the intersection of A and B and then make a Venn diagrams.

Since no countries in Asia and Africa are the same, the intersection is empty.

This example is subtle! Since the empty set is included in any set, it is also included in A although you don't see it.

Therefore, the empty set is the only thing set A and set B have in common.

In fact, since the empty set is included in any set, the intersection of the empty set with any set is the empty set.

Definition of the union of three sets:

Given three sets A, B, and C the intersection is the set that contains elements or objects that belong to A, B, and to C at the same time.

Basically, we find A ∩ B ∩ C by looking for all the elements A, B, and C have in common.

The graph below shows the shaded region for the intersection of two sets

## Union vs Intersection

The difference between union and intersection can be compared on the basis of their general definitions, mathematical definitions, symbolic representations, logical inferences, process characteristics and examples.

Let us understand how to use the word ‘union’ in a sentence. For example, ‘The union of technology from the United States of America and workforce from India, can manufacture millions of doses of vaccine every day’. Here the word ‘union’ means to join the capabilities of both the countries to manufacture the vaccine.

Now let us understand how to use the word ‘intersection’ in a sentence. For example, ‘the accident took place at the intersection of the Prince Louis Road and Queen Elizabeth Road’. Here the word ‘intersection’ means the crossing point of the two roads. It describes the common point of the two roads.

Thanks to Rajat Rawat for suggesting this solution.

Intersection of arrays arr1[] and arr2[]

To find intersection of 2 sorted arrays, follow the below approach :

1) Use two index variables i and j, initial values i = 0, j = 0
2) If arr1[i] is smaller than arr2[j] then increment i.
3) If arr1[i] is greater than arr2[j] then increment j.
4) If both are same then print any of them and increment both i and j.

Below is the implementation of the above approach :

## Set Identities

• Notice the similarity between the corresponding set and logical operators: (vee,cup) and (wedge,cap) and (overline>, eg).
• There's more to it than similar-looking symbols.
• We'll be careful for this one and manipulate the set builder notation.
• Could have also given a less formal proof. (See section 2.2 example 10 for that.)
• This is a case where it's probably easier to be more formal: it's so painful to write all of the details in sentences, that the seven steps in that proof are nicer to read. (See example 10 for an example of that too.)
• For any one of the set operations, we can expand to set builder notation, and then use the logical equivalences to manipulate the conditions.
• Since we're doing the same manipulations, we ended up with the same tables.
• Be careful with the other operations. Just because it worked for these, doesn't mean you can assume everything is the same. There is no logical version of set difference, or set version of exclusive or (at least as far as we have defined).

Theorem: For any sets, (A-B = Acapoverline).

Less Formal Proof: The set (A-B) is the values from (A) with any values from (B) removed.

The set (overline) is the set of all values not in (B). So intersecting with (overline) has the effect of leaving only the values not in (B). That is, (Acapoverline) is the (A) with all of the values from (B) removed. Thus we see that these sets contain the same elements. ∎

• The &ldquoless formal&rdquo version has to be written carefully enough to convince the reader (or TA in your case).
• The &ldquomore formal&rdquo version has more steps and leaves out the intuitive reason (that might help you actually remember why).

Proof: For sets (A,B,C) from the above theorem, we have, [egin A-(Bcup C) &= Acap overline &= Acap overlinecap overline &= Acap overlinecap Acap overline &= (A-B)cap (A-C),.quad<>∎ end]

## What is union and intersection of events?

The UNION of two sets is the set of elements which are in either set. The INTERSECTION of two sets is the set of elements which are in both sets. For example: let A = (1,2,3) and B = (3,4,5). The INTERSECTION of A and B, written A. B = (3).

Similarly, what does ∩ mean? Definition of Intersection of Sets: Intersection of two given sets is the largest set which contains all the elements that are common to both the sets. The symbol for denoting intersection of sets is '&cap'.

In respect to this, what is union of event?

Union of Events. Definition: Union of Events. The union of events A and B, denoted A&cupB, is the collection of all outcomes that are elements of one or the other of the sets A and B, or of both of them.

Does the union include the intersection?

The union of two sets contains all the elements contained in either set (or both sets). The union is notated A ⋃ B. The intersection of two sets contains only the elements that are in both sets.

## Practice questions

1. Determine whether the following pairs of events are mutually exclusive:

2. Two dice are rolled, and the events G and H are as follows. G = , H = . Use the addition rule to find .

3. At Ryerson University, 20% of the students take a Mathematics course, 30% take a Statistics course, and 10% take both. What percentage of students take either a Mathematics or Statistics course?

4. The following table shows the distribution of coffee drinkers by gender:

 Coffee drinker Males (M) Females (F) TOTAL
 Yes (Y) 31 33 64 No (N) 19 17 36 50 50 100

Use the table to determine the following probabilities:

a.

b.

5. If , , and , use the addition rule to find .

6. A provincial park has 240 campsites. A total of 90 sites have electricity. Of the 66 sites on the lakeshore, 24 of them have electricity. If a site is selected at random, what is the probability that:

## Set Theory for Union and Intersection

We use Venn Diagrams to show unions and intersection. Image by Mike DeHaan

The approach which relates most closely to the question involves set theory. Let A= and B=.

The union of sets ‘A’ and ‘B’ is the set containing the unique elements found in either set ‘A’ or set ‘B’, or both. In other words, “Bring all the elements together but discard duplicates”. AB=.

The intersection of sets ‘A’ and ‘B’ is the set containing the unique elements from both set ‘A’ and set ‘B’. In other words, to create an intersection, only select elements found in both original sets, which are the duplicates discarded by the union operation. A∩B=

With reference to the original question, from the view of set theory, the word “union” relates to the ‘‘ symbol and the word “intersection” relates to the ‘∩’ symbol.

Math symbols can be confusing! Image by JRS

Our reader’s question also asked about ‘V’ and upside-down ‘V’, ‘Λ’ or Lambda. These are used in mathematical logic.

Let statement A = “All humans are mammals.” Let B = “All mammals are humans.” Let C = “Some birds can fly under some conditions.” Both ‘A’ and ‘C’ are true statements, but ‘B’ is false.

Let ‘X’ and ‘Y’ represent any possibly true or false statements.

In the math of logic, the statement “X and Y”, or “XΛY”, is true if and only if both ‘X’ and ‘Y’ are true.

However, “X or Y”, or “XY”, is false if and only if both ‘X’ and ‘Y’ are false. “XY” is true if either ‘X’ or ‘Y’ is true, which includes the situation where both ‘X’ and ‘Y’ are true.

From the example statements, “AB”, “AC” and “BC” are all true. However, “AΛB” and “BΛC” are both false. Only “AΛC” is true because each of statements ‘A’ and ‘C’ are true.

## Definition of the union of three sets

Given three sets A, B, and C the union is the set that contains elements or objects that belong to either A, B, or to C or to all three.

Basically, we find A ∪ B ∪ C by putting all the elements of A, B, and C together.

The first graph in the beginning of this lesson shows the shaded region for the union of two sets.

The graph below shows the shaded region for the union of three sets

This ends the lesson about union of sets. If you have any questions about the union of sets, I will be more than happy to answer them.

## Descriptions of Set Operations

In mathematics, a set operation is a function that takes two sets, or unordered lists, and generates a third list based on a standard operation. These operations are related to, but different from, stardard math operations like addition and subtraction in that they act on the entire list as a whole.

See below for a more detailed description of each operation.

### Union

The union of two sets contains all the elements that appear in either of the sets. Another way of thinking about it is to imagine the union as the "sum" of the two sets, set 1 and set 2, excluding any duplicate values.

For example, suppose Mary and Carlos are buying fruits and vegetables at a farmstand. Mary's basket contains:

When they get home, together they purchased the following:

This is the union of the two sets!

### Intersection

The intersection of two sets is only the elements that appear in both sets. The most common way to think about this is to visualize the intersecting part of a Venn Diagram. This is the list of items that are shared between the two sets.

For example, suppose you are a teacher and are trying to determine which of your students play multiple sports based on the roster of each team. The tennis team roster contains:

while the swim team roster includes:

If you want to see which student is shared between the two sports, you determine that the only student that plays multiple sports is:

This is the intersection of the two sets!

### Difference

The difference of two sets is all the elements that appear in the first set, except for any elements that appear in the second set. Unlike union and intersection, order matters when determining the difference, as the second set is “subtracted” from the first set.

For example, suppose a teacher is trying to create a list of all their students that are in math courses except for any students that are currently taking geometry. She can use the difference of two sets to identify the list of students. The full list of students taking math courses is: