Power set [007B]
- February 23, 2026
Definition Power set [007C]
- February 23, 2026
The power set of a set A, written \mathcal {P}(A), is the set of all possible subsets of A.
Example [007D]
- February 23, 2026
Let A = \{1,2,3\}. Then \mathcal {P}(A) = \{ \varnothing , \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\}, \{1,2,3\}\}.
Example [007E]
- February 23, 2026
\mathcal {P}(\varnothing ) = \{ \varnothing \}, since the only subset of the empty set is itself.
Listing all elements of a power set [007F]
- February 23, 2026
How do we know if we’ve listed all possible subsets? Notice that to make a particular subset, we get to independently choose whether each element will be in the subset or not. So we can associate a Boolean variable to each element of the set, and list all possible combinations of \mathsf {T} and \mathsf {F}, just like we would when making a truth table:
\begin {array}{cccc} \text {1?} & \text {2?} & \text {3?} & \text {subset} \\ \hline \mathsf {T} & \mathsf {T} & \mathsf {T} & \{1,2,3\} \\ \mathsf {T} & \mathsf {T} & \mathsf {F} & \{1,2\} \\ \mathsf {T} & \mathsf {F} & \mathsf {T} & \{1,3\} \\ \mathsf {T} & \mathsf {F} & \mathsf {F} & \{1\} \\ \mathsf {F} & \mathsf {T} & \mathsf {T} & \{2,3\} \\ \mathsf {F} & \mathsf {T} & \mathsf {F} & \{2\} \\ \mathsf {F} & \mathsf {F} & \mathsf {T} & \{3\} \\ \mathsf {F} & \mathsf {F} & \mathsf {F} & \varnothing \\ \end {array}Or we could just dispense with the booleans and make a table where we either list or don’t list each element in all possible combinations:
\begin {array}{rcccl} & \text {1?} & \text {2?} & \text {3?} & \\ \hline \{ & 1 & 2 & 3 & \} \\ \{ & 1 & 2 & & \} \\ \{ & 1 & & 3 & \} \\ \{ & 1 & & & \} \\ \{ & & 2 & 3 & \} \\ \{ & & 2 & & \} \\ \{ & & & 3 & \} \\ \{ & & & & \} \\ \end {array}This line of reasoning shows us that in general, if A is a finite set and |A| = n, then |\mathcal {P}(A)| = 2^n. Note this even works when A is empty: we have \mathcal {P}(\varnothing ) = \{\varnothing \} (since the empty set is the only subset of itself), and 2^0 = 1.
Notice how this is all pointing to the fact that we should allow both A \subseteq A and \varnothing \subseteq A. The entire set and the empty set both show up naturally when enumerating every possible combination of true/false values, and we get an elegant formula, 2^n, for the number of subsets including the entire set and the empty set. If we were to disallow these from being subsets, we would end up with a less elegant formula like 2^n - 2 for the number of subsets, and would have to use the word “except” when describing how to generate all possible subsets. We would essentially be fighting against the universe. The entire set and the empty set want to be subsets.
Power sets in Disco [007G]
- February 23, 2026
We can compute power sets in Disco using the power function:
Disco> power({1,2,3})
{{}, {1}, {1, 2}, {1, 2, 3}, {1, 3}, {2}, {2, 3}, {3}}
Disco> power({})
{{}}
Disco> power({2..5})
{{}, {2}, {2, 3}, {2, 3, 4}, {2, 3, 4, 5}, {2, 3, 5}, {2, 4}, {2, 4, 5}, {2, 5}, {3}, {3, 4}, {3, 4, 5}, {3, 5}, {4}, {4, 5}, {5}}
Disco> { |power({1..n})| | n in {1 .. 8} }
{2, 4, 8, 16, 32, 64, 128, 256}When given a set of type Set(T), the power function produces a result of type Set(Set(T)); that is, given a set of T, it produces a set of sets of T.
Disco> :type {1,2,3}
{1, 2, 3} : Set(ℕ)
Disco> :type power({1,2,3})
power({1, 2, 3}) : Set(Set(ℕ))