Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
Cardinality of a Set
Next article icon

Cardinality of a Set

Last Updated : 29 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Cardinality is an important concept in set theory and mathematics due to its general applications and importance across various occupations. Thus, the cardinality of a set is the number of elements in it along with examples. Cardinality is important in every field such as cryptocurrency, markets, etc.

For example, the set {1, 2, 3, 4, 5} has a cardinality of 5. 

In this article, we will know what the cardinality of a set is. Cardinality refers to the number that is obtained after counting something. 

What is Set?

Set is a collection of distinct objects, considered as a whole. These objects are called the elements or members of the set.

For example, the set of natural numbers less than 5 can be written as {1, 2, 3, 4}.

Cardinality of a Set

The number of elements in the set or a measure of its size is known as the cardinality of a set. It can be finite or infinite.

For example, the set A = {1, 2, 4} has a cardinality of 3 because it has three elements.

Cardinality of any set A is denoted by: |A| or card(A)

Examples of Cardinality of a Set

Some other examples includes:

  • If A = {a, b, c, d, e}, then n(A) (or) |A| = 5
  • If P = {Sun, Mon, Tue, Wed, Thu, Fri, Sat}, then n(P) (or) |P| = 7

Cardinality of Different Sets

Some of the common sets with cardinality are:

  • Cardinality of a Power Set
  • Cardinality of a Finite Set
  • Cardinality of a Infinite Set
  • Cardinality of Cartesian Products

Cardinality of a Finite Set

Cardinality of a finite set refers to the number of elements in the set. If a set S is finite, its cardinality is simply the count of distinct elements within the set.

The total numbers are in the set is known as the cardinality of a power set.

For example: If A = {1, 2, 3, 4, 5}, then |A| = 5.

Cardinality of Infinite Set

A set is countably infinite if its elements can be put into a one-to-one correspondence with the natural numbers N = {1, 2, 3, . . . }. This means that you can list the elements of the set in a sequence (even if the sequence goes on forever).

The cardinality of a countably infinite set is denoted by ℵ0.

Examples:

  • Natural Numbers: The set of natural numbers N={1, 2, 3, . . .} is countably infinite.
  • Integers: The set of integers Z={. . . ,−2, −1, 0, 1, 2, . . . } is countably infinite because you can list them in a sequence like 0, 1, −1, 2, −2, . . .
  • Rational Numbers: The set of rational numbers Q = {a/b ∣ a,b ∈ Z, b ≠ 0} is countably infinite, though it's less obvious. The rationals can be arranged in a sequence by arranging fractions by their sum of numerator and denominator.

Cardinality of a Power Set

Power Set of a set S is the set of all possible subsets of S, including the empty set and S itself.

If a set A has n elements, then the cardinality of its power set is equal to 2n which is the number of subsets of the set A.

If a set S has n elements, the power set P(S) will have 2n elements. This is because each element in S can either be included in or excluded from a subset, leading to 2n possible subsets.

For any finite set S with n elements: ∣P(S)∣ = 2n

Consider the set S = {a, b}.

  • Subsets of S are:
    • {} (the empty set)
    • {a}
    • {b}
    • {a, b}
  • The power set P(S) is {{}, {a}, {b}, {a, b}}

Since S has 2 elements, the cardinality of the power set P(S) is 22 = 4.

Cardinality of Cartesian Products

The Cartesian product of two sets A and B, denoted by A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B.

Finite Set Example: If A = {1, 2} and B = {x, y, z}, then A × B = {(1, x), (1, y), (1, z), (2, x), (2, y), (2, z)}, so ∣A × B∣ = 6.

General Formula: If ∣A∣=m and ∣B∣ = n, then ∣A × B∣ = m × n.

Formulas Related to Cardinality

  • If A and B are two disjoint sets, then n(A U B) = n(A) + n (B).
  • For any two sets A and B, n (A U B) = n(A) + n (B) - n (A ∩ B). This is popularly known as the "inclusion-exclusion principle".
  • For any three sets A, B, and C, n(A U B U C) = n (A) + n(B) + n(C) - n(A ∩ B) - n(B ∩ C) - n(C ∩ A) + n (A ∩ B ∩ C).
  • The relation of sets having the same cardinality is an equivalence relation.
  • A set A is countable if it is either finite or there is a bijection from A to N.
  • A set is uncountable if it is not countable.
  • The sets N, Z, and Q are countable.
  • The set R is uncountable.
  • Any subset of a countable set is countable.
  • Any superset of an uncountable set is uncountable.
  • If A and B are countable then their cartesian product A X B is also countable.

Application

Some of the common application of cardinality are:

  • Cardinality is used in database management to optimize queries by determining the number of unique records in a dataset.
  • Cardinality is used in designing and optimizing databases.
  • Cardinality is used to compare the size of input sets and the complexity of algorithms.
  • Cardinality plays a crucial role in cryptography, especially in the design of cryptographic keys.

Solved Questions: Cardinality of a Set

Q1: Let A={1, 2, 3, 4, 5}. What is the cardinality of set A?

Solution:

The cardinality of set A is the number of elements in the set, i.e., ∣A∣=5

Q2: Given two sets B = {a, b, c} and C = {d, e, f, g}, What is the cardinality of the union B∪C?

Solution:

B∪C = {a, b, c, d, e, f, g}

The cardinality of B∪C is i.e., ∣B∪C∣ = 7

Q3: Let D = {2, 4, 6} and E = {1, 2, 3, 4, 5, 6}. Find the cardinality of D∩E.

Solution:

D∩E = {2, 4, 6}

The cardinality of D∩E is:

∣D∩E∣=3

Q4: Consider the set F = {x ∣ x is an integer and −3 ≤ x ≤ 3}. What is the cardinality of set F?

Solution:

F = {−3, −2, −1, 0, 1, 2, 3}

The cardinality of F is ∣F∣ = 7

Q5: Let G = {Monday, Tuesday, Wednesday,  Thursday, Friday, Saturday, Sunday}. Find the cardinality of set G.

Solution:

The cardinality of set G is:

∣G∣=7

Q6: Suppose H = {} is an empty set. What is the cardinality of set H?

Solution:

The cardinality of the empty set is always zero i.e., ∣H∣=0

Practice Problems: Cardinality of a Set

Problem: For each Q below, determine the cardinality of the given set.

Q 1: I = {10, 20, 30, 40}.

Q 2: J={a, b, c, d, e}.

Q 3: K={x ∣ x is an even number between 1 and 10}.

Q 4: L={z ∣ z is a vowel in the English alphabet}.

Q 5: M={n ∣ n is a prime number less than 10}.

Q 6: N={r, s, t, u, v, w, x, y, z}.

Q 7: O={p ∣ p is a positive integer less than 4}.

Q 8: P = {}.

Q 9: Q={1, 1, 2, 2, 3, 3}.

Q 10: R = {y ∣ y is an integer and −2 ≤ y ≤ 2}.

Answer key

1: ∣I∣=4

2: ∣J∣=5

3: ∣K∣=4

4: ∣L∣=5

5: ∣M∣=4 (Prime numbers less than 10 are 2, 3, 5, 7)

6: ∣N∣=9

7: ∣O∣=3 (Positive integers less than 4 are 1, 2, 3)

8: ∣P∣=0 (Empty set)

9: ∣Q∣=3 (Unique elements are 1, 2, 3)

10: ∣R∣=5 (Set includes integers -2, -1, 0, 1, 2)

Read More,

  • What is Set Theory?
  • Set Theory Formulas
  • Set Operations
  • De Morgan’s Law

Conclusion

Cardinality is a fundamental idea in set theory, illustrating the size of a set, i.e., the number of elements it contains. It is useful in various fields, such as mathematics, computer science, and even real-life systems like grouping or categorizing items. Understanding how to compute the cardinality of a set allows for more useful data management, resource funding, and decision-making procedures, making it a useful tool in both academic and used contexts.


Next Article
Cardinality of a Set

A

ashishtiwa2irm
Improve
Article Tags :
  • Mathematics
  • School Learning
  • Set Theory

Similar Reads

    Cardinality in DBMS
    In database management, cardinality represents the number of times an entity of an entity set participates in a relationship set. Or we can say that the cardinality of a relationship is the number of tuples (rows) in a relationship. It is a fundamental concept that helps define how data in different
    4 min read
    Complement of a Set
    In mathematics, a set is a collection or grouping of well-defined objects. All such objects, when grouped in a set, are called elements. Sets are represented by capital letter symbols, and the elements are placed together in a curly bracket {}.For example, if W is the set of whole numbers, then W =
    10 min read
    Cantor Set
    Cantor set is a basic notion in mathematics that plays an extremely important role in mathematical areas such as set theory and topology. It was first developed by the German mathematician Catarus at the end of the 19th century. Cantor Set exemplifies most intriguingly how seemingly straightforward
    13 min read
    Equal Sets: Definition, Cardinality, and Venn Diagram
    In mathematics, a set is a collection of well-defined and distinct objects. These objects are called the elements of the set. The elements of a set can be listed in any order, but repetition is not allowed. Sets are typically represented by capital letters, such as A, B, etc. Sets can be empty, sing
    9 min read
    Finite Sets
    Finite set is a collection of finite, well-defined elements. For better understanding, imagine you have a bunch of your favourite toys or snacks. You know exactly how many you have, that's the idea of a finite set in math. A finite set is a way to discuss collections of things you can count. In this
    10 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences