# What is the total sum of the cardinalities of all subsets of a set?

I’m having a hard time finding the pattern. Let’s say we have a set

The subsets are:

And the value I’m looking for, is the sum of the cardinalities of all of these subsets. That is, for this example,

What’s the formula for this value?

I can sort of see a pattern, but I can’t generalize it.

Here is a bijective argument. Fix a finite set $S$. Let us count the number of pairs $(X,x)$ where $X$ is a subset of $S$ and $x \in X$. We have two ways of doing this, depending which coordinate we fix first.
First way: For each set $X$, there are $|X|$ elements $x \in X$, so the count is $\sum_{X \subseteq S} |X|$.
Second way: For each element $x \in S$, there are $2^{|S|-1}$ sets $X$ with $x \in X$. We get them all by taking the union of $\{x\}$ with an arbitrary subset of $S\setminus\{x\}$. Thus, the count is $\sum_{x \in S} 2^{|S|-1} = |S| 2^{|S|-1}$.