A set is the simplest kind of mathematical object: a collection, with nothing but its members. You already describe collections with predicates and domains; set notation packages that idea so that collections can be named, compared and counted.
Key idea
A set can be written in roster form, listing its elements, as in $\{2, 3, 5, 7\}$, or in set-builder form, $\{x \in D : P(x)\}$, "the $x$ in $D$ for which $P(x)$ is true." Standard domains: $\mathbb{Z}$ (integers), $\mathbb{Z}^{+}$ (positive integers), $\mathbb{Q}$ (rational numbers), $\mathbb{R}$ (real numbers). Books disagree about whether $0$ belongs to $\mathbb{N}$, so on this site we say "positive integers" or "nonnegative integers" instead. A proper subset, $A \subsetneq B$, is a subset that is not all of $B$.
Why it works
Worked examples
Worked example: From set-builder to roster
- We need integers whose square is less than $10$: $0^{2} = 0$, $1^{2} = 1$, $2^{2} = 4$, $3^{2} = 9$ all work; $4^{2} = 16$ does not.
- Negative integers count too: $(-3)^{2} = 9 < 10$.
- The set is $\{-3, -2, -1, 0, 1, 2, 3\}$, with $7$ elements.
Answer: $\{-3, -2, -1, 0, 1, 2, 3\}$; size $7$
Worked example: Element or subset?
- The elements of $S$ are exactly three things: the number $1$, the set $\{2, 3\}$, and the empty set.
- $2 \in S$ is false: $2$ is inside an element, not an element itself. $\{2, 3\} \in S$ is true: it is listed.
- $\{2, 3\} \subseteq S$ is false: that would need $2 \in S$ and $3 \in S$.
- $\varnothing \in S$ is true (it is listed), and $\varnothing \subseteq S$ is true (as for every set). $|S| = 3$.
Answer: false, true, false, true, true, $3$
Worked example: Repeated values collapse
- The squares are $4, 1, 0, 1, 4$.
- A set lists each element once: $\{0, 1, 4\}$.
- So it has $3$ elements, not $5$.
Answer: $3$
Common mistake