Day 01 – Discrete mathematics for computer science set operation Union Intersection.
Day 01 – Discrete mathematics for computer science set operation Union Intersection.
Contents [hide]
- 1 Discrete Mathematics for Computer Science – Set Operations (Union & Intersection)
- 2 What is a Set?
- 3 Union of Sets (A ∪ B)
- 4 Intersection of Sets (A ∩ B)
- 5 Venn Diagram Representation
- 6 Properties of Union & Intersection
- 7 Applications of Set Operations in Computer Science
- 8 Database Management (SQL Queries)
- 9 Artificial Intelligence & Machine Learning
- 10 Networking & Cybersecurity
- 11 Searching Algorithms & Data Structures
- 12 Probability & Statistics
- 13 Probability uses Union & Intersection to calculate event occurrences.
- 14 Summary
- 15 Day 01 – Discrete mathematics for computer science set operation Union Intersection.
- 16 DISCRETE MATHEMATICS FOR COMPUTER SCIENCE
- 17 Discrete Mathematics II: Set Theory for …
Discrete Mathematics for Computer Science – Set Operations (Union & Intersection)
Topic: Set Operations – Union & Intersection
Subject: Discrete Mathematics
Useful For: CSE / IT / GATE / Competitive Exams
What is a Set?
A set is a collection of distinct elements. It is usually represented using curly brackets {}
.
Example:
Set A = {1, 2, 3, 4}
Set B = {3, 4, 5, 6}
Union of Sets (A ∪ B)
The Union (A ∪ B) of two sets includes all elements from both sets, without repetition.
Formula:
A∪B={x ∣ x∈A or x∈B}A ∪ B = \{ x \ | \ x \in A \text{ or } x \in B \}
(Union takes all elements from A and B.)
Example:
A = {1, 2, 3, 4}
B = {3, 4, 5, 6}
A ∪ B = {1, 2, 3, 4, 5, 6}
Key Points:
Union combines elements from both sets.
Duplicates are removed.
Intersection of Sets (A ∩ B)
The Intersection (A ∩ B) of two sets includes only the common elements present in both sets.
Formula:
A∩B={x ∣ x∈A and x∈B}A ∩ B = \{ x \ | \ x \in A \text{ and } x \in B \}
(Intersection finds common elements in A and B.)
Example:
A = {1, 2, 3, 4}
B = {3, 4, 5, 6}
A ∩ B = {3, 4}
Key Points:
Intersection only includes elements that exist in both sets.
If no common elements, intersection = Ø (empty set).
Venn Diagram Representation
Union (A ∪ B) – Covers all elements in both sets.
Intersection (A ∩ B) – Covers only the overlapping region of both sets.
Venn Diagram for A ∪ B and A ∩ B:
Union (A ∪ B)
(Everything inside both circles is included)
Intersection (A ∩ B)
(Only overlapping part of both circles is included)
Properties of Union & Intersection
Property | Union ( ∪ ) | Intersection ( ∩ ) |
---|---|---|
Commutative | A ∪ B = B ∪ A | A ∩ B = B ∩ A |
Associative | (A ∪ B) ∪ C = A ∪ (B ∪ C) | (A ∩ B) ∩ C = A ∩ (B ∩ C) |
Identity Element | A ∪ Ø = A | A ∩ U = A |
Idempotent Law | A ∪ A = A | A ∩ A = A |
Distributive | A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) | A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) |
Applications of Set Operations in Computer Science
Database Management (SQL Queries)
UNION operation in SQL retrieves all records from two tables.
INTERSECTION retrieves common records from two tables.
Artificial Intelligence & Machine Learning
Used in classification algorithms to find common or unique data points.
Feature selection in AI models.
Networking & Cybersecurity
Firewalls use set operations to filter allowed & blocked IPs.
Set-based filtering in packet transmission.
Searching Algorithms & Data Structures
Used in hashing & indexing for fast lookup.
Set operations optimize search results.
Probability & Statistics
Probability uses Union & Intersection to calculate event occurrences.
Summary
Union (A ∪ B) → All elements from both sets (Duplicates removed).
Intersection (A ∩ B) → Common elements in both sets.
Used in Databases, AI, Networking, and Algorithms.
Would you like more examples, a Venn diagram, or explanations in Hindi?