You are on page 1of 3

Chapter 0.

Prerequisites
0.2: Set Operations
(From “Probability & Statistics with Applications to Computing” by Alex Tsun)

0.2.1 Set Operations

Definition 0.2.1: Universal Set


Let A, B be sets and U be a universal set, so that A ⊆ U and B ⊆ U. The universal set contains
all elements we would ever care about.

Example(s)

1. If we were talking about the set of fruits a supermarket might sell S, we might have S =
{apple, watermelon, pear, strawberry} and U = {all fruits}. We might want to know which
fruits the supermarket doesn’t sell, which would be denoted S C (defined later). This requires a
universal set of all fruits that we can check with to see which are missing from S.
2. If we were talking about the set of kinds of cars Bill Gates owns, that might be the set T . There
must be a universal set U of possible kinds of cars that exist, if we wanted to list out which
ones he was missing T C .

Definition 0.2.2: Set Operation: Union

The union of A and B is denoted A∪B. It contains elements in A or B, or both (without duplicates).
So x ∈ A ∪ B if and only if x ∈ A or x ∈ B.

The image below shows in red the union of A and B: A ∪ B. The outer rectangle is the univeral set U.

1
2 Probability & Statistics with Applications to Computing 0.2

Definition 0.2.3: Set Operation: Intersection

The intersection of A and B is denoted A ∩ B. It contains elements in A and B. So x ∈ A ∩ B if


and only if x ∈ A and x ∈ B.

The image below shows in red the intersection of A and B: A ∩ B. The outer rectangle is the univeral set U.

Definition 0.2.4: Set Operation: Set Difference

The set difference of A with B is denoted, A \ B. It contains elements of A which are not in B. So
x ∈ A \ B if and only if x ∈ A and x ∈
/ B.

The image below shows in red the set different of A with B: A \ B. The outer rectangle is the univeral set
U.
0.2 Probability & Statistics with Applications to Computing 3

Definition 0.2.5: Set Operation: Complement

The complement of A (with respect to U) is denoted AC = U \ A. It contains elements of U, the


universal set, which are not in A.

The image below shows in red the complement of A with respect to U: AC = U \ A.

Example(s)

Let A = {1, 3}, B = {2, 3, 4}, and U = {1, 2, 3, 4, 5}. Solve for: A ∩ B, A ∪ B, B \ A, A \ B, (A ∪ B)C ,
AC , B C , and AC ∩ B C .

Solution

• A ∩ B = {3}, since 3 is the only element in both A and B.

• A ∪ B = {1, 2, 3, 4}, as these are all the elements in either A or B. Note we dropped the duplicate 3,
since sets cannot contain duplicates.
• B \ A = {2, 4}, as these are the elements of B which are not in A.
• A \ B = {1}, as this is the only element of A which is not an element of B.

• (A ∪ B)C = {5}, as by definition (A ∪ B)C = U \ (A ∪ B) and 5 is the only element of U which is not
an element of A ∪ B.
• AC = {2, 4, 5}, as by definition AC = U \ A, and these are the elements of U which are not elements
of A.

• B C = {1, 5}, as by definition B C = U \ B, and these are the elements of U which are not elements of
B.
• AC ∩ B C = {5}, because the only element in both AC and B C is 5 (see the above).

You might also like