- Related Questions & Answers
- Binary array after M range toggle operations?
- A data structure for n elements and O(1) operations?
- Execute operations (plus, minus, multiply, divide) while updating a MySQL table?
- Floating Point Operations and Associativity in C, C++ and Java
- Performing mathematical operations in MySQL IF then ELSE is possible?
- Common string operations in Python
- Operations on struct variables in C
- Can we order a MySQL result with mathematical operations?
- Functools — Higher-order functions and operations on callable objects in Python
- Copy - Shallow and deep copy operations in Python
- C++ Program to Perform Operations in a BST
- C++ Program to Perform Dictionary Operations in a Binary Search Tree
- Java 8 Stream Terminal Operations
- Java 8 Streams and its operations
- Math operations for BigDecimal in Java

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Venn diagram, invented in 1880 by John Venn, is a schematic diagram that shows all possible logical relations between different mathematical sets.

**Examples**

Set Operations include Set Union, Set Intersection, Set Difference, Complement of Set, and Cartesian Product.

The union of sets A and B (denoted by A ∪ B) is the set of elements that are in A, in B, or in both A and B. Hence, A ∪ B = { x | x ∈ A OR x ∈ B }.

**Example** − If A = { 10, 11, 12, 13 } and B = { 13, 14, 15 }, then A ∪ B = { 10, 11, 12, 13, 14, 15 }. (The common element occurs only once)

The intersection of sets A and B (denoted by A ∩ B) is the set of elements which are in both A and B. Hence, A ∩ B = { x | x ∈ A AND x ∈ B }.

**Example** − If A = { 11, 12, 13 } and B = { 13, 14, 15 }, then A ∩ B = { 13 }.

The set difference of sets A and B (denoted by A – B) is the set of elements that are only in A but not in B. Hence, A - B = { x | x ∈ A AND x ∉ B }.

**Example** − If A = { 10, 11, 12, 13 } and B = { 13, 14, 15 }, then (A - B) = { 10, 11, 12 } and (B - A) = { 14, 15 }. Here, we can see (A - B) ≠ (B - A)

The complement of a set A (denoted by A’) is the set of elements which are not in set A. Hence, A' = { x | x ∉ A }.

More specifically, A'= (U - A) where ** U** is a universal set that contains all objects.

**Example** − If A = { x | x belongs to set of odd integers } then A' = { y | y does not belong to set of odd integers }

The Cartesian product of n number of sets A_{1}, A_{2}, ... A_{n} denoted as A_{1} × A_{2} ... × A_{n} can be defined as all possible ordered pairs (x_{1}, x_{2}, ... x_{n}) where x_{1} ∈ A_{1}, x_{2} ∈ A_{2}, ... x_{n} ∈ A__{n}

**Example** − If we take two sets A = { a, b } and B = { 1, 2 },

The Cartesian product of A and B is written as − A × B = { (a, 1), (a, 2), (b, 1), (b, 2)}

The Cartesian product of B and A is written as − B × A = { (1, a), (1, b), (2, a), (2, b)}

Advertisements