# Set Cardinality

I get the basic concept of set cardinality. For example if you have $A = \{3, 4, 5, 6\}$, the set cardinality would be $4$.

What I don't grasp is problems like: $A = \{a, a \{b, a \{a \}\}\}$ or $A = \{a\}$

-

## migrated from mathematica.stackexchange.comOct 23 '12 at 23:06

This question came from our site for users of Mathematica.

Are there a few commas missing in the first example? Shouldn't it be $A=\{a,a,\{b,a,\{a\}\}\}$? – Andrés Caicedo Oct 23 '12 at 23:10
You count the things that are inside the set, not the things inside of the things inside of the set. $\{a,b,\{c,d\}\}$ has cardinality of 3, not 4 (its elements are $a$, $b$, and $\{c,d\}$). – fhyve Oct 23 '12 at 23:12
... assuming $a \neq b$ and $a \neq \{c,d\}$ and $b \neq \{c, d\}$. – Hurkyl Oct 23 '12 at 23:18

You just count how many separate things there are in the set. Whether these things are subsets, symbols, functions or whatever doesn't matter. Each thing counts as one. Thus,

• $|\{a\}| = 1$
• $|\{a,a\}| = 1$ since both $a$s are presumably the same thing
• $|\{1,\{2,3,4,5\}\}| = 2$ since the set contains $1$ and $\{2,3,4,5\}$ with are two distinct things
• $|\{a,\{a\},\{\{a\}\}|=3$ since $a$, $\{a\}$, $\{\{a\}\}$ are three distinct things. The latter two are distinct because one is a set with contains $a$, and the second is a set which contains a set which contains $a$.

To test whether two sets are equal, you have to check whether they contain exactly the same things. If every thing contains in $A$ is also contained in $B$, and the other way round, then (and only then) are $A$ and $B$ equal.

-
... and by the axiom of regularity, $a \neq \{a\}$, and $a \neq \{\{a\}\}$. – Hurkyl Oct 24 '12 at 0:14