Lesson Library> Sets & Venn Diagrams

Sets & Venn Diagrams

At my friend's high school there are $740$ students. Among these:

  • $300$ study maths
  • $200$ study science
  • $160$ study medicine
  • $110$ study math and science
  • $90$ study math and medicine
  • $40$ study all three subjects
  • $320$ don't study any of these subjects

How many students are studying science and medicine? 

This problem is quite tricky to wrap one’s head around. Just among the $300$ math students, there will be some who study only math, some only math and science, some only math and medicine, and some who study all three subjects. There are so many overlaps between the three subjects that we easily might count the same student twice. In this lesson, you’ll learn a simple technique for breaking down these types of problems so you can solve them with ease! 

Introduction to Sets

A set is a collection of objects. The European countries, all positive integers or the objects on your desk are three examples of different sets. A set is typically defined by placing all objects within curly brackets and separating them with commas. The set of all odd digits can therefore be denoted in the following way:

$$\{1, 3, 5, 7, 9 \}$$

Some sets, like all European countries, are too long to be written in this way. We can denote this set as:

{$x:x$ is a country in Europe}

Although this way is shorter compared to listing all the countries one at a time, it is still laborious to write {$x:x$ is a country in Europe}. We can solve this by naming the set. We could define $L$ as the set of all European countries, and whenever we want to refer to that set we just write $L$. All common types of numbers already have given names because we refer to these sets so often. Each such set of numbers is symbolized by a capitalized letter as follows: 

  • $\mathbb{N}$:   The natural numbers
  • $\mathbb{Z}$:   The integers
  • $\mathbb{Q}$:   The rational numbers
  • $\mathbb{R}$:   The real numbers
  • $\mathbb{C}$:   The complex numbers

Note! Some sources include $0$ in the natural numbers while other sources do not. The most common definition is that $0$ is included in the set $\mathbb{N}$, but to be extra clear it is good to write $\mathbb{N} _0$ to indicate if the set includes $0$. If not, we can express this as $\mathbb{N } _1$ or $\mathbb{N } _+$. 

An object in a set is called an element. For example, $3$ is an element in the set $\{1, 3, 5, 7, 9 \}$. When an element $x$ belongs to the set $A$ we can write this as $x \in A$. When an element $y$ does not belong to the set $A$, we write it as $y \notin A$. If we want to say that $x$ is a real number, we can express it in the more concise form $x \in \mathbb{R}$.

Finally, we can express the number of elements in the set $A$ as $|A|$. The number of elements which the set contains is called the cardinality of the set. For example, the set of all Scandinavian countries has cardinality $5$ because the set consists of five countries: Norway, Sweden, Finland, Denmark and Iceland. Sometimes the cardinality of a set $A$ is also denoted as $n(A)$ but $|A|$ is the most common way to write it.

Subsets

If all elements in the set $B$ are also present in the set $A$, we say that $B$ is a subset of $A$. We denote this as $B \subseteq A$. Thus, $\{3, 1 \} \subseteq\{1, 3, 5, 7, 9 \}$. A set is just a collection of objects so the order we list them in does not matter. Since a set $A$ contains all the elements in $A$, it is generally true that $A$ is a subset of itself.

A set that doesn’t contain any elements is called the empty set and is denoted as $\{\}$ or, more commonly, with the symbol $\varnothing$. The empty set is a subset of all other sets. 


Exercise 1

How many subsets of {green, yellow} are there?

There are $\pmb{4}$ subsets: {green, yellow}, {green}, {yellow} and $\varnothing$.


Exercise 2

How many subsets of {green, yellow, blue, red} are there?

There are $\pmb{16}$ subsets: {green, yellow, blue, red}, {green, yellow, blue}, {green, yellow, red}, {green, blue, red}, { yellow, red, blue}, {green, yellow}, {green, blue}, {green, red}, {yellow, blue}, {yellow, red}, {blue, red}, {green}, {yellow}, {blue}, {red} and $\varnothing$.


Exercise 3

How many subsets does a set with $10$ unique elements have? Can you see a pattern from the previous two exercises? 

From exercises 1 and 2, we can see that a set with $2$ elements had four subsets and a set with $4$ elements had $16$ subsets. It seems as if the number of subsets is equal to the number of elements in the set raised to the power of $2$. Let's see if there is an explanation behind this pattern.

When we create a subset, each element in the set gives us two choices: we can either choose to include the element in the subset or not. A set like {green} that contains only one element gives us two subsets: {green} and $\varnothing$. If we now add the element yellow to the set the number of subsets doubles to: {green, yellow}, {yellow}, {green} and $\varnothing$. For each subset we already had we can create one new subset by adding the element yellow to the original subsets. In this way, the number of subsets continues to double for each new element that is added to the set. A set with $n$ elements will therefore have $2^n$ subsets, so a set with $10$ elements has $2^{10}=\pmb{1024}$ subsets. 


When Two Sets Are Combined
Unions

Let’s say that we have two sets $A$ and $B$ so that $A =\{2, 4, 5, 9, 12 \}$ and $B =\{1, 2, 5, 11 \}$. By combining both sets we get $\{1, 2, 4, 5, 9, 11, 12 \}$. An element may only occur once in a set so we remove all duplicates. The new set we have created is called the union of $A$ and $B$, which is denoted as $A \cup B$. The number of elements in the union of $A$ and $B$ is denoted as $|A \cup B|$.


Exercise 1

a) $A =$ {Henrik, Camilla, Didrick}, $B$ = {Albert, Lina, Camilla}

b) $A =\{2 , 6, 1, 5 \}, \ B =\{5, 3, 6, 4 \}$

a) $A \cup B =$ {Henrik, Camilla, Didrick, Albert, Lina}

b ) $A \cup B =\pmb{\{1, 2, 3, 4, 5, 6 \}}$


Exercise 2

If the sets $A$ and $B$ contain four and nine elements respectively and they have two elements in common, how many elements are there in the union $A \cup B$?

The sets contain a total of $4 + 9 = 13$ elements, but two of these occur in both sets so we have to subtract these from the sum to avoid counting them twice. The number of elements in $A \cup B$ is thus $13 - 2 = \pmb{11}$.


Intersections

Let's say we now wish to create a set that consists of the elements that are in both $A$ and $B$. The only elements that the two sets have in common are $2$ and $5$ so the new set only becomes $\{2, 5 \}$. This is called the intersection of $A$ and $B$ and is written as $A \cap B$.


Exercise 3

Find the intersection of $\{0, 2, 4, 6, 8… \}$ and {$x:x$ is a multiple of $9$}.

One set contains all even, non-negative integers and the other contains all multiples of $9$. The elements that the sets have in common are thus the positive numbers which are a multiple of $2 \cdot 9 = 18$. The intersection of the sets is thus $\pmb{\{0, 18, 36, 54, 72… \}}$. Remember that $0$ is divisible by all numbers.


If we only want to refer to the elements that are only in $A$ and not $B$, we denote this as $A-B$. This is called set difference of $B$ and $A$, or more formally, the relative complement of $A$ with respect to $B$. Sometimes $A \ \backslash \ B$ is also used instead to denote the elements in $A$ except those that are also in $B$, but $A-B$ is the notation that we will use in this lesson. Don't be confused by all these notations. Just remember that $A-B$ are all the elements in $A$ minus those that are also in $B$. 


Exercise 4

Determine the following:

a) $\{8, 3, 4, 10, 5 \} - \{2, 7, 9, 3, 8 \}$

b) $\{12, 9, 5, 10, 0 \} - (\{2, 11, 9, 1, 8 \} \cup \{5, 1, 2, 3, 8 \})$

a) $\{8, 4, 3, 10, 5 \} -\{2, 7, 9, 3, 8 \} = \pmb{\{4, 5, 10 \}}$

b) $\{12, 9, 5, 10, 0 \} - (\{2, 11, 9, 1, 8 \} \cup \{5, 1, 2, 3, 8 \}) \ = \ \{12, 9, 5, 10, 0 \}- (\{1, 2, 3, 5, 8, 9, 11 \}) \ = \ \pmb{\{0, 10, 12 \}}$


Exercise 5

Prove that:

$$|A|+|B|-|A \cap B|=|A \cup B|$$

We can rewrite $|A|$ and $|B|$ as:

$$|A|=|\text{Only} \ A|+|A \ \text{and} \ B| \\ |A|=|A-B|+|A \cap B|$$
$$|B|=|\text{Only} \ B|+|A \ \text{and} \ B| \\ |B|=|B-A|+|A \cap B|$$

This implies that:

$$|A|+|B|= (|A - B|+|A \cap B|) + (|B - A| + |A \cap B|)$$
$$|A|+|B|=(|A - B|+|B - A|+|A \cap B|) + |A \cap B|$$
$$|A|+|B|=(|A \cup B|) + |A \cap B|$$
$$|A|+|B| - |A \cap B|=|A \cup B|$$


The Universal Set and Complements

Another set that is good to know is the universal set, which is the set that contains all the elements that are considered in the given situation. If we have the two sets $\{- 6, 2, 7 \}$ and $\{4, -5, 2 \}$ the universal set is $\mathbb{Z}$: all integers. If we instead have two sets where the elements are all Brits who like to play football and listen to pop music, respectively, the universal set is the British's population. The universal set is usually denoted by a capital $U$.

The set consisting of all elements not present in the set $A$ is called the complement to $A$ and is denoted by $A^C$. It is therefore true that:

$$A \cup A^C = U$$

If we take all elements that belong to $A$ and combined with all elements that don't belong to $A$, obviously we end up with all elements that exist. We can also express this as $U - A^C = A$.

Sometimes the complement of $A$ is also denoted as $A´$ with an apostrophe or $\overline{A}$ with an overline, but in this lesson we will use $A^C$. 


Exercise 6

What is $U^C$?

The universal set includes all elements that we consider in the given scenario. The complement to $U$ is thus the empty set: $\pmb{\varnothing}$


Venn Diagrams

A great way to illustrate sets is by using venn diagrams. The idea is to represent each set as a circle. These circles all lie within a larger rectangle that represents the universal set. The area that is outside the circle $A$ is thus the complement to $A$, shown below by the figure to the right.




The intersection of two sets $A$ and $B$ is illustrated by the area where the circles $A$ and $B$ overlap. The union between the sets is the entire area that lies within the circles.



Exercise 1

Draw venn diagrams describing the following sets:

a) $A \cap B^C$

b) $(A \cup B) \cap C$

c) $A^C \cap (B \cap C)$


Tip! Whenever you are drawing the intersection of two sets, it easiest to lightly shadow both sets and then see where the shades overlap. The darkest shaded area where all sets overlap is the intersection you are looking for. 

a) 


b)

 

c) 



Sets And Overcounting

$1000$ people went to at least one of three concerts: Pop Frenzy, Mad Rock and Smoking Blues. $460$ went to Pop Frenzy, $560$ went to Mad Rock, $500$ went to Smoking Blues, $220$ went to both Pop Frenzy and Mad Rock, $240$ went to both Mad Rock and Smoking Blues and $200$ went to both Pop Frenzy and Smoking Blues. 


Exercise 2

Let us add the number of people who were present at each concert $(460+560$$+500=1520)$.

a) How many times have we counted those who went to two concerts?

b) How many times have we counted those who went to all three concerts?

a) We will have counted those that went to two concerts twice: once for the first concert and once for the second concert.

b) Those that went to all three concerts will have been counted three times.

This can be illustrate with a venn diagram. Let us lightly shade each concert's entire circle to indicate that it has been counted. Then the three areas where exactly two circles overlap will be  shaded twice and the area in the middle where all circles overlap will be shaded three times. 


Exercise 3

Let us now subtract the number of people that were present at two concerts $(1520-220-$$240-200=$$860)$.

a) How many times have we counted those who went to exactly two concerts?

b) How many times have we counted those who went to all three concerts?

Let us remove one layer of shade from an area in the venn diagram every time we subtract the number of people which that area represents. This means that we will remove one layer of shade from the three mid-grey areas and three layers of shade from the dark grey area in the middle. 

a) Those that went to exactly two concerts have been counted twice and removed once so they are counted once.

b) Those that went to all three concerts have been counted three times and removed three times so they are never counted. 


Exercise 4

How many went to all three concerts?

By adding those present at each concert $(460+560+500$$=1520)$ and subtracting those who went to two concerts $(1520-220-$$240-200$$=860)$, we have counted every subset once except those who went to all three concerts. This means that $1000-860=$$\pmb{140}$ people went to all three concerts. 


How to Use Venn Diagrams

Venn diagrams are a very useful tool for solving word problems where there are multiple sets. It's tedious to keep track of all elements in your head. But by representing them visually through a venn diagram we can easily sort each element into the right set. When we work with venn diagrams, it is always easiest to start with the area that consists of the most overlaps and then work our way outwards.

For example, imagine that we have two sets $A$ and $B$. We know that there are $100$ elements in $A$, $55$ elements in $B$ and $35$ elements in the intersection of $A$ and $B$. When filling out the venn diagram we start by writing "$35$" in the area where the two circles overlap. The number of elements found only in $A$ is then $100 - 35 = 65$ and the number of elements found only in $B$ is $55 - 35 = 20$. By starting with the area that consists of the most overlaps and working outwards, we reduce the risk of counting the same element twice



Example 1

$35$ out of $1000$ people have high blood pressure. $80\%$ of those with high blood pressure drink alcohol and $60\%$ of those without high blood pressure drink alcohol. What percentage (fractional expression) of those who drink alcohol have high blood pressure?

Solution

Let $A$ be the set of the people who drink alcohol and $B$ be the set of people with high blood pressure. Let's start by finding the number of people who are present in both sets. Because $80\%$ of the $35$ people with high blood pressure drink alcohol, $|A \cap B|= 0.8 \cdot 35 = 28$.


This means that $|B-A|$, the number of people with high blood pressure who do not drink alcohol, is $35 - 28 = 7$. There are a total of $1000 - 35 = 965$ people who do not have high blood pressure. Of these people, $0.6 \cdot 965 = 579$ drink alcohol. These $579$ people belong to the area that consists of circle $A$ but not circle $B$, as they do not have high blood pressure. The number of people who neither drink alcohol nor have high blood pressure is $1000-579-7-28 = 386$. We now have enough information to fill in the entire venn diagram.


The total number of people who drink alcohol is $579 + 28 = 607$. The percentage of people who have high blood pressure of those who drink alcohol is thus $\pmb{\dfrac{28}{607}}$.

You might have noticed that it wasn't necessary for us to determine the number of people who neither had high blood pressure nor drank alcohol to solve the problem. I only determined this number in the solution above to show you what the complete venn diagram would look like. When solving problems yourself, however, you should not spend time figuring out things that aren't needed. Always start by identifying what information you need to solve the problem and ignore everything else.


Exercise 1

In a survey, class 9B had to answer "Yes" or "No" as to whether they liked the subjects art, math and geography. The results were as follows:

  • $4$ students liked all three subjects
  • $7$ students liked art and math
  • $4$ students liked maths and geography
  • $9$ students liked art and geography
  • $14$ students liked art
  • $19$ students liked math
  • $10 ​​$ students liked geography

In total there are $30$ students in 9B. Draw a venn diagram and fill in the number of students who like each subject. 


Try adding up the different subsets to convince yourself that the venn diagram above is correct. For example, the number of students who like art in the diagram $2+3+5+4=14$, just as the question told us it should be. 


Exercise 2

At a summer sports camp, $60\%$ of the participants play football and $30\%$ of the participants swim. In addition, $40\%$ of the football players swim. What percentage of those who don’t swim play football?

The number of participants who play football among those who don’t swim is the same as the number of participants who only play football. Since $40\%$ of the football players swim, $0.6 \cdot 0.4 = 24\%$ of the participants practice both sports. This means that $60\% - 24\% = 36\%$ of the participants only play football. Furthermore, $70\%$ of the participants don’t swim. 


It follows that the percentage of participants who play football among those who don’t swim is $\dfrac{36}{70}=\pmb{\dfrac{18}{35}}$.


By now, you should be skilled enough at sets and venn diagrams to take on the problem we posed at the beginning of this lesson! 


Exercise 3

At my friend's high school there are $740$ students. Among these:

  • $300$ study maths
  • $200$ study science
  • $160$ study medicine
  • $110$ study math and science
  • $90$ study math and medicine
  • $40$ study all three subjects
  • $320$ don't study any of these subjects

How many students are studying science and medicine? 

This problem is perfect for using venn diagrams! As always, let's start with the area in the middle and work our way outwards. Since $40$ students study all three subjects, this means that $110-40=70$ students study math and science but not medicine and $90-40=50$ students study math and medicine but not science. Let $x$ be the number of students who study science and medicine but not math. 

From this, it follows that the number of students who only study math is $300-70-40-50=140$, the number of students who study only science is $200-70-40-x=90-x$ and the number of students who only study medicine is $160-50-40-x=70-x$. The number of students who don't study any of the three subjects is $320$. 


Since there are $740$ students at the high school in total we have: 

$$320+140+(90-x)+(70-x)+70+50+x+40 \ = \ 740$$

$$x \ = \ 40$$

So the complete venn diagram looks as follows:

The number of students who study science and medicine is therefore $40+40=\pmb{80}$.


Problems to Solve

It's time for you to test your new-found skills with sets and venn diagrams! Below you'll find several problems to practise on. If you can solve all of these you have a thorough understanding of this topic. 


Exercise 1

Are the following statements always true?

a) $A \subseteq \mathbb{Z}$ if $2.5 \in A$

b) $A \subseteq \mathbb{Z}$ if $2, 3, 10 \in A$

c) $\{6, 8, 11 \} \subseteq\{1, 5, 11 \} \cup\{11, 6, 9, 8 \}$

d) $A = B$ if $A - B = \varnothing$

e) $(A^C \cup B^C) \cup (A \cap B) = U$

a) If $2.5$ belongs to the set $A$, it is impossible for $A$ to be a subset of $\mathbb{Z}$ which is the set of all integers. The statement is therefore false.

b) From the given information we know only that $2$, $3$ and $10 ​​$ are three elements in $A$, but we don’t know which other elements that $A$ contains. The statement is therefore not always true but it could be.

c) The union of the sets $\{1, 5, 11 \}$ and $\{11, 6, 9, 8 \}$ is $\{1, 5, 6, 8, 9, 11 \}$. This set contains all the elements in $\{6, 8, 11 \}$. The statement is therefore true.

d) If $A - B = \varnothing$ means that all elements contained in $A$ are also present in $B$. But it is possible that $B$ also contains more elements than just those found in $A$, for example $A=\{1,2\}$ and $B=\{1,2,3\}$. The statement is therefore not always true but it could be.

e) The union of the complements to $A$ and $B$ is equal to the universal set minus the elements found in the mean of $A$ and $B$. However, if we add the cut, we will cover all elements that are in the universal set. The statement is therefore true.


Exercise 2

Which sets $X$ are there that satisfy $\{4, 6, 7 \} \subseteq X \subseteq\{2, 3, 4, 5, 6, 7 \}$?

There are $\pmb{8}$ sets that $X$ could assume:

$\{4, 6, 7 \},\{2, 4, 6, 7 \},\{3, 4, 6, 7 \},\{4, 5, 6, 7 \},\{2, 3, 4, 6, 7 \},\{2, 4, 5, 6, 7 \},\{3, 4, 5, 6, 7 \}$ and $\{2, 3, 4, 5, 6, 7 \}$.



Exercise 3

In Georgetown there are $351$ driving license holders. Each license holder owns either a car, a motorcycle or both. There are $331$ car owners and $45$ motorcycle owners in Georgetown. How many of the car owners do not own a motorcycle?

Let $x$ be the number of driving license holders who own both a car and a motorcycle. Since there are no driving license holders who do not own a vehicle, it follows that:

$$351 = 331 + 45 - x$$
$$x = 25$$

So the number of car owners who do not own a motorcycle is $331 - 25 = \pmb{306}$.


Exercise 4

Among the students at East Shores Academy, there are as many girls as boys. Some of the students go on a field trip to the particle accelerator at CERN. Two thirds of all the girls and three quarters of all the boys go on the trip. What proportion of those who went on the trip were girls?

Let $x$ be the number of students at the school. This means that the number of girls who went on the trip was $\frac{2}{3} \cdot \frac{x}{2} = \frac{x}{3}$ and the number of boys who went was $\frac{3}{4} \cdot \frac{x}{2} = \frac{3x}{8}$. The proportion of girls who took part in the trip must then have been:

$$\dfrac{\dfrac{x}{3}}{\dfrac{x}{3} + \dfrac{3x}{8}} \ =$$

$$\dfrac{ \dfrac{x}{3}}{\dfrac{8x}{24} + \dfrac{9x}{24}} \ =$$

$$\dfrac{\dfrac{x}{3}}{\dfrac{17x }{24}} \ =$$

$$\dfrac{8x}{17x} \ =$$

$$\pmb{\dfrac{8}{17}}$$


Exercise 5

An animal shelter outside the city takes care of dogs and cats in need. Some of the animals are playful and some of them have black fur. Let $D$ be the set of dogs, $P$ be the set of playful animals and $B$ be the set of animals with black fur. Use the given sets above to denote to following subsets and shade each subset in a venn diagram:

a) Dogs with black fur.

b) Cats that aren’t playful.

c) Dogs that have black fur or are playful.

d) Dogs with non-black fur of the animals that aren’t playful.

e) Playful cats of the animals with non-black fur.

a) $\mathbf{D \cap B}$


b) $\mathbf{D^C - P}$ or $\mathbf{D^C \cap P^C}$


c) $\mathbf{D \cap (B \cup P)}$ or $\mathbf{(D \cap P) \cup (D \cap B)}$



d) $\mathbf{D - B - P}$ or $\mathbf{(D \cap B^C) \cap P^C}$


e) $\mathbf{P - D - B}$ or $\mathbf{(D^C \cap P) \cap B^C}$


Exercise 6

In a residential area there are $100$ families. $62$ of the families have at least one girl and $59$ of the families have at least one boy. There are twice as many families with both boys and girls as there are families with no children. How many families have boys but no girls?

Let $x$ be the number of families with both boys and girls. The number of families with no children is then $\frac{x}{2}$. 


We now have:

$$62 + 59 - x + \dfrac{x}{2} = 100$$

$$\dfrac{x}{2} = 21$$

$$x = 42$$

So there are $59 - 42 = \pmb{17}$ families that have boys but no girls.



Exercise 7

In the River Valley School election, all the school's students participated. Everyone who voted for the Simon Party likes Simon. Among those who voted for the other parties, $20$% still like Simon. What percentage of the votes did the Simon Party get in the election if $52$% of all the school's students like Simon?

Let $x$ be the percentage of students who voted for Simon. The percentage of students who did not vote for him was therefore $100-x$. Since $\frac{1}{5}$ ($20$%) of those who voted for other parties like Simon, it means that $\frac{4}{5}$ of those who voted for other parties do not like Simon. 

The proportion of students who do not like Simon is $100-52 = 48$ percent. This means that:

$$\frac{4}{5} \cdot (100-x) = 48$$

$$(100-x) = 60$$

$$x = 40$$

So the Simon Party got $\pmb{40}$ percent of the votes.


Exercise 8

There are $1300$ students at a high school. Some students sing in the school choir, while some students practice athletics. A quarter of those who practice athletics also sing in the choir, while the proportion of students who practice athletics among those who sing in the choir is four times the proportion of students who practice athletics among those who do not sing in the choir. How many students sing in the school choir?

Let $a$ be the number of students who practise athletics, let $s$ the number of students who sing in the choir and let $x$ be the number of students who pursue both of activities. Since a quarter of those who practice athletics also sing in the choir, this means that:

$$\frac{x}{a}=\frac{1}{4}$$

There are $a-x$ students who practice athletics but don't sing in the choir, and the total number of students who don't sing in the choir is $1300-s$. The proportion of students who practice athletics among those who don't sing in the choir is therefore $\frac{a-x}{1300-s}$. The proportion of students who practise athletics among those who sing in the choir is $\frac{x}{s}$. We know that this last proportion is four times greater than the first one. This implies that:

$$\frac{x}{s}=4 \cdot \frac{a-x}{1300-s}$$

Rearranging the first equation $\frac{x}{a}=\frac{1}{4}$ to $4x=a$ and substituting $a$ in the second equation gives us:

$$\frac{x}{s}=4 \cdot \frac{4x-x}{1300-s}$$

Multiplying both sides with $s$ and $1300-s$:

$$x(1300-s)=4s(3x)$$

$$1300x-sx=12sx$$

$$1300x=13sx$$

$$1300x=13sx$$

$$100=s$$

So there are $\mathbf{100}$ students who sing in the choir.