In mathematics, a **Borel set** is any set in a topological space that can be formed from open sets (or, equivalently, from closed sets) through the operations of countable union, countable intersection, and relative complement. Borel sets are named after Émile Borel.

For a topological space *X*, the collection of all Borel sets on *X* forms a σ-algebra, known as the **Borel algebra** or **Borel σ-algebra**. The Borel algebra on *X* is the smallest σ-algebra containing all open sets (or, equivalently, all closed sets).

Borel sets are important in measure theory, since any measure defined on the open sets of a space, or on the closed sets of a space, must also be defined on all Borel sets of that space. Any measure defined on the Borel sets is called a Borel measure. Borel sets and the associated Borel hierarchy also play a fundamental role in descriptive set theory.

In some contexts, Borel sets are defined to be generated by the compact sets of the topological space, rather than the open sets. The two definitions are equivalent for many well-behaved spaces, including all Hausdorff σ-compact spaces, but can be different in more pathological spaces.

In the case that *X* is a metric space, the Borel algebra in the first sense may be described *generatively* as follows.

For a collection *T* of subsets of *X* (that is, for any subset of the power set P(*X*) of *X*), let

- be all countable unions of elements of
*T* - be all countable intersections of elements of
*T*

Now define by transfinite induction a sequence *G ^{m}*, where

- For the base case of the definition, let be the collection of open subsets of
*X*. - If
*i*is not a limit ordinal, then*i*has an immediately preceding ordinal*i*− 1. Let - If
*i*is a limit ordinal, set

The claim is that the Borel algebra is *G*^{ω1}, where ω_{1} is the first uncountable ordinal number. That is, the Borel algebra can be *generated* from the class of open sets by iterating the operation

to the first uncountable ordinal.

To prove this claim, note that any open set in a metric space is the union of an increasing sequence of closed sets. In particular, complementation of sets maps *G ^{m}* into itself for any limit ordinal

Note that for each Borel set *B*, there is some countable ordinal *α _{B}* such that

An important example, especially in the theory of probability, is the Borel algebra on the set of real numbers. It is the algebra on which the Borel measure is defined. Given a real random variable defined on a probability space, its probability distribution is by definition also a measure on the Borel algebra.

The Borel algebra on the reals is the smallest σ-algebra on **R** that contains all the intervals.

In the construction by transfinite induction, it can be shown that, in each step, the number of sets is, at most, the cardinality of the continuum. So, the total number of Borel sets is less than or equal to

In fact, the cardinality of the collection of Borel sets is equal to that of the continuum (compare to the number of Lebesgue measurable sets that exist, which is strictly larger and equal to ).

See also: Standard Borel space |

Let *X* be a topological space. The **Borel space** associated to *X* is the pair (*X*,*B*), where *B* is the σ-algebra of Borel sets of *X*.

George Mackey defined a Borel space somewhat differently, writing that it is "a set together with a distinguished σ-field of subsets called its Borel sets."^{[1]} However, modern usage is to call the distinguished sub-algebra the *measurable sets* and such spaces *measurable spaces*. The reason for this distinction is that the Borel sets are the σ-algebra generated by *open* sets (of a topological space), whereas Mackey's definition refers to a set equipped with an *arbitrary* σ-algebra. There exist measurable spaces that are not Borel spaces, for any choice of topology on the underlying space.^{[2]}

Measurable spaces form a category in which the morphisms are measurable functions between measurable spaces. A function is measurable if it pulls back measurable sets, i.e., for all measurable sets *B* in *Y*, the set is measurable in *X*.

**Theorem**. Let *X* be a Polish space, that is, a topological space such that there is a metric *d* on *X* that defines the topology of *X* and that makes *X* a complete separable metric space. Then *X* as a Borel space is isomorphic to one of

**R**,**Z**,- a finite space.

(This result is reminiscent of Maharam's theorem.)

Considered as Borel spaces, the real line **R**, the union of **R** with a countable set, and **R**^{n} are isomorphic.

A **standard Borel space** is the Borel space associated to a Polish space. A standard Borel space is characterized up to isomorphism by its cardinality,^{[3]} and any uncountable standard Borel space has the cardinality of the continuum.

For subsets of Polish spaces, Borel sets can be characterized as those sets that are the ranges of continuous injective maps defined on Polish spaces. Note however, that the range of a continuous noninjective map may fail to be Borel. See analytic set.

Every probability measure on a standard Borel space turns it into a standard probability space.

An example of a subset of the reals that is non-Borel, due to Lusin,^{[4]} is described below. In contrast, an example of a non-measurable set cannot be exhibited, though its existence can be proved.

Every irrational number has a unique representation by an infinite continued fraction

where is some integer and all the other numbers are *positive* integers. Let be the set of all irrational numbers that correspond to sequences with the following property: there exists an infinite subsequence such that each element is a divisor of the next element. This set is not Borel. In fact, it is analytic, and complete in the class of analytic sets. For more details see descriptive set theory and the book by Kechris, especially Exercise (27.2) on page 209, Definition (22.9) on page 169, and Exercise (3.4)(ii) on page 14.

It's important to note, that while can be constructed in ZF, it cannot be proven to be non-Borel in ZF alone. In fact, it is consistent with ZF that is a countable union of countable sets,^{[5]} so that any subset of is a Borel set.

Another non-Borel set is an inverse image of an infinite parity function . However, this is a proof of existence (via the axiom of choice), not an explicit example.

According to Paul Halmos,^{[6]} a subset of a locally compact Hausdorff topological space is called a *Borel set* if it belongs to the smallest σ-ring containing all compact sets.

Norberg and Vervaat^{[7]} redefine the Borel algebra of a topological space as the -algebra generated by its open subsets and its compact saturated subsets. This definition is well-suited for applications in the case where is not Hausdorff. It coincides with the usual definition if is second countable or if every compact saturated subset is closed (which is the case in particular if is Hausdorff).