Day 48 – Set Operations

Union (A U B)

Given two sets A and B, the union of A and B, AUB, contains all the elements in EITHER A or B.

A\,U\,B\,=\,\{x|x\in\,A\,or\,x\in\,B\}

A union B is equals to x, where x is an element of A or x is an element of B.

Example:

Membership Table

Membership tables show all the combinations of sets an elements can belong to:

  • 1 means the element belongs to the set
  • 0 means it does not belong to the set
ABAUB
000
011
101
111

Intersection

Given two sets A and B, the intersection of A and B, contains all the elements in both A and B.

A\,\cap\,B

Example:

A\,\cap\,B\,=\,\{x|x\,\in\,A\,and\,x\,\in\,B\}

Membership table

ABA∩B
000
010
100
111

Set Difference

Given two sets A and B, the set difference, A-B contains the elements that are in A but not in B.

A\,-\,B\,=\,\{x|x\,\in\,A\,and\,x\,\notin\,B\}

Example:

Membership table:

ABA-B
000
010
101
110

Symmetric difference (A ⊕ B)

Given two sets A and B, the symmetric difference, A B, contains the elements that are in A or in B, but not in both.

A\,\bigoplus\,B\,=\,\{x|(x\,\in\,A\,or \,x\,\in\,B)and\,x\,\notin\,A\,\cap\,B\}\\A\,\bigoplus\,B\,=\,(A\,U\,B)\,-\,(A\,\cap\,B)

X is an element of the symmetric difference of A and B if and only if x is an element of A or an element of B but not an element of the intersection of A and B.

This means that the symmetric difference of A and B is just the union of A and B with all the common element of A and B are removed.

Example:

Membership table:

ABA⊕B
000
011
101
110

Example:

Given Sets

A = {1, 2, 3} and B = {3, 4, 5}

The elements of the union of A and B:

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

The elements of the intersection of A and B:

A\,\cap\,B\,=\{3\}

The elements of the difference of A and B:

A\,-\,B\,=\,\{1,2\}

The elements of the symmetric difference of A and B:

A\,\bigoplus\,B\,=\,\{1,2,4,5\}

Membership table:

ABAUBA∩BA-BA⊕B
00000
0110
1010
1111

Disjoint Sets

Disjoint sets are those sets whose intersection with each other results in a null set. In Set theory, sometimes we notice that there are no common elements in two sets or we can say that the intersection of the sets is an empty set or null set. This type of set is called a disjoint set.

This entry was posted in Study Notes and tagged , , , . Bookmark the permalink.

Leave a Reply