# Crisp set operations – Explained with example

## Crisp set operations

We can perform a wide range of operations on a crisp set. Before you explore the operations of the crisp set, it is recommended to understand what a crisp set is.

**Suggested Reading:** Introduction to Crisp Sets

This article talks on crisp set operations. You can find operations on fuzzy set here. You can also read about fuzzy similarity and dissimilarity measures.

Let us understand various operations on set with the help of examples. We will consider the following data to execute various operations:

X = {1, 2, 3, 4, 5, 6, 7, 8, 9}

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

B = {3, 4, 5, 6}

C = {6, 7, 8, 9}

## Union

Union of sets is the collection of all the elements which are either in A **or** in B. Common elements from both sets are considered only once. Mathematically, we can represent union operation as follow:

A ∪ B = { x | x ∈ A **or** x ∈ B }

For the given data

A ∪ B = {1, 2, 3, 4, 5, 6}

Graphically, we can describe union operation as shown below. The grey region represents the output of the operation.

If there are *n* sets, called A_{1}, A_{2}, A_{3}, …, A_{n}, we can find the union of all by taking **unique elements **from each set, i.e. A = A_{1} ∪ A_{2} ∪ A_{3} ∪ … ∪ A_{n}

In shortened notation,

\[ A = \bigcup_{i=1}^{n} A_i \]

## Intersection

The intersection of sets is the collection of all the common elements from sets A **and **B. Mathematically, we can represent intersection operation as follow:

A ∩ B = { x | x ∈ A **and** x ∈ B }

For the given data

A ∩ B = {3, 4, 5}

Graphically, we can describe intersection operation as shown below. The grey region represents the output of the operation.

If there are *n* sets, called A_{1}, A_{2}, A_{3}, …, A_{n}, we can find the intersection of all by taking **common elements **from each set, i.e. A = A_{1} ∩ A_{2} ∩ A_{3} ∩ … ∩ A_{n}

In shortened notation,

\[ A = \bigcap_{i=1}^{n} A_i \]

## Complement

Complement operation is always represented with respect to some set. If complement is performed with respect to a universal set, then it is called **absolute complement**.

The complement of set A is a collection of all the elements which are **not in** A but are in the universal set.

Mathematically,

A’ = A^{c} = X – A = { x | x ∈ X **and **x ∉ A }

The complement of set A is often represented as A’ or A^{c} or \[ \bar{A} \]. We will be using any notation interchangeably in our discussion.

For the given data

A’ = {6, 7, 8, 9}

Graphically, we can describe the complement operation as shown below. The grey region represents the output of the operation.

## Difference

The difference between set A with respect to set B is the collection of all the elements in A but not in B. It is also known as a **relative complement**.

Here the reference set is not the universal set, rather it is some set derived from the universe of discourse

Mathematically,

A – B = { x | x ∈ A **and** x ∉ B }

For the given data

A – B = {1, 2}

Graphically, difference operation can be represented as,

## De Morgan’s Law

De Morgan’s law is very popular in set operations and it is quite useful in simplifying many complex computations. It is also useful in reducing the process of some proof techniques. De Morgan’s law enjoys a special place in crisp set operations. There are two laws of De Morgan.

**Law 1: ** (A ∪ B)’ = A’ ∩ B’

For the given data:

A ∪ B = {1, 2, 3, 4, 5, 6}

(A ∪ B)’ = {7, 8, 9} → LHS

A’ = {6, 7, 8, 9}

B’ = {1, 2, 7, 8, 9}

A’ ∩ B’ = {7, 8, 9} → RHS

Graphically,

**Law 2: ** (A ∩ B)’ = A’ ∪ B’

For the given data:

A ∩ B={3, 4, 5}

(A ∩ B)’ = {1, 2, 6, 7, 8, 9} → LHS

A’ = {6, 7, 8, 9}

B’ = {1, 2, 7, 8, 9}

A’ ∪ B’ = {1, 2, 6, 7, 8, 9} → RHS

Graphically,

The following video summarizes the various crisp set operations.

## Watch on YouTube: operations on a crisp set

## Disjoint sets:

Two sets A and B are said to be disjoint, if they do not have any common element in them, i.e. A ∩ B = { }. For sets

A = Set of even numbers = {2, 4, 6, 8, …} and

B = Set of odd numbers = {1, 3, 5, 7, …}

A ∩ B = { }, so here A and B are disjoint sets

Graphically, it can be represented as,

## Partition of the set

If we consider the country as a universal set, each state represents one set such that all sets are disjoint and the union of all those sets forms a universal set. Let A_{1}, A_{2}, A_{3}, …, A_{n} represent the n states in the country and set A represents the country.

As per the definition,

\[ \bigcup_{i=1}^{n} A_i = A \]

Each A_{i} is called a partition of set A

Graphically,

## Test Your Knowledge:

Consider the use case of a university, in which a class is having 10 students. University is to offer elective subjects to the students. The instructor got following response from the students:

A represents the enrollment number of students who chose Image Processing

B represents the enrollment number of students who chose Machine Learning

C represents the enrollment number of students who chose Cloud computing

Let,

A = {1, 4, 7, 9}

B = {2, 5, 7, 9}

C = {1, 6, 8, 9}

Perform various crisp set operations and find the elements of the following sets:

x_{1} = {Set of students who either Image Processing or Machine Learning }

x_{2} = {Set of students who do not select Machine Learning }

x_{3} = {Set of students who selected all three subjects }

x_{4} = {Set of students who selected at least any one subject }

x_{5} = {Set of students who did not select any subject }

**Please post your answers / queries / feedback in comment box below !**

Understandable material… !!

Noted with thanks

Comprehensible content and nicely explained

Appreciated your inputs

x1={1,2,4,5}

x1 = {1, 2, 4, 5, 7, 9}. Union includes elements from both the sets.

x2= {1,3,4,6,8,10}

Absolutely correct Smita

X3 = {9}

X4 = {2,4,5,6,8}

X5 = {10}

x3 is right

x4 = {1, 2, 4, 5, 6, 7, 8, 9}: Any one subject indicates union of all three sets

x5 = {3, 10} : These two students does not appear anywhere in any of the list

In the intersection part, the sentence “Mathematically, we can represent union operation as follow”: should be rewritten as “Mathematically, we can represent intersection operation as follow”

Thank you very much for pointing out. Corrected.