What does it mean for a number to be in a set?

Frustratingly my book gives me several examples of a number in a set but offers no explanation at all.

Anyways what is going on here? According to the book $2$ is not an element of these sets:

$$\{\{2\},\{\{2\}\}\}$$

$$\{\{2\},\{2,\{2\}\}\}$$

$$\{\{\{2\}\}\}$$

What is going on? Clearly $2$ is in all of those sets. Or are they saying that $2$ isn't in any of these sets but a set is in all these sets and in that set is $2$? Which really seems like a logical fallacy because $2$ is in those sets contained in a set means the set has $2$ even if it is behind a layer of sets.

For example you wouldn't say that there are no cars in a neighborhood if all the cars in in a garage, so why does math take this approach?


When we say "$2$ is in a set," we mean that $2$ is an element of the set. In the first case, there are exactly two elements of $\{\{2\}, \{\{2\}\}\}$, namely

$$\{2\}$$ and $$\{\{2\}\}$$

In general, one can find the elements of a given set by erasing the outermost braces.

Neither of these are the number $2$; the first one is a set containing $2$ as an element, and the other is a set containing the set $\{2\}$ as an element.

If we wanted to have $2$ be an element of the set, we'd need either $2 = \{2\}$ or $2 = \{\{2\}\}$, neither of which is true.


Here is a non mathematical explanation in case it helps.

Think of a Russian Doll.

There are two ways of thinking about what is inside the outside (largest) doll. Perhaps the most obvious is to say "all the little dolls". But when a child opens the first doll, all they see is the next one "there's another doll inside".

When we are dealing with sets, we say $x\in X$, if we see $x$ when we take the first layer off and look inside. There may be other things to find, but they are buried deeper, and can only be found if we are allowed to take more layers off.


It's an interesting question you raise.

Practically speaking, we (as mathematicians) would never run into this problem because we never mix numbers and "sets of numbers", or different types in the same collection (edit from comment: set theory does this, so this comment is about "higher levels" of abstraction in mathematics than set theory)

Anyway, we would prove statements of the form: "Let $\mathcal{S}$ be a collection of sets. Then for $S,T \in \mathcal{S}, \ldots$", etc. As a sanity check, you would be sure that $\mathcal{S}$ would not contain a single number, and so mathematically we wouldn't say that $2 \in \mathcal{S}$ even if one set of $\mathcal{S}$ contains $2$, right?

Even to disambiguate "sets of sets" from sets, we use the term "collection of sets".

That being said, this concept is very important when you go to computer science because you really need to keep such structures straight, they are used to organize data (lists of lists, etc). There you might run into the same question of, "how do you determine if $2$ is in my structure or not", but that is a different question entirely.