Learn

Let’s dive into some key concepts we will use throughout this lesson: union, intersection, and complement.

Union

The union of two sets encompasses any element that exists in either one or both of them. We can represent this visually as a Venn diagram.

A Venn diagram that shows two overlapping circles, one that represents event A and one that represents event B. Both of these circles are shaded blue.

For example, let’s say we have two sets, A and B. A represents rolling an odd number with a six-sided die (the set {1, 3, 5}). B represents rolling a number greater than two (the set {3, 4, 5, 6}). The union of these two sets would be everything in either set A, set B, or both: {1, 3, 4, 5, 6}. We can write the union of two events mathematically as (A or B).

Intersection

The intersection of two sets encompasses any element that exists in both of the sets. Visually:

A Venn diagram that shows two overlapping circles, one that represents event A and one that represents event B. Only the overlap of the two circles is shaded.

The intersection of the above sets (A represents rolling an odd number on a six-sided die and B represents rolling a number greater than two) includes any value that appears in both sets: {3, 5}. We can write the intersection of two events mathematically as (A and B).

Complement

Lastly, the complement of a set consists of all possible outcomes outside of the set. Visually:

A Venn diagram that shows a circle representing event A. Everything outside of event A is shaded blue.

Consider set A from the above example (rolling an odd number on a 6-sided die). The complement of this set would be rolling an even number: {2, 4, 6}. We can write the complement of set A as AC. One key feature of complements is that a set and its complement cover the entire sample space. In this die roll example, the set of even numbers and odd numbers would cover all possible rolls: {1, 2, 3, 4, 5, 6}.

Instructions

To the right is an applet that shows two overlapping circles: A and B. The two dropdown menus allow you to choose from different events. Event A can be any of the following:

  • The outcome of a die roll is even
  • The outcome of a die roll is a five
  • The outcome of a die roll is less than or equal to three

Event B can be any of the following:

  • The outcome of a die roll is odd
  • The outcome of a die roll is anything but five
  • The outcome of a die roll is greater than or equal to two

Using the applet, find the intersection and union between the following two events:

  • The outcome of a die roll is less than or equal to three
  • The outcome of a die roll is anything but five

Using the applet, find the complement of the following events:

  • The outcome of a die roll is greater than or equal to two
  • The outcome of a die roll is five

Feel free to play around with it more!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?