Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 4

Using Membership, Subset, and Cardinality Notation

Recommended resources

In the last lesson, we explored how to build new sets from existing ones using operations like union, intersection, and the Cartesian product. We now have the tools to combine collections of objects. The next step is to develop a precise language for describing the relationships between sets and their elements. This is fundamental for everything from defining data structures to proving algorithm correctness.

Your goal for this lesson is to master the core notation used to discuss these relationships. By the end of our session, you will be able to correctly use the symbols for membership, subsets, and cardinality to solve problems and interpret mathematical statements about sets.

Membership and Cardinality: Is it in there, and how many?

The two most basic questions we can ask about a set are: "Is this specific item in the set?" and "How many items are in the set?". Let's formalize the notation for these questions.

  • Membership: To state that an element x is in a set A, we write . To state that it is not, we write .
  • Cardinality: The number of distinct elements in a finite set A is called its cardinality, written as .

The following video from TrevTutor provides an excellent introduction to these concepts. It clearly explains the notation and walks through some important examples that can be tricky for newcomers, such as the distinction between the empty set and a set that contains the empty set, .

INTRODUCTION to SET THEORY - DISCRETE MATHEMATICS

Please watch the section of this video on elements and cardinality. The presenter does a great job clarifying the notation and common points of confusion.

Focus on the segment from Elements and Cardinality. Pay close attention to how the symbols \in and |A| are used, and especially to the discussion about the empty set versus a set containing the empty set.

As a quick check, consider the set .

  • Is it true that ? Yes.
  • Is it true that ? No. The element is the set , not the number 3 itself. So, is true.
  • What is the cardinality, ? The set has three distinct elements: the number 1, the number 2, and the set . Therefore, .

This distinction between an element and a set containing that element is a crucial point that trips up many beginners. Your experience with nested data structures in programming, like a Python list containing other lists, should give you a good mental model for this. [1, 2, [3, 4]] is a list of length 3, and 3 is not a direct element of it.


Subsets: Containing and Being Contained

Now let's move from the relationship between an element and a set to the relationship between two sets.

A set is a subset of a set if every element of is also an element of . We denote this by .

A set is a proper subset of a set if is a subset of and is not equal to (i.e., contains at least one element not in ). We denote this by .

Let's clarify two important rules that follow from these definitions:

  1. Every set is a subset of itself. For any set , .
  2. The empty set is a subset of every set. For any set , .

The following video, also from TrevTutor, explains these concepts visually and works through several true/false examples that will help solidify your understanding.

SUBSETS AND POWER SETS - DISCRETE MATHEMATICS

This video provides a great visual introduction to subsets and proper subsets, then tests your understanding with some well-chosen examples.

Please watch the first two sections of the video, covering the visual definition and the true/false examples. The question of whether \{a\} is a subset of \{\{a\}\} is particularly important for checking your grasp of the element vs. set distinction.


The Power Set: Putting It All Together

The concept of a power set is a perfect way to practice using all the notation we've just learned. The power set of a set , written , is the set of all possible subsets of .

Let's take . What are its subsets?

  • The empty set:
  • Subsets with one element: ,
  • Subsets with two elements:

So, the power set is .

Notice the interplay of our new symbols here:

  • Subsets: , but . This is the critical distinction: a subset of is an element of the power set of .
  • Cardinality: The set has cardinality . The power set has cardinality . There's a wonderful relationship here: if , then . This formula is incredibly useful in combinatorics and computer science, for example when considering all possible configurations of a set of n binary flags.

The TrevTutor video you started continues by explaining power sets and this cardinality formula.

SUBSETS AND POWER SETS - DISCRETE MATHEMATICS

Please continue with the video to learn about power sets.

Watch the next two segments on generating power sets and the cardinality of power sets. The tree diagram is a helpful way to visualize why the number of subsets is a power of 2.


Practice and Application

Let's put this notation to work. Use the definitions we've covered to determine if the following statements are true or false.

Let and .

Check your answers
  1. True. Every element of (which are and ) is also in . Since has an element that does not (), is a proper subset.
  2. False. itself is the set , which is not one of the three elements of .
  3. True. Since , its power set has elements. They are .
  4. True. is just itself, and every set is a subset of itself.
  5. True. This is a tricky one. The set on the left is . It has one element: the set . To be a subset of , every element of must be in . The only element is , and we can see that . So the statement is true.

For more practice on systematically finding and counting subsets, the OpenStax textbook provides a clear, step-by-step example.

1.2 Subsets - Contemporary Mathematics | OpenStax

This reading will show you a methodical way to list all subsets of a given set and apply the formula for calculating the total number of subsets.

First, read through Example 1.11, which demonstrates how to list all subsets of a 3-element set. Then, jump down to the section on Exponential Notation and read from that section to see the formal statement of the 2^n rule and its application in Example 1.14.


A Python Perspective

Your practical programming background gives you a great advantage here, as these mathematical concepts have direct analogues in Python.

Let's define two sets:

A = {1, 2}
B = {1, 2, 3}
  • Membership: The in keyword checks for membership.
    >>> 2 in A
    True
    >>> 3 in A
    False
    
  • Cardinality: The built-in len() function gives the cardinality.
    >>> len(A)
    2
    
  • Subsets: The <= operator checks for a subset relationship, and < checks for a proper subset.
    >>> A <= B  # Is A a subset of B?
    True
    >>> A < B   # Is A a proper subset of B?
    True
    >>> B <= A  # Is B a subset of A?
    False
    >>> A <= A  # Is A a subset of itself?
    True
    >>> A < A   # Is A a proper subset of itself?
    False
    

Thinking about these mathematical ideas in terms of the code you already know can be a powerful way to solidify your understanding.


Conclusion

In this lesson, you've acquired the essential notation for describing sets and their contents. Mastering this vocabulary is non-negotiable for further study in discrete mathematics and theoretical computer science.

Key Takeaways:

  • Membership: means x is an element of set A.
  • Cardinality: is the number of distinct elements in set A.
  • Subset: means every element of A is also in B.
  • Proper Subset: means and .
  • The Power Set is the set of all subsets of , and its cardinality is .
  • There is a critical difference between membership () and being a subset ().

So far, we have built up a language for logic (propositions and quantifiers) and a language for collections (sets and their properties). In the next lesson, we will combine these tools to study relations, which are formal ways to describe how elements within a set relate to each other. Concepts like the Cartesian product, which defines the universe of all possible pairings, and subsets, which select specific pairings with interesting properties, will be central to our discussion.