Set notation is mostly a character-escape problem plus three symbol choices that are easy to confuse: \in against \epsilon, \subset against \subseteq, and \mid against a plain vertical bar. Braces in maths are grouping characters, so a literal one is always \{ — which is also why LaTeX reads a set and a Brackets pair as different things.
Which one to use
\{1,2,3\}\{x \mid x>0\}\mid, not a typed bar.x \in A\in, not the letter epsilon.A \subseteq B\subset and \subseteq differ.A \cup B, A \cap B\varnothing\emptyset in most fonts.The commands
A = \{ 1, 2, 3 \}
2 \in A \quad 5 \notin A
\mid, sized and spaced for exactly this job. \{ x \in \mathbb{R} \mid x > 0 \}
\{ x \in \mathbb{Z} : x^2 \le 4 \}
\bigcap for indexed families. A \cap B
A \setminus B
\complement_S(A) is the explicit relative-complement command. A^{c} \quad A^{\prime}
\emptyset \quad \varnothing
\mathbb, the only place it is genuinely needed. \mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}
Worked examples
Definition by property
E = \{ x \in \mathbb{R} : |x| \le 1 \}
Absolute bars inside a builder read as a condition, not as delimiters, because there is nothing to close.
Disjoint sets
A \cap B = \emptyset
The standard one-line way to state that two sets share nothing.
De Morgan
(A \cup B)^{c} = A^{c} \cap B^{c}
The complement binds to the whole bracketed group, which is why the parentheses are load-bearing.
Indexed family
\bigcup_{n=1}^{\infty} A_n = \{ x : x \in A_n \text{ for some } n \}
The big-operator form takes bounds above and below; \cup with a subscript does not stack properly.
Common mistakes
- Writing
\{x : x > 0\}with an HTML entity for the greater-than sign. In a raw LaTeX file that is a table separator and breaks the layout. - Confusing
\subsetwith\subseteq. One excludes equality, the other does not, and textbooks disagree about which the single symbol means. - Using
\infor subsets (A \in Bmeans A is an element of B) or\subsetfor elements. - Leaving braces unescaped.
{1,2}is an invisible grouping token in LaTeX and prints as1,2with no braces at all.
Questions about this notation
How do I write curly braces in LaTeX math?
\left and \right you still need the backslash.What is the difference between \emptyset and \varnothing?
How do I write the power set?
\mathcal{P}(A) or 2^A. The calligraphic P is the common European spelling; the exponential form is standard in set theory and needs no command at all.What is the difference between \mid, \colon and a plain colon?
\mid puts space on both sides, which is what a set builder wants: \{ x \mid x > 0 \}. \colon keeps the space after it tight, which is right for a mapping: f \colon A \to B. A bare keyboard colon gets neither spacing rule right, and it also loses the relation spacing that the rest of the line depends on.Keep reading
Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.