Skip to main content
Home
Pimath

Menu EN

  • Home
  • ๐ŸŒ EN
    • ๐Ÿ‡ช๐Ÿ‡ธ ES
    • ๐Ÿ‡ซ๐Ÿ‡ท FR
    • ๐Ÿ‡ฎ๐Ÿ‡น IT
    • ๐Ÿ‡ต๐Ÿ‡น PT
  • About Me
  • ๐Ÿšง Theory & Exercises
User account menu
  • Log in

Breadcrumb

  1. Home

Set Operations: Worked Exercises

Profile picture for user Pimath
By Pimath, 1 May, 2026

Worked exercises on set operations: a progressive collection of 20 exercises designed to teach you how to compute union, intersection, difference and complement correctly. Each exercise is solved step by step, with explanations meant to clarify the logical meaning of every operation.

Let us recall the fundamental definitions:

\[ A \cup B=\{x \mid x \in A \ \text{or} \ x \in B\} \]

\[ A \cap B=\{x \mid x \in A \ \text{and} \ x \in B\} \]

\[ A \setminus B=\{x \mid x \in A \ \text{and} \ x \notin B\} \]

\[ A^c=U \setminus A \]


Exercise 1 โ€” level โ˜…โ˜†โ˜†โ˜†โ˜†

Given the sets

\[ A=\{1,2,3\}, \qquad B=\{3,4,5\} \]

Compute:

\[ A \cup B \]

Answer

\[ A \cup B=\{1,2,3,4,5\} \]

Solution

The required operation is the union. The union \(A \cup B\) contains every element that belongs to at least one of the two sets.

We start with the elements of \(A\):

\[ A=\{1,2,3\} \]

We then add the elements of \(B\):

\[ B=\{3,4,5\} \]

The element \(3\) appears in both \(A\) and \(B\), but in a set the elements are not repeated. For this reason, we list it only once.

Therefore:

\[ A \cup B=\{1,2,3,4,5\} \]

Exercise 2 โ€” level โ˜…โ˜†โ˜†โ˜†โ˜†

Given the sets

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\} \]

Compute:

\[ A \cap B \]

Answer

\[ A \cap B=\{3,4\} \]

Solution

The required operation is the intersection. The intersection \(A \cap B\) contains only those elements that belong to \(A\) and \(B\) at the same time.

Let us look at the elements of \(A\):

\[ A=\{1,2,3,4\} \]

and the elements of \(B\):

\[ B=\{3,4,5,6\} \]

The elements \(1\) and \(2\) belong only to \(A\), so they are not part of the intersection. The elements \(5\) and \(6\) belong only to \(B\), so they are not part of the intersection either.

The only elements present in both sets are \(3\) and \(4\). Hence:

\[ A \cap B=\{3,4\} \]

Exercise 3 โ€” level โ˜…โ˜†โ˜†โ˜†โ˜†

Given the sets

\[ A=\{1,2,3,4,5\}, \qquad B=\{2,4,6\} \]

Compute:

\[ A \setminus B \]

Answer

\[ A \setminus B=\{1,3,5\} \]

Solution

The required operation is the set difference. The difference \(A \setminus B\) contains the elements that belong to \(A\) but do not belong to \(B\).

We start from \(A\):

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

We must remove from \(A\) every element that also lies in \(B\). Since:

\[ B=\{2,4,6\} \]

the elements of \(A\) that also appear in \(B\) are \(2\) and \(4\).

Removing \(2\) and \(4\) from \(A\), the elements left are:

\[ 1,3,5 \]

Therefore:

\[ A \setminus B=\{1,3,5\} \]

Exercise 4 โ€” level โ˜…โ˜†โ˜†โ˜†โ˜†

Given the sets

\[ A=\{a,b,c,d\}, \qquad B=\{b,d,e\} \]

Compute:

\[ B \setminus A \]

Answer

\[ B \setminus A=\{e\} \]

Solution

The difference \(B \setminus A\) contains the elements that belong to \(B\) but do not belong to \(A\).

This time, the starting set is \(B\), not \(A\). Indeed:

\[ B=\{b,d,e\} \]

We must remove from \(B\) the elements that also belong to \(A\). Since:

\[ A=\{a,b,c,d\} \]

the elements \(b\) and \(d\) lie in both \(B\) and \(A\), and so they must be excluded.

The only element of \(B\) that does not belong to \(A\) is \(e\). Therefore:

\[ B \setminus A=\{e\} \]

Exercise 5 โ€” level โ˜…โ˜…โ˜†โ˜†โ˜†

Let

\[ U=\{1,2,3,4,5,6,7,8\} \]

and let

\[ A=\{2,4,6,8\} \]

Compute:

\[ A^c \]

Answer

\[ A^c=\{1,3,5,7\} \]

Solution

The required operation is the complement of \(A\) with respect to the universal set \(U\).

The complement \(A^c\) contains every element of the universe \(U\) that does not belong to \(A\). In symbols:

\[ A^c=U \setminus A \]

The universal set is:

\[ U=\{1,2,3,4,5,6,7,8\} \]

The set \(A\) is:

\[ A=\{2,4,6,8\} \]

We must therefore remove from \(U\) the elements \(2,4,6,8\). What remains are the odd elements:

\[ 1,3,5,7 \]

Therefore:

\[ A^c=\{1,3,5,7\} \]

Exercise 6 โ€” level โ˜…โ˜…โ˜†โ˜†โ˜†

Given the sets

\[ A=\{x \in \mathbb{N} \mid 1 \le x \le 6\} \]

and

\[ B=\{2,4,6,8\} \]

Compute:

\[ A \cap B \]

Answer

\[ A \cap B=\{2,4,6\} \]

Solution

Before performing the operation, it is convenient to write the set \(A\) explicitly. Note that \(A\) is given in set-builder notation.

The expression

\[ A=\{x \in \mathbb{N} \mid 1 \le x \le 6\} \]

reads: ยซ\(A\) is the set of natural numbers \(x\) such that \(x\) lies between \(1\) and \(6\), endpoints includedยป. Listing the elements one by one we obtain:

\[ A=\{1,2,3,4,5,6\} \]

The set \(B\), on the other hand, is given in roster notation:

\[ B=\{2,4,6,8\} \]

We must compute the intersection \(A \cap B\), that is, the set of elements that belong to both \(A\) and \(B\).

Let us check the elements one by one:

- \(2 \in A\) and \(2 \in B\): it belongs to the intersection;

- \(4 \in A\) and \(4 \in B\): it belongs to the intersection;

- \(6 \in A\) and \(6 \in B\): it belongs to the intersection;

- \(8 \in B\), but \(8 \notin A\) since \(8 > 6\): it does not belong to the intersection.

Therefore:

\[ A \cap B=\{2,4,6\} \]

Exercise 7 โ€” level โ˜…โ˜…โ˜†โ˜†โ˜†

Given the sets

\[ A=\{1,3,5,7\}, \qquad B=\{2,3,5,8\} \]

Compute:

\[ A \cup B \]

Answer

\[ A \cup B=\{1,2,3,5,7,8\} \]

Solution

The required operation is the union of \(A\) and \(B\). The union contains every element that belongs to at least one of the two sets.

We start with the elements of \(A\):

\[ A=\{1,3,5,7\} \]

We now look at the elements of \(B\):

\[ B=\{2,3,5,8\} \]

The elements \(3\) and \(5\) are already present in \(A\), so they must not be repeated. The new elements contributed by \(B\) are \(2\) and \(8\).

Collecting all elements without repetition, we obtain:

\[ A \cup B=\{1,2,3,5,7,8\} \]

Exercise 8 โ€” level โ˜…โ˜…โ˜†โ˜†โ˜†

Given the sets

\[ A=\{1,2,3,4,5\}, \qquad B=\{4,5,6,7\} \]

Compute:

\[ (A \cup B) \setminus A \]

Answer

\[ (A \cup B) \setminus A=\{6,7\} \]

Solution

The expression contains two operations. We must respect the parentheses and compute first:

\[ A \cup B \]

The union of \(A\) and \(B\) contains every element present in at least one of the two sets:

\[ A \cup B=\{1,2,3,4,5,6,7\} \]

We must now compute:

\[ (A \cup B) \setminus A \]

This means that we start from the set \(A \cup B\) and remove every element that belongs to \(A\).

Since:

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

removing \(1,2,3,4,5\) from the set \(\{1,2,3,4,5,6,7\}\) leaves:

\[ 6,7 \]

Therefore:

\[ (A \cup B) \setminus A=\{6,7\} \]

Exercise 9 โ€” level โ˜…โ˜…โ˜…โ˜†โ˜†

Given the sets

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\} \]

Compute:

\[ (A \cap B) \cup \{7\} \]

Answer

\[ (A \cap B) \cup \{7\}=\{3,4,7\} \]

Solution

Once again, we must first compute what is inside the parentheses:

\[ A \cap B \]

The intersection contains the elements common to \(A\) and \(B\). Since:

\[ A=\{1,2,3,4\} \]

and

\[ B=\{3,4,5,6\} \]

the common elements are \(3\) and \(4\). Hence:

\[ A \cap B=\{3,4\} \]

We now take the union of this set with \(\{7\}\):

\[ (A \cap B) \cup \{7\}=\{3,4\} \cup \{7\} \]

The union adds the element \(7\), which was not already present.

Therefore:

\[ (A \cap B) \cup \{7\}=\{3,4,7\} \]

Exercise 10 โ€” level โ˜…โ˜…โ˜…โ˜†โ˜†

Given the sets

\[ A=\{1,2,3,4,5,6\}, \qquad B=\{2,4,6\} \]

Compute:

\[ A \setminus B \]

Answer

\[ A \setminus B=\{1,3,5\} \]

Solution

We must compute the difference \(A \setminus B\). This means that we keep only the elements of \(A\) that do not belong to \(B\).

The set \(A\) is:

\[ A=\{1,2,3,4,5,6\} \]

The set \(B\) is:

\[ B=\{2,4,6\} \]

The elements \(2,4,6\) belong to \(A\), but they also belong to \(B\). For this reason they have to be excluded from the difference.

The elements of \(A\) that do not belong to \(B\) are, instead, \(1,3,5\).

Therefore:

\[ A \setminus B=\{1,3,5\} \]

Exercise 11 โ€” level โ˜…โ˜…โ˜…โ˜†โ˜†

Let

\[ U=\{1,2,3,4,5,6,7,8,9,10\} \]

and let

\[ A=\{1,2,3,4,5\}, \qquad B=\{4,5,6,7\} \]

Compute:

\[ (A \cup B)^c \]

Answer

\[ (A \cup B)^c=\{8,9,10\} \]

Solution

The expression requires us to compute first the union \(A \cup B\) and then the complement of the result with respect to \(U\).

Let us compute the union:

\[ A \cup B=\{1,2,3,4,5,6,7\} \]

We now have to find the complement of \(A \cup B\), that is, every element of \(U\) that does not belong to the union.

The universal set is:

\[ U=\{1,2,3,4,5,6,7,8,9,10\} \]

The union \(A \cup B\) contains:

\[ 1,2,3,4,5,6,7 \]

The elements of the universe that are left outside the union are:

\[ 8,9,10 \]

Therefore:

\[ (A \cup B)^c=\{8,9,10\} \]

Exercise 12 โ€” level โ˜…โ˜…โ˜…โ˜†โ˜†

Let

\[ U=\{1,2,3,4,5,6,7,8\} \]

and let

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\} \]

Compute:

\[ A^c \cap B^c \]

Answer

\[ A^c \cap B^c=\{7,8\} \]

Solution

We must compute the intersection of the complements of \(A\) and \(B\). Let us proceed in order.

The complement of \(A\) consists of the elements of \(U\) that do not belong to \(A\):

\[ A^c=U \setminus A \]

Since:

\[ A=\{1,2,3,4\} \]

we get:

\[ A^c=\{5,6,7,8\} \]

Likewise:

\[ B^c=U \setminus B \]

Since:

\[ B=\{3,4,5,6\} \]

we get:

\[ B^c=\{1,2,7,8\} \]

Now we compute the intersection:

\[ A^c \cap B^c=\{5,6,7,8\} \cap \{1,2,7,8\} \]

The elements common to the two complements are \(7\) and \(8\). Therefore:

\[ A^c \cap B^c=\{7,8\} \]

Exercise 13 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜†

Let

\[ U=\{1,2,3,4,5,6,7,8\} \]

and let

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\} \]

verify that:

\[ (A \cup B)^c=A^c \cap B^c \]

Answer

\[ (A \cup B)^c=A^c \cap B^c=\{7,8\} \]

Solution

To verify the identity, we compute the left-hand side and the right-hand side separately.

Let us start with the left-hand side:

\[ (A \cup B)^c \]

We compute the union first:

\[ A \cup B=\{1,2,3,4,5,6\} \]

Now we take the complement with respect to \(U\):

\[ (A \cup B)^c=U \setminus (A \cup B) \]

and so:

\[ (A \cup B)^c=\{7,8\} \]

We now compute the right-hand side:

\[ A^c \cap B^c \]

The complement of \(A\) is:

\[ A^c=\{5,6,7,8\} \]

The complement of \(B\) is:

\[ B^c=\{1,2,7,8\} \]

We intersect the two complements:

\[ A^c \cap B^c=\{5,6,7,8\} \cap \{1,2,7,8\} \]

The common elements are \(7\) and \(8\). Therefore:

\[ A^c \cap B^c=\{7,8\} \]

The two sides yield the same set:

\[ (A \cup B)^c=A^c \cap B^c=\{7,8\} \]

The identity is verified. This is De Morgan's first law.

Exercise 14 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜†

Let

\[ U=\{1,2,3,4,5,6,7,8\} \]

and let

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\} \]

verify that:

\[ (A \cap B)^c=A^c \cup B^c \]

Answer

\[ (A \cap B)^c=A^c \cup B^c=\{1,2,5,6,7,8\} \]

Solution

Once again we compare the left-hand side and the right-hand side.

We compute the left-hand side first:

\[ (A \cap B)^c \]

The intersection of \(A\) and \(B\) contains the common elements:

\[ A \cap B=\{3,4\} \]

The complement of \(A \cap B\) contains every element of \(U\) different from \(3\) and \(4\):

\[ (A \cap B)^c=\{1,2,5,6,7,8\} \]

We now compute the right-hand side:

\[ A^c \cup B^c \]

We have:

\[ A^c=\{5,6,7,8\} \]

and:

\[ B^c=\{1,2,7,8\} \]

Taking the union of the two complements we get:

\[ A^c \cup B^c=\{5,6,7,8\} \cup \{1,2,7,8\} \]

and so:

\[ A^c \cup B^c=\{1,2,5,6,7,8\} \]

The two sides agree:

\[ (A \cap B)^c=A^c \cup B^c \]

The identity is verified. This is De Morgan's second law.

Exercise 15 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜†

Given the sets

\[ A=\{1,2,3,4,5\}, \qquad B=\{4,5,6,7\} \]

Compute:

\[ (A \setminus B) \cup (B \setminus A) \]

Answer

\[ (A \setminus B) \cup (B \setminus A)=\{1,2,3,6,7\} \]

Solution

The expression is built from two differences and then a union.

We compute first:

\[ A \setminus B \]

This difference contains the elements of \(A\) that do not belong to \(B\). Since \(4\) and \(5\) also belong to \(B\), they have to be excluded.

Hence:

\[ A \setminus B=\{1,2,3\} \]

We now compute:

\[ B \setminus A \]

This difference contains the elements of \(B\) that do not belong to \(A\). The elements \(4\) and \(5\) lie also in \(A\), and so they are excluded.

What remains is:

\[ B \setminus A=\{6,7\} \]

Finally we take the union:

\[ (A \setminus B) \cup (B \setminus A)=\{1,2,3\} \cup \{6,7\} \]

Therefore:

\[ (A \setminus B) \cup (B \setminus A)=\{1,2,3,6,7\} \]

This set contains the elements that belong to exactly one of the two sets, but not to both. It is known as the symmetric difference.

Exercise 16 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜†

Given the sets

\[ A=\{1,2,3,4,5,6\}, \qquad B=\{2,4,6\}, \qquad C=\{1,2,7\} \]

Compute:

\[ (A \cap B) \cup C \]

Answer

\[ (A \cap B) \cup C=\{1,2,4,6,7\} \]

Solution

The expression contains first an intersection and then a union. We start with the parenthesis:

\[ A \cap B \]

The intersection contains the elements common to \(A\) and \(B\). Note that:

\[ B=\{2,4,6\} \]

and every one of these elements also belongs to \(A\), since:

\[ A=\{1,2,3,4,5,6\} \]

Hence:

\[ A \cap B=\{2,4,6\} \]

We now take the union of this result with \(C\):

\[ (A \cap B) \cup C=\{2,4,6\} \cup \{1,2,7\} \]

In a union, we list every element without repetition. The element \(2\) appears in both sets, so it is written only once.

We obtain:

\[ (A \cap B) \cup C=\{1,2,4,6,7\} \]

Exercise 17 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜…

Let

\[ U=\{1,2,3,4,5,6,7,8,9\} \]

and let

\[ A=\{1,2,3,4,5\}, \qquad B=\{4,5,6,7\} \]

compute:

\[ (A \cap B)^c \cap A \]

Answer

\[ (A \cap B)^c \cap A=\{1,2,3\} \]

Solution

We have to compute a compound expression. Let us proceed by respecting the order of operations.

We compute first:

\[ A \cap B \]

The elements common to \(A\) and \(B\) are \(4\) and \(5\). Hence:

\[ A \cap B=\{4,5\} \]

We now compute the complement of this set with respect to \(U\):

\[ (A \cap B)^c=U \setminus \{4,5\} \]

Since:

\[ U=\{1,2,3,4,5,6,7,8,9\} \]

removing \(4\) and \(5\) we get:

\[ (A \cap B)^c=\{1,2,3,6,7,8,9\} \]

Lastly, we have to intersect this set with \(A\):

\[ (A \cap B)^c \cap A=\{1,2,3,6,7,8,9\} \cap \{1,2,3,4,5\} \]

The common elements are \(1,2,3\).

Hence:

\[ (A \cap B)^c \cap A=\{1,2,3\} \]

Note that the result coincides with the elements of \(A\) that do not also belong to \(B\).

Exercise 18 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜…

Let

\[ U=\{1,2,3,4,5,6,7,8,9,10\} \]

and let

\[ A=\{1,2,3,4,5\}, \qquad B=\{3,4,5,6,7\} \]

Compute:

\[ (A^c \cup B^c)^c \]

Answer

\[ (A^c \cup B^c)^c=\{3,4,5\} \]

Solution

The expression contains complements, a union and then another complement. Let us proceed in order.

We compute first the complement of \(A\):

\[ A^c=U \setminus A \]

Since:

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

we get:

\[ A^c=\{6,7,8,9,10\} \]

We now compute the complement of \(B\):

\[ B^c=U \setminus B \]

Since:

\[ B=\{3,4,5,6,7\} \]

we get:

\[ B^c=\{1,2,8,9,10\} \]

Now we take the union of the two complements:

\[ A^c \cup B^c=\{6,7,8,9,10\} \cup \{1,2,8,9,10\} \]

and so:

\[ A^c \cup B^c=\{1,2,6,7,8,9,10\} \]

Lastly, we compute the complement of this set:

\[ (A^c \cup B^c)^c=U \setminus \{1,2,6,7,8,9,10\} \]

The elements of \(U\) that do not appear in \(\{1,2,6,7,8,9,10\}\) are:

\[ 3,4,5 \]

Therefore:

\[ (A^c \cup B^c)^c=\{3,4,5\} \]

The result coincides with \(A \cap B\), as predicted by De Morgan's law.

Exercise 19 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜…

Given the sets

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\}, \qquad C=\{4,6,8\} \]

Compute:

\[ (A \cup B) \cap C \]

Answer

\[ (A \cup B) \cap C=\{4,6\} \]

Solution

The expression requires us to compute first the union of \(A\) and \(B\), and then the intersection with \(C\).

We compute the union:

\[ A \cup B=\{1,2,3,4\} \cup \{3,4,5,6\} \]

In the union we list every element present in at least one of the two sets, with no repetitions:

\[ A \cup B=\{1,2,3,4,5,6\} \]

We now have to compute:

\[ (A \cup B) \cap C \]

that is:

\[ \{1,2,3,4,5,6\} \cap \{4,6,8\} \]

The intersection contains only the elements common to the two sets. The common elements are \(4\) and \(6\).

The element \(8\) belongs to \(C\), but does not belong to \(A \cup B\), so it is not included.

Therefore:

\[ (A \cup B) \cap C=\{4,6\} \]

Exercise 20 โ€” level โ˜…โ˜…โ˜…โ˜…โ˜…

Let \(A\) and \(B\) be any two sets. Prove the absorption law:

\[ A \cup (A \cap B)=A \]

Answer

\[ A \cup (A \cap B)=A \]

Solution

We want to prove that:

\[ A \cup (A \cap B)=A \]

Consider the set:

\[ A \cap B \]

By definition, \(A \cap B\) contains the elements that belong to both \(A\) and \(B\).

In particular, every element of \(A \cap B\) certainly belongs to \(A\). Therefore \(A \cap B\) is contained in \(A\):

\[ A \cap B \subseteq A \]

Now consider the union:

\[ A \cup (A \cap B) \]

We are taking the union of \(A\) with a set that is already contained in \(A\). Adding to \(A\) elements that are already in \(A\) does not change the set.

Hence:

\[ A \cup (A \cap B)=A \]

This property is called the absorption law.


Your feedback is important to us! Leave a comment and help us improve this content. Thank you!

Feedback

Support us by liking the page:
Or, share:

Tags

  • Algebra

Support us by liking the page:
Or, share:

Copyright ยฉ 2026 | Pimath | All Rights Reserved