TL;DR
The power set of a set is the collection of every subset of , including the empty set and itself. It answers the question "in how many ways can I pick some of these things?" and it is the basic object behind counting combinations. If has elements, its power set has elements, a fact that grows very fast as grows.
Builds on: Set Operations · Leads to: topological spaces, which are built from collections of subsets
Where it's used
Probability. A die has six faces, so its sample space is . An event such as "the roll is even" is a subset of that space. The power set of the sample space is the collection of all possible events, and it has members. Probability theory assigns a number to each of those 64 events.
Feature selection in statistics. Suppose a regression model could use any of 20 candidate predictors. Choosing a model means choosing a subset of the 20. There are such subsets, so the power set is the full search space of possible models. Methods like best-subset selection try to score every member of it, and this is why they become slow once the number of predictors is large.
Computer memory. A set of 8 switches, each on or off, can be stored as one byte. Each byte is one subset of the 8 switches: a bit set to 1 means that switch is in the subset. The 256 possible byte values are exactly the 256 subsets of the 8 switches, which is the power set of an 8-element set. Programmers call this a bitmask.
How it works
Take a tiny set . We will build its power set one element at a time, starting from the empty set.
- Start with one subset. The list holds only the empty set, , which has no elements. Check: the list has 1 subset, and .
- Add the element 1. For every subset already on the list, keep it, and also make a copy with 1 put in. The empty set gives and . Check: 2 subsets, and .
- Add the element 2. Again, keep every subset on the list, and make a copy of each with 2 added. The list gives and . Now the list is . Check: 4 subsets, and .
- Add the element 3. Copy each of the 4 subsets with 3 added: . The list now has 8 subsets. Check: .
The rule at every step is the same. Each element is either in a subset or out of it, so each subset already on the list gives two new subsets. Adding one element doubles the count. The final list is
A second way to see the same 8 subsets uses binary. Write each subset as a 3-digit string, with a 1 in the position of each element that is present:
| Binary | Subset |
|---|---|
| 000 | |
| 001 | |
| 010 | |
| 011 | |
| 100 | |
| 101 | |
| 110 | |
| 111 |
Counting from 0 to 7 in binary visits every subset exactly once, which is another reason the count is .
The math
Definition
For a set , the power set is the set of all subsets of : Here means every element of is also an element of . Both and are members of .
Each member of is itself a set. So is a set of sets, and it can be written with curly braces around the subsets.
Step 2 in symbols
Let be a set and let be an element not in . Every subset of falls into exactly one of two groups:
- It does not contain . Then it is a subset of . There are of these.
- It contains . Then removing leaves a subset of , and adding back to any subset of gives one of these. So there are again of these.
The two groups do not overlap, so
This is the doubling from step 2 of the walkthrough. The symbol means the number of elements of .
The general count
Let . The claim is . We prove it by induction on .
- Base case, . Then , and its only subset is . So , which has element.
- Inductive step. Assume for every set with elements. Take with elements, pick one element of , and let . Then has elements and . By the doubling argument, .
Counting by size
Subsets of with exactly elements are counted by the binomial coefficient
Every subset has some size from to , so
which agrees with the count . For the sizes are , and .
Worked examples
Let .
- The subsets of are the ones that contain nothing and the ones that contain .
- The empty set is a subset, because it has no elements that fail to be in .
- The set is a subset, because it is itself.
- There are no other subsets.
- So , which has 2 elements. This matches .
Let .
- Count by size. Size 0: one subset, . That is .
- Size 1: . That is .
- Size 2: . That is .
- Size 3: itself. That is .
- Add the counts: .
- The formula gives the same answer, so the count is right.
- The result is a useful check: whenever you list the subsets by size, the sizes must add up to .
A team is choosing which of 20 features to include in a model. Each feature is either included or left out, so a candidate model is a subset of the 20 features.
- The number of candidate models is the size of the power set, .
- Compute .
- Then .
- Suppose fitting and scoring one model takes 1 millisecond. Then trying all of them takes milliseconds.
- Convert to seconds by dividing by 1000: seconds.
- Convert to minutes by dividing by 60: about minutes.
- Adding a 21st feature doubles the work, so the time for 21 features is about 35 minutes. This is why exhaustive search becomes impractical as the number of features grows.
Try it: how many subsets of a 10-element set have exactly 2 elements? Use .
Answer: . Of the subsets, only 45 have size 2.
Common mistakes and tradeoffs
Mistake 1: confusing with . It is tempting to think that the power set of the empty set is empty. In fact . The empty set has zero elements, but is a set that contains one element, the empty set. So the power set of has one element, matching .
Mistake 2: forgetting the ends. People often list only the "real" subsets and leave out or itself. Both are subsets, and both count. For a set of three elements, forgetting them gives 6 instead of 8.
Mistake 3: treating order as meaningful. The sets and are the same set, so the power set contains it only once. If order matters, you are counting sequences or arrangements, which is a different problem.
When to use it. Use the power set when every combination of items is a legitimate choice, and you need to count, enumerate or reason about all of them. It is the right model for events in probability, for choices of options, and for bitmask states.
When not to use it. The count doubles with every element added. Once a set has a few dozen elements, listing every subset is out of reach for an ordinary computer. In those cases people restrict the search to subsets of a fixed size, which gives choices, or use greedy and heuristic methods that look at only a small part of the power set.
History
Georg Cantor was working on infinite sets in the early 1890s. In 1891 he gave his diagonal argument, which shows that no set can be matched one-to-one with its own power set. In particular the power set of an infinite set is always strictly larger than the set itself. This result, now called Cantor's theorem, caught on because it showed that infinities come in different sizes.
When Ernst Zermelo set out axioms for set theory in 1908, he included a power set axiom: for every set there exists a set that contains all of its subsets. Later axiomatizations, now the standard Zermelo–Fraenkel system, kept this axiom. The idea of collecting all subsets is therefore a basic building block of modern mathematics, not just a counting tool.
Recap
- A subset of is any set whose elements all belong to , including and .
- The power set collects every subset of .
- Each element is either in or out of a subset, so adding an element doubles the count: for elements.
- The subsets of size number , and these sum to .
- Next, read Topological Space, which uses a power set as its starting point, and Mathematical Induction if the counting proof above felt unfamiliar.
Check yourself
QuestionHow many elements does the power set of have?Show answer
It has elements. Each of the four elements is either in or out of a subset, so the number of subsets is .
QuestionCompute for and explain the answer.Show answer
The answer is . Start from , which has 0 elements. Each of the 6 elements doubles the list of subsets, so the count is . This is the number of events for a fair die, as in the probability example.
QuestionWhy is not the empty set?Show answer
Because the empty set has no elements, but must contain at least one subset: is a subset of . So , a set with one element. Its size matches the formula.
QuestionA set has 5 elements. How many of its subsets have exactly 3 elements?Show answer
Use the binomial coefficient . There are 10 subsets of size 3.
QuestionA colleague says a feature-selection method that scores all subsets of 30 features will finish quickly because each score is cheap. Is this a sound argument?Show answer
No. The power set of 30 features has , about 1.07 billion, subsets. Even if each score takes a microsecond, that is roughly 18 minutes of work, and the cost doubles with each added feature. The number of subsets, not the cost of one score, controls the running time.