Which sets are we allowed to measure?
A measure will not be able to assign a size to every subset of the line (we will prove this shortly). So we first fix a family of “allowed” sets that is closed under the operations we care about. A sigma-algebra on a set X is a collection M of subsets of X satisfying three axioms: (1) X is in M; (2) if A is in M then its complement X\A is in M; (3) if A_1, A_2, … is a countable sequence in M, then their union ⋃A_n is in M.
From these three we get more for free. The empty set ∅ = X\X is in M. Finite unions are special cases of countable unions. And by De Morgan, countable intersections are in M too, since ⋂A_n = X\⋃(X\A_n). So a sigma-algebra is exactly a collection stable under complement and countable union — and therefore under all the bookkeeping a theory of size requires.
What a measure is
Given a sigma-algebra M on X, a measure is a function μ : M → [0, ∞] (values in the extended reals, so ∞ is allowed) satisfying two axioms. First, μ(∅) = 0. Second, [[countable-additivity|countable additivity]]: if A_1, A_2, … are pairwise disjoint sets in M, then μ(⋃A_n) = Σ μ(A_n). Countable additivity is the whole engine: it is what lets limits and infinite processes interact gracefully with size.
Two consequences follow immediately and we should prove them, because they are used everywhere. Monotonicity: if A ⊆ B then μ(A) ≤ μ(B). And countable subadditivity: μ(⋃A_n) ≤ Σ μ(A_n) even when the A_n overlap. The proofs are short disjointification arguments.
MONOTONICITY. Suppose A subset B, both in M.
Write B = A union (B \ A), a DISJOINT union (A and B\A share no point).
Both A and B\A lie in M (sigma-algebra closed under complement/intersection).
By finite additivity (a special case of countable additivity, padding with empties):
mu(B) = mu(A) + mu(B \ A).
Since mu(B \ A) >= 0, we get mu(A) <= mu(B). QED
COUNTABLE SUBADDITIVITY. Given A_1, A_2, ... in M (possibly overlapping).
Disjointify: set
B_1 = A_1,
B_n = A_n \ (A_1 union ... union A_{n-1}) for n >= 2.
Then the B_n are pairwise disjoint, B_n subset A_n, and union B_n = union A_n.
By countable additivity and monotonicity (B_n subset A_n):
mu(union A_n) = mu(union B_n) = sum mu(B_n) <= sum mu(A_n). QEDThe smallest natural sigma-algebra on the line
On the real line there is a canonical sigma-algebra we cannot avoid. Take all the open intervals and form the smallest sigma-algebra containing them — the intersection of every sigma-algebra that contains the open sets. This is the Borel sigma-algebra, and its members are the Borel sets. They include every open set, every closed set, every countable set, and anything you can build from these by countably many unions, intersections, and complements.