Corequisite Skills for Introductory StatisticsXYZ Homework Edition

4.2 Venn Diagrams and the Complement of a Set

Venn Diagrams and the Complement of a Set

A source-bound narrated opening with a worked example, an eight-second thinking pause, a checked result, English captions, and a transcript.

Have you ever ordered a new dresser or bookcase that required assembly? When your package arrives you excitedly open it and spread out the pieces. Then you check the assembly guide and verify that you have all the parts required to assemble your new dresser. Now, the work begins. Luckily for you, the assembly guide includes step-by-step instructions with images that show you how to put together your product. If you are really lucky, the manufacturer may even provide a URL or QR code connecting you to an online video that demonstrates the complete assembly process. We can likely all agree that assembly instructions are much easier to follow when they include images or videos, rather than just written directions. The same goes for the relationships between sets.

Interpreting Venn Diagrams

Venn diagrams are the graphical tools or pictures that we use to visualize and understand relationships between sets. Venn diagrams are named after the mathematician John Venn, who first popularized their use in the 1880s. When we use a Venn diagram to visualize the relationships between sets, the entire set of data under consideration is drawn as a rectangle, and subsets of this set are drawn as circles completely contained within the rectangle. The entire set of data under consideration is known as the universal set.

import numpy as np
import matplotlib.pyplot as plt

# EDIT the two lines below. `a` is True inside circle A, `b` is True inside B.
NAME   = "A union B"
region = lambda a, b: a or b
# others to try, in this section's notation:
#   A intersection B    lambda a, b: a and b
#   A'                  lambda a, b: not a
#   A' intersection B   lambda a, b: (not a) and b
#   (A union B)'        lambda a, b: not (a or b)
#   A but not B         lambda a, b: a and not b

n = 420
x, y = np.meshgrid(np.linspace(-2.55, 2.55, n), np.linspace(-1.75, 1.75, n))
inA = (x + 0.6) ** 2 + y ** 2 <= 1.2 ** 2
inB = (x - 0.6) ** 2 + y ** 2 <= 1.2 ** 2
shaded = np.vectorize(region)(inA, inB)

fig, ax = plt.subplots(figsize=(6.2, 4.3))
# The raster must span EXACTLY the U rectangle: a wider extent paints the
# complement outside the universal set, which says those points are in U.
ax.imshow(shaded, extent=(-2.55, 2.55, -1.75, 1.75), origin="lower",
          cmap="Blues", vmin=0, vmax=1.6, alpha=0.85, aspect="equal")
for cx, lab in ((-0.6, "A"), (0.6, "B")):
    ax.add_patch(plt.Circle((cx, 0), 1.2, fill=False, lw=2, color="black"))
    ax.text(cx * 2.0, 1.42, lab, fontsize=15, ha="center")
ax.add_patch(plt.Rectangle((-2.55, -1.75), 5.1, 3.5, fill=False, lw=1.5, color="black"))
ax.text(-2.38, 1.5, "U", fontsize=13)
ax.set_title("shaded region: " + NAME, fontsize=13)
ax.set_xticks([]); ax.set_yticks([])
for spine in ax.spines.values():   # only OUR rectangle should read as U
    spine.set_visible(False)
plt.show()

# Two circles cut the universal set into FOUR regions. The picture and this
# table say the same thing; if you cannot see the shading, read the table.
print("the four regions of a two-set Venn diagram")
labels = {(True, True): "in both A and B (the overlap)",
          (True, False): "in A but not B",
          (False, True): "in B but not A",
          (False, False): "in neither (outside both circles)"}
for key, text in labels.items():
    print(f"  {text:<34} {'SHADED' if region(*key) else 'not shaded'}")

Consider the statement: All trees are plants. This statement expresses the relationship between the set of all plants and the set of all trees. Because every tree is a plant, the set of trees is a subset of the set of plants. To represent this relationship using a Venn diagram, the set of plants will be our universal set and the set of trees will be the subset. This relationship is expressed symbolically as: Trees⊂Plants. To create a Venn diagram, first we draw a rectangle and label the universal set “U=Plants.” Then we draw a circle within the universal set and label it with the word “Trees.”

A single-set Venn diagram is shaded. Outside the set, it is labeled as 'Trees.' Outside the Venn diagram, 'U equals Plants' is labeled.
A single-set Venn diagram is shaded. Outside the set, it is labeled as 'Trees.' Outside the Venn diagram, 'U equals Plants' is labeled.
Figure 4.2

This section will introduce how to interpret and construct Venn diagrams. In future sections, as we expand our knowledge of relationships between sets, we will also develop our knowledge and use of Venn diagrams to explore how multiple sets can be combined to form new sets.

So far, the only relationship we have been considering between two sets is the subset relationship, but sets can be related in other ways. Lions and tigers are both different types of cats, but no lions are tigers, and no tigers are lions. Because the set of all lions and the set of all tigers do not have any members in common, we call these two sets disjoint sets, or non-overlapping sets.

Two sets A and B are disjoint sets if they do not share any elements in common. That is, if a is a member of set A, then a is not a member of set B. If b is a member of set B, then b is not a member of set A. To represent the relationship between the set of all cats and the sets of lions and tigers using a Venn diagram, we draw the universal set of cats as a rectangle and then draw a circle for the set of lions and a separate circle for the set of tigers within the rectangle, ensuring that the two circles representing the set of lions and the set of tigers do not touch or overlap in any way.

A two-set Venn diagram not intersecting one another is given. Outside the Venn diagram, 'U equals Cats' is labeled. The first set is labeled T equals tigers while the second set is labeled L equals lions.
A two-set Venn diagram not intersecting one another is given. Outside the Venn diagram, 'U equals Cats' is labeled. The first set is labeled T equals tigers while the second set is labeled L equals lions.
Figure 4.4

Creating Venn Diagrams

The main purpose of a Venn diagram is to help you visualize the relationship between sets. As such, it is necessary to be able to draw Venn diagrams from a written or symbolic description of the relationship between sets.

Procedure

To create a Venn diagram:

  1. Draw a rectangle to represent the universal set, and label it U=set name.
  2. Draw a circle within the rectangle to represent a subset of the universal set and label it with the set name.

The Complement of a Set

If set A is a proper subset of set U, the universal set (written symbolically as A⊂U), then there is at least one element in set U that is not in set A. The set of all the elements in the universal set U that are not in the subset A is called the complement of set A, A'. In set builder notation this is written symbolically as: A'={x∈U|x∉A}. The symbol ∈ is used to represent the phrase, “is a member of,” and the symbol ∉ is used to represent the phrase, “is not a member of.” In the Venn diagram below, the complement of set A is the region that lies outside the circle and inside the rectangle. The universal set U includes all of the elements in set A and all of the elements in the complement of set A, and nothing else.

Venn diagram: a rectangle representing universal set U contains a yellow circle representing set A. The region inside the rectangle and outside the circle is light blue. The U label is outside the upper left corner of the rectangle, and the A label is centered above the circle.
Venn diagram: a rectangle representing universal set U contains a yellow circle representing set A. The region inside the rectangle and outside the circle is light blue. The U label is outside the upper left corner of the rectangle, and the A label is centered above the circle.
Figure 4.11

Consider the set of digit numbers. Let this be our universal set, U={0,1,2,3,4,5,6,7,8,9}. Now, let set A be the subset of U consisting of all the prime numbers in set U, A={2,3,5,7}. The complement of set A is A'={0,1,4,6,8,9}. The following Venn diagram represents this relationship graphically.

Venn diagram with universal set U={0,1,2,3,4,5,6,7,8,9}. Circle A is labelled A={2,3,5,7}. The region inside U and outside A is labelled A′={0,1,4,6,8,9}.
Venn diagram with universal set U={0,1,2,3,4,5,6,7,8,9}. Circle A is labelled A={2,3,5,7}. The region inside U and outside A is labelled A′={0,1,4,6,8,9}.
Figure 4.12

For the following exercises, interpret each Venn diagram and describe the relationship between the sets, symbolically and in words.

A single-set Venn diagram is shaded. Outside the set, it is labeled as 'T equals Team sports.' Outside the Venn diagram, 'U equals Sports' is labeled.

A single-set Venn diagram is shaded. Outside the set, it is labeled as 'A equals Apples.' Outside the Venn diagram, 'U equals Fruit' is labeled.

A single-set Venn diagram is shaded. Outside the set is labeled 'P equals Pencils.' Outside the Venn diagram, 'U equals Writing Utensils' is labeled.

A single-set Venn diagram is labeled 'B equals Board Games'. Outside the Venn diagram, it is labeled as 'U equals Games.'

Venn diagram with universal set U=Writing Utensils. Disjoint circles C=Crayons and P=Pencils lie inside the rectangle.

Venn diagram with universal set U=Fruit. Disjoint circles A=Apples and P=Pears lie inside the rectangle.

Venn diagram with universal set U=Games. Disjoint circles A=Card Games and B=Video Games lie inside the rectangle.

Describe the relationships depicted in this diagram model. The drawing does not establish that real card games and video games can never overlap.

A two-set Venn diagram not intersecting one another is given. Outside the Venn diagram, it is labeled as 'U equals Investments.' The first set is labeled A equals Stocks while the second set is labeled B equals Bonds.

For the following exercises, create a Venn diagram to represent the relationships between the sets.

All birds have wings.

All cats are animals.

All almonds are nuts, and all pecans are nuts, but no almonds are pecans.

Use the exclusive definition of trapezoid: a quadrilateral with exactly one pair of parallel sides. Under this convention, all rectangles and all trapezoids are quadrilaterals, but no rectangles are trapezoids.

Lizards ⊂ \subset Reptiles.

Ladybugs ⊂ \subset Insects.

Ladybugs ⊂ \subset Insects and Ants ⊂ \subset Insects, but no Ants are Ladybugs.

Lizards ⊂ \subset Reptiles and Snakes ⊂ \subset Reptiles, but no Lizards are Snakes.

A A and B B are disjoint subsets of U . U.

C C and D D are disjoint subsets of U U.

T T is a subset of U U.

S S is a subset of U U.

J = J = Jazz, M = M = Music, and J ⊂ M J \subset M.

R = R = Reggae, M = M = Music, and R ⊂ M R \subset M.

J = J = Jazz, R = R = Reggae, and M = M = Music are sets with the following relationships: J ⊂ M , J \subset M, R ⊂ M , R \subset M, and R R is disjoint from J J.

J = J = Jazz, B = B = Bebop, and M = M = Music are sets with the following relationships: J ⊂ M J \subset M and B ⊂ J B \subset J.

For the following exercises, the universal set is the set of single digit numbers, U = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } U = \{ 0,1,2,3,4,5,6,7,8,9\}. Find the complement of each subset of U U.

A = { 6 , 7 , 8 } A = \{ 6,7,8\}

A = { 0 , 2 , 4 , 6 , 8 } A = \{ 0,2,4,6,8\}

A = {   } A = \{ {\text{ }}\}

A = { 0 , 1 , 4 , 6 , 8 , 9 } A = \{ 0,1,4,6,8,9\}

A = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } A = \{ 0,1,2,3,4,5,6,7,8,9\}

A = { 0 , 1 , 3 , 4 , 5 , 6 , 7 , 9 } A = \{ 0,1,3,4,5,6,7,9\}

A = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } A = \{ 1,2,3,4,5,6,7,8,9\}

A = { 0 , 3 , 6 , 9 } A = \{ 0,3,6,9\}

For the following exercises, the universal set is U = U = {Bashful, Doc, Dopey, Grumpy, Happy, Sleepy, Sneezy}. Find the complement of each subset of U U.

A = A = {Happy, Bashful, Grumpy}

A = A = {Sleepy, Sneezy}

A = A = {Doc}

A = A = {Doc, Dopey}

A = ∅ A = \emptyset

A = A = {Doc, Grumpy, Happy, Sleepy, Bashful, Sneezy, Dopey}

For the following exercises, the universal set is U = N = { 1 , 2 , 3 , … } U = \mathbb{N} = \{ 1,2,3, \ldots \}. Find the complement of each subset of U U.

A = { 1 , 2 , 3 , 4 , 5 } A = \{ 1,2,3,4,5\}

A = { 1 , 3 , 5 , … } A = \{ 1,3,5, \ldots \}

A = { 1 } A = \{ 1\}

A = { 4 , 5 , 6 , … } A = \{ 4,5,6, \ldots \}

For the following exercises, use the Venn diagram to determine the members of the complement of set A ,   A ′ A,{\text{ }}A'.

Venn diagram with universal set U={0,1,2,3,4,5,6,7,8,9}. A circle inside U is labelled A={2,3,4,9}.

Venn diagram with universal set U={0,1,2,3,4,5,6,7,8,9}. A circle inside U is labelled A={1,2,4,8}.

Venn diagram with universal set U={l,i,s,t,e,n}. A circle inside U is labelled A={n,e,t}.

Venn diagram with universal set U={l,i,s,t,e,n}. A circle inside U is labelled A={l,i,n,e,s}.

Corequisite Skills for Introductory Statistics is a custom course edition compiled for Introductory Statistics corequisite courses from OpenStax Contemporary Mathematics, Elementary Algebra 2e, Intermediate Algebra 2e, Prealgebra 2e. Content by OpenStax is reproduced as published, apart from any corrections recorded for this edition. Sections are renumbered to follow the course outline. The course outline is adapted from Larry Green's Support Course for Elementary Statistics (LibreTexts, https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Support_Course_for_Elementary_Statistics), used under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Lessons 2.4 and 6.7 are written for this edition by XYZ Homework. Every OpenStax lesson is abridged to the subsections and practice exercises this course uses. Lessons are headed with their course titles, not the source section titles. Access the complete originals free at openstax.org. License: CC-BY-NC-SA-4.0.

⇩ Download ▾

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or any other accessibility standard. Every page is built against an automated accessibility gate, and our target for the published editions is WCAG 2.2 Level AA. If something is unusable, please tell us.