Let XX be a set. A topology on XX is a collection T\mathcal{T} of subsets of X,X, called the open sets of the topology, that satisfies the topology axioms:

  • ∅∈T\varnothing\in\mathcal{T} and X∈T;X\in\mathcal{T};
  • the union of any collection of sets in T\mathcal{T} is in T;\mathcal{T};
  • the intersection of finitely many sets in T\mathcal{T} is in T.\mathcal{T}.

A topological space (X,T)\left(X,\mathcal{T}\right) is a set equipped with a topology and is written XX when the topology is understood. A set is closed if its complement is open, so arbitrary intersections and finite unions of closed sets are closed. The open sets of a metric space satisfy the axioms, so every metric space is a topological space with the metric topology induced by its metric, and equivalent metrics induce the same topology. The topology in which every subset is open is the discrete topology, induced by the discrete metric, and the topology {∅,X}\left\{\varnothing,X\right\} is the indiscrete topology. A topological space is metrisable if its topology is induced by some metric; the indiscrete topology on a set with more than one point is not metrisable.

Let T\mathcal{T} and T′\mathcal{T}' be topologies on X.X. T′\mathcal{T}' is finer than T,\mathcal{T}, and T\mathcal{T} is coarser than T′,\mathcal{T}', if T⊆T′,\mathcal{T}\subseteq\mathcal{T}', so that the discrete topology is the finest and the indiscrete topology the coarsest topology on X.X.

Let x∈Xx\in X and A⊆X.A\subseteq X. A neighbourhood of xx is a set that contains an open set containing x.x. The interior, limit points, isolated points, closure, boundary and density of AA are defined as in a metric space with “open ball centred at xx” replaced by “neighbourhood of xx”, and the interior remains the largest open set in AA and the closure the smallest closed set containing A.A. A sequence (xn)\left(x_n\right) converges to xx if and only if every neighbourhood of xx contains all but finitely many of its terms.

A basis for a topology T\mathcal{T} is a collection B⊆T\mathcal{B}\subseteq\mathcal{T} of open sets such that every open set is a union of sets in B.\mathcal{B}. The open balls form a basis for the metric topology, as do the open balls with rational radii, and the open intervals with rational endpoints form a countable basis for the usual topology on R.\mathbb{R}. A collection B\mathcal{B} of subsets of XX is a basis for some topology if and only if it covers XX and the intersection of any two of its sets is a union of sets in B;\mathcal{B}; that topology, the topology generated by B,\mathcal{B}, is the coarsest topology containing B.\mathcal{B}.

Let A⊆X.A\subseteq X. The subspace topology on AA consists of the intersections of AA with the open sets of X,X, and AA with this topology is a subspace of X.X.

TA:={U∩A:U∈T}\mathcal{T}_A:=\left\{U\cap A:U\in\mathcal{T}\right\}

A metric subspace carries the subspace topology, and a set that is open in a subspace need not be open in the whole space: [0,12)\left[0,\frac{1}{2}\right) is open in the subspace [0,1]\left[0,1\right] of R.\mathbb{R}. If AA is open in XX then the open sets of the subspace are exactly the open subsets of XX contained in A,A, and likewise for closed sets if AA is closed.

Let (X,TX)\left(X,\mathcal{T}_X\right) and (Y,TY)\left(Y,\mathcal{T}_Y\right) be topological spaces. The product topology on the Cartesian product X×YX\times Y is the topology generated by the basis of products of open sets.

B:={U×V:U∈TX, V∈TY}\mathcal{B}:=\left\{U\times V:U\in\mathcal{T}_X,\,V\in\mathcal{T}_Y\right\}

The product of finitely many spaces is defined in the same way. The product topology on Rm×Rn\mathbb{R}^m\times\mathbb{R}^n is the usual topology on Rm+n,\mathbb{R}^{m+n}, and the product of the metric spaces (X,dX)\left(X,d_X\right) and (Y,dY)\left(Y,d_Y\right) is metrisable by the product metric d((x,y),(x′,y′)):=max⁡{dX(x,x′),dY(y,y′)},d\left(\left(x,y\right),\left(x',y'\right)\right):=\max\left\{d_X\left(x,x'\right),d_Y\left(y,y'\right)\right\}, which is strongly equivalent to dX+dYd_X+d_Y and to dX2+dY2.\sqrt{d_X^2+d_Y^2}. A sequence in a product converges if and only if each of its coordinate sequences converges.

Let f:X→Yf:X\rightarrow Y be a function between topological spaces. ff is continuous if and only if the inverse image of every open set is open, which for metric spaces agrees with the earlier definition.

f−1(V)∈TX  ∀ V∈TYf^{-1}(V)\in\mathcal{T}_X\,\,\forall\,V\in\mathcal{T}_Y

Equivalently, the inverse image of every closed set is closed, or the inverse image of every set in a basis for TY\mathcal{T}_Y is open. Constant functions, the identity function, the inclusion of a subspace and the coordinate projections (x,y)↦x\left(x,y\right)\mapsto x and (x,y)↦y\left(x,y\right)\mapsto y of a product are continuous, a composition of continuous functions is continuous, the restriction of a continuous function to a subspace is continuous and a function into a product is continuous if and only if each of its coordinate functions is. A continuous function maps convergent sequences to convergent sequences, but in a general topological space the converse can fail, so continuity is not determined by sequences alone.

ff is a homeomorphism if it is a bijection and both ff and f−1f^{-1} are continuous, in which case XX and YY are homeomorphic and ff induces a bijection between their topologies. A topological property is a property preserved by homeomorphisms, such as being metrisable or having a countable basis; metric properties such as boundedness and completeness are not topological, since x↦tan⁡xx\mapsto\tan x is a homeomorphism from the bounded incomplete space (−π2,π2)\left(-\frac{\pi}{2},\frac{\pi}{2}\right) onto R.\mathbb{R}. A continuous bijection need not be a homeomorphism: t↦eitt\mapsto e^{it} is a continuous bijection from [0,2π)\left[0,2\pi\right) onto the unit circle whose inverse is discontinuous at 1.1. A continuous function f:X→Yf:X\rightarrow Y is an open map if it maps open sets to open sets and a closed map if it maps closed sets to closed sets, and a continuous bijection is a homeomorphism if and only if it is an open map, if and only if it is a closed map.

A topological space XX is Hausdorff if any two distinct points have disjoint neighbourhoods.

∀ x≠y∈X ∃ U,V∈T:x∈U, y∈V, U∩V=∅\forall\,x\neq y\in X\,\exists\,U,V\in\mathcal{T}:x\in U,\,y\in V,\,U\cap V=\varnothing

Every metric space is Hausdorff, since B(x,r2)B\left(x,\frac{r}{2}\right) and B(y,r2)B\left(y,\frac{r}{2}\right) are disjoint when r=d(x,y),r=d(x,y), whereas the indiscrete topology on a set with more than one point is not. Subspaces and products of Hausdorff spaces are Hausdorff. In a Hausdorff space finite sets are closed and a convergent sequence has exactly one limit; in the indiscrete topology every sequence converges to every point.