# Operations performed on the set in Discrete Mathematics

In this article, we will learn about the **cardinality of set, some standard notation of set, construction of set and the operations performed on the set in discrete mathematics**.

Submitted by Prerana Jain, on August 12, 2018

**Prerequisite:** Set theory and types of set in Discrete Mathematics

### Cardinality of set

It is the number of elements in a set denoted like, **A= {1, 2, 3, 4}**

|A| = 4 | | symbol of cardinality

### Standard notations of set

There are many notations which are used in the set.

**C**= set of all complex number that can be represented in form of a**+ib**,**a, b**are real number.**R**= set of all real number that is represented along a line.**Q**= set of all rational number that can be expression.**Z**= set of all integer.- Number without fractional components.
**W**= set of all whole number. Set of all positive (integer) and zero.**N**= Non negative number.

### Construction of set

A set can be represented by two methods:

**Tabulation/Roster method**

In the tabulation method, we describe a set by actually writing every number of the set. In this method, we prepare a list of objects forming the set writing the elements one after another between a pair of curly brackets. Thus a set a whose elements are**1, 3, 5,...**will be written as**A = {1, 3, 5, ...}**.**Set builder**

In this, we describe a set by actually writing the member of set the properties based on which reader can understand what is the set.**A = { x: x E Z 0<x<5 }**

### Operations of set

There are many operations which are performed on the set:

**1. Union of set**

For any two set **A** and **B,** the union of **A** and **B** written as **AUB** is the set of all elements which are members of the set **A** or the set **B** or both, Symbolically it is written as: **A U B = { x:x E A or X E B }**

**Example:**

Let, A= {1, 2, 3, 4} B = { 2, 4, 6, 8, 10} Then , A U B = {1, 2, 3, 4, 5, 6, 7, 8, 10}

**2. Intersection of set**

The intersection of two **set A** and **B** denoted **A intersection B** is the set of elements which belongs to both **A** and **B**, it is written as: **A intersection B = { x:x E A and xEB}**

**3. Difference of two set**

The difference of two **sets A and B** in that order is the set of elements which belongs to **A**, but which **O** does not belong to **B**. We denote the difference of **A** and **B** by: **A – B** or **A ~ B**

Which reads as **"A difference B"** or **"A minus B"** symbolically **A - B = {x:x E A and X does not belong to B}**

**A ~ B** is also called the **compliment of B with respect to A**.

**Example:**

let,A = {a, b, c, d, e} B= {f, b, d, g} A – B = {a, c, e} B – a = {f.g} A – B does not equal to B – A.

**4. Complement of set**

If **U** is a universal set containing **A** then **U-A** is called the **complement of A** and is denoted by **A'** or **Ac** thus **A' = U – A = {x:x E U and x does not belongs to U}A' = { x:x does not belong to A}**

**Example:**

let, U = {1, 2, 3, 4, 5, 6, 7, 8, 9} A = {2, 4, 6, 8, 9} then A' = {1, 3, 5, 7}

**5. Symmetric difference**

If **A** and **B** are two sets we define their symmetric difference as the set of all elements that belong to **A** or to **B** but not to both **A** and **B** and we denote it by **(A - B)U(B – A)**.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions