Sets and Set Theory

Set operations

Updated Oct 19, 2026

Set Union (A U B)

Contains all elements in EITHER A or B.

A U B={x∣x∈A or x∈B}A\ U\ B = \{ x|x \in A\ or\ x\in B \}

Example:

Intersection (A ∩\cap B)

Contains all the elements in BOTH A and B.

A ∩B={x∣x∈A and x ∈B}A\ \cap B = \{ x|x \in A\ and\ x\ \in B \}

Set difference (A - B)

Contains the elements that are in A but not in B.

A − B ={x∣x∈A and x∉B}A\ -\ B\ = \{ x|x \in A\ and\ x \notin B \}

Symmetric difference (A (+) B)

Contains the elements that are in A or in B but not in both.

A (+) B ={x ∣ (x∈A OR x∈B) and x ∉A ∩B}A\ (+)\ B\ = \{ x\ |\ (x \in A\ OR\ x \in B)\ and\ x\ \notin A\ \cap B \}

A(+)B=(A∪B)−(A∩B)A (+) B = (A \cup B) - (A \cap B)

Example exercise

Given two sets A = {1, 2, 3} and B = {3, 4, 5}:

  • Union: { 1, 2, 3, 4, 5}

  • Intersection: {3}

  • Difference: { 1, 2}

  • Symmetric difference: {1, 2, 4, 5}