How to calculate the number of elements in all subsets of a set There are $2^N$ subsets of a set.
For instance the set $\{ 1, 2 \}$ has the following subsets:
$\{ \}$
$\{ 2 \}$
$\{ 1 \}$
$\{ 1, 2 \}$
I'm trying to calculate the total number of elements in all of the subsets. In the above example, it would be $4$:
$\{ 2 \}$ has one element, $\{ 1 \}$ has one element and $\{ 1, 2 \}$ has two elements, giving us $4$.
Is there a generic equation that could calculate this for me?

Let $A=\{a_1,a_2,\dots,a_N\}$. For $i\in\{1,2,\dots,N\}$ and subset $B$ of $A$. We either have $a_i\in B$ or $a_i\notin B$. There are two possibilities for each $i$. So there are totally $2^N$ possibilities. $A$ has $2^N$ subsets.
For each $a_i$, there are $2^N\div2=2^{N-1}$ subsets of $A$ containing it. As there are $N$ values of $i$, the total number of elements of all the subsets of $A$ is $N\cdot2^{N-1}$.
