# Spectrum of a ring

In commutative algebra, the prime spectrum (or simply the spectrum) of a commutative ring $R$ is the set of all prime ideals of $R$, and is usually denoted by $\operatorname {Spec} {R}$; in algebraic geometry it is simultaneously a topological space equipped with a sheaf of rings.

## Zariski topology

For any ideal $I$ of $R$, define $V_{I}$ to be the set of prime ideals containing $I$. We can put a topology on $\operatorname {Spec} (R)$ by defining the collection of closed sets to be
    ${\big \V_{I}\colon I{\text{ is an ideal of }}R{\big \}}.$
This topology is called the Zariski topology.
A basis for the Zariski topology can be constructed as follows: For $f\in R$, define $D_{f}$ to be the set of prime ideals of $R$ not containing $f$. Then each $D_{f}$ is an open subset of $\operatorname {Spec} (R)$, and ${\big \D_{f}:f\in R{\big \}}$ is a basis for the Zariski topology.
$\operatorname {Spec} (R)$ is a compact space, but almost never Hausdorff: In fact, the maximal ideals in $R$ are precisely the closed points in this topology. By the same reasoning, $\operatorname {Spec} (R)$ is not, in general, a T$_1$ space. However, $\operatorname {Spec} (R)$ is always a Kolmogorov space (satisfies the T$_0$ axiom); it is also a spectral space.

## Sheaves and schemes

Given the space $X=\operatorname {Spec} (R)$ with the Zariski topology, the structure sheaf ${\mathcal {O}}_{X}$ is defined on the distinguished open subsets $D_{f}$ by setting $\Gamma (D_{f},{\mathcal {O}}_{X})=R_{f},$ the localization of $R$ by the powers of $f$. It can be shown that this defines a B-sheaf and therefore that it defines a sheaf. In more detail, the distinguished open subsets are a basis of the Zariski topology, so for an arbitrary open set $U$, written as the union of U=⋃$_{i∈I}$D$_{fi}${\textstyle U=\bigcup _{i\in I}D_{f_{i}}}, we set Γ(U, O$_X$)=lim$_←$$_{i∈I}$⁡R$_{fi}$, {\textstyle \Gamma (U, {\mathcal {O}}_{X})=\varprojlim _{i\in I}R_{f_{i}}, } where $\varprojlim$ denotes the inverse limit with respect to the natural ring homomorphisms $R_{f}\to R_{fg}.$ One may check that this presheaf is a sheaf, so $\operatorname {Spec} (R)$ is a ringed space. Any ringed space isomorphic to one of this form is called an affine scheme. General schemes are obtained by gluing affine schemes together.
Similarly, for a module $M$ over the ring $R$, we may define a sheaf ${\widetilde {M}}$ on $\operatorname {Spec} (R)$. On the distinguished open subsets set $\Gamma (D_{f},{\widetilde {M}})=M_{f},$ using the localization of a module. As above, this construction extends to a presheaf on all open subsets of $\operatorname {Spec} (R)$ and satisfies the gluing axiom. A sheaf of this form is called a quasicoherent sheaf.
If ${\mathfrak {p}}$ is a point in $\operatorname {Spec} (R)$, that is, a prime ideal, then the stalk of the structure sheaf at ${\mathfrak {p}}$ equals the localization of $R$ at the ideal ${\mathfrak {p}}$, which is generally denoted $R_{\mathfrak {p}}$, and this is a local ring. Consequently, $\operatorname {Spec} (R)$ is a locally ringed space.
If $R$ is an integral domain, with field of fractions $K$, then we can describe the ring $\Gamma (U,{\mathcal {O}}_{X})$ more concretely as follows. We say that an element $f$ in $K$ is regular at a point ${\mathfrak {p}}$ in $X=\operatorname {Spec} {R}$ if it can be represented as a fraction $f=a/b$ with $b\notin {\mathfrak {p}}$. Note that this agrees with the notion of a regular function in algebraic geometry. Using this definition, we can describe $\Gamma (U,{\mathcal {O}}_{X})$ as precisely the set of elements of $K$ that are regular at every point ${\mathfrak {p}}$ in $U$.

## Functorial perspective

It is useful to use the language of category theory and observe that $\operatorname {Spec}$ is a functor. Every ring homomorphism $f:R\to S$ induces a continuous map $\operatorname {Spec} (f):\operatorname {Spec} (S)\to \operatorname {Spec} (R)$ (since the preimage of any prime ideal in $S$ is a prime ideal in $R$). In this way, $\operatorname {Spec}$ can be seen as a contravariant functor from the category of commutative rings to the category of topological spaces. Moreover, for every prime ${\mathfrak {p}}$ the homomorphism $f$ descends to homomorphisms
    ${\mathcal {O}}_{f^{-1}({\mathfrak {p}})}\to {\mathcal {O}}_{\mathfrak {p}}$
of local rings. Thus $\operatorname {Spec}$ even defines a contravariant functor from the category of commutative rings to the category of locally ringed spaces. In fact it is the universal such functor, and hence can be used to define the functor $\operatorname {Spec}$ up to natural isomorphism.
The functor $\operatorname {Spec}$ yields a contravariant equivalence between the category of commutative rings and the category of affine schemes; each of these categories is often thought of as the opposite category of the other.

## Motivation from algebraic geometry

Following on from the example, in algebraic geometry one studies algebraic sets, i.e. subsets of $K^{n}$ (where $K$ is an algebraically closed field) that are defined as the common zeros of a set of polynomials in $n$ variables. If $A$ is such an algebraic set, one considers the commutative ring $R$ of all polynomial functions $A\to K$. The maximal ideals of $R$ correspond to the points of $A$ (because $K$ is algebraically closed), and the prime ideals of $R$ correspond to the irreducible subvarieties of $A$ (an algebraic set is called irreducible if it cannot be written as the union of two proper algebraic subsets).
The spectrum of $R$ therefore consists of the points of $A$ together with elements for all irreducible subvarieties of $A$. The points of $A$ are closed in the spectrum, while the elements corresponding to subvarieties have a closure consisting of all their points and subvarieties. If one only considers the points of $A$, i.e. the maximal ideals in $R$, then the Zariski topology defined above coincides with the Zariski topology defined on algebraic sets (which has precisely the algebraic subsets as closed sets). Specifically, the maximal ideals in $R$, i.e. $\operatorname {MaxSpec} (R)$, together with the Zariski topology, is homeomorphic to $A$ also with the Zariski topology.
One can thus view the topological space $\operatorname {Spec} (R)$ as an "enrichment" of the topological space $A$ (with Zariski topology): for every irreducible subvariety of $A$, one additional non-closed point has been introduced, and this point "keeps track" of the corresponding irreducible subvariety. One thinks of this point as the generic point for the irreducible subvariety. Furthermore, the structure sheaf on $\operatorname {Spec} (R)$ and the sheaf of polynomial functions on $A$ are essentially identical. By studying spectra of polynomial rings instead of algebraic sets with the Zariski topology, one can generalize the concepts of algebraic geometry to non-algebraically closed fields and beyond, eventually arriving at the language of schemes.

## Examples

* The spectrum of integers: The affine scheme $\operatorname {Spec} (\mathbb {Z} )$ is the final object in the category of affine schemes since $\mathbb {Z}$ is the initial object in the category of commutative rings.
* The scheme-theoretic analogue of $\mathbb {C} ^{n}$: The affine scheme $\mathbb {A} _{\mathbb {C} }^{n}=\operatorname {Spec} (\mathbb {C} [x_{1},\ldots ,x_{n}])$. From the functor of points perspective, a point $(\alpha _{1},\ldots ,\alpha _{n})\in \mathbb {C} ^{n}$ can be identified with the evaluation morphism $\mathbb {C} [x_{1},\ldots ,x_{n}]{\xrightarrow[{ev_{(\alpha _{1},\dots ,\alpha _{n})}}]}\mathbb {C}$. This fundamental observation allows us to give meaning to other affine schemes.
* The cross: $\operatorname {Spec} (\mathbb {C} [x,y]/(xy))$ looks topologically like the transverse intersection of two complex planes at a point (in particular, this scheme is not irreducible), although typically this is depicted as a $+$, since the only well defined morphisms to $\mathbb {C}$ are the evaluation morphisms associated with the points $\{(\alpha _{1},0),(0,\alpha _{2}):\alpha _{1},\alpha _{2}\in \mathbb {C} \}$.
* The prime spectrum of a Boolean ring (e.g., a power set ring) is a compact totally disconnected Hausdorff space (that is, a Stone space).
* (M. Hochster) A topological space is homeomorphic to the prime spectrum of a commutative ring (i.e., a spectral space) if and only if it is compact, quasi-separated and sober.

## Non-affine examples

Here are some examples of schemes that are not affine schemes. They are constructed from gluing affine schemes together.
* The projective $n$-space $\mathbb {P} _{k}^{n}=\operatorname {Proj} k[x_{0},\ldots ,x_{n}]$ over a field $k$. This can be easily generalized to any base ring, see Proj construction (in fact, we can define projective space for any base scheme). The projective $n$-space for $n\geq 1$ is not affine as the ring of global sections of $\mathbb {P} _{k}^{n}$ is $k$.
* Affine plane minus the origin. Inside $\mathbb {A} _{k}^{2}=\operatorname {Spec} k[x,y]$ are distinguished open affine subschemes $D_{x},D_{y}$. Their union $D_{x}\cup D_{y}=U$ is the affine plane with the origin taken out. The global sections of $U$ are pairs of polynomials on $D_{x},D_{y}$ that restrict to the same polynomial on $D_{xy}$, which can be shown to be $k[x,y]$, the global sections of $\mathbb {A} _{k}^{2}$. $U$ is not affine as $V_{(x)}\cap V_{(y)}=\varnothing$ in $U$.

## Non-Zariski topologies on a prime spectrum

Some authors (notably M. Hochster) consider topologies on prime spectra other than the Zariski topology.
First, there is the notion of constructible topology: given a ring A, the subsets of $\operatorname {Spec} (A)$ of the form $\varphi ^{*}(\operatorname {Spec} B),\varphi :A\to B$ satisfy the axioms for closed sets in a topological space. This topology on $\operatorname {Spec} (A)$ is called the constructible topology.
In Hochster (1969), Hochster considers what he calls the patch topology on a prime spectrum. By definition, the patch topology is the smallest topology in which the sets of the forms $V(I)$ and $\operatorname {Spec} (A)-V(f)$ are closed.

## Global or relative Spec

There is a relative version of the functor $\operatorname {Spec}$ called global $\operatorname {Spec}$, or relative $\operatorname {Spec}$. If $S$ is a scheme, then relative $\operatorname {Spec}$ is denoted by ${\underline {\operatorname {Spec} }}_{S}$ or $\mathbf {Spec} _{S}$. If $S$ is clear from the context, then relative Spec may be denoted by ${\underline {\operatorname {Spec} }}$ or $\mathbf {Spec}$. For a scheme $S$ and a quasi-coherent sheaf of ${\mathcal {O}}_{S}$-algebras ${\mathcal {A}}$, there is a scheme ${\underline {\operatorname {Spec} }}_{S}({\mathcal {A}})$ and a morphism $f:{\underline {\operatorname {Spec} }}_{S}({\mathcal {A}})\to S$ such that for every open affine $U\subseteq S$, there is an isomorphism $f^{-1}(U)\cong \operatorname {Spec} ({\mathcal {A}}(U))$, and such that for open affines $V\subseteq U$, the inclusion $f^{-1}(V)\to f^{-1}(U)$ is induced by the restriction map ${\mathcal {A}}(U)\to {\mathcal {A}}(V)$. That is, as ring homomorphisms induce opposite maps of spectra, the restriction maps of a sheaf of algebras induce the inclusion maps of the spectra that make up the Spec of the sheaf.
Global Spec has a universal property similar to the universal property for ordinary Spec. More precisely, just as Spec and the global section functor are contravariant right adjoints between the category of commutative rings and schemes, global Spec and the direct image functor for the structure map are contravariant right adjoints between the category of commutative ${\mathcal {O}}_{S}$-algebras and schemes over $S$. In formulas,
    $\operatorname {Hom} _{{\mathcal {O}}_{S}{\text{-alg}}}({\mathcal {A}},\pi _{*}{\mathcal {O}}_{X})\cong \operatorname {Hom} _{{\text{Sch}}/S}(X,\mathbf {Spec} ({\mathcal {A}})),$
where $\pi \colon X\to S$ is a morphism of schemes.

### Example of a relative Spec

The relative spec is the correct tool for parameterizing the family of lines through the origin of $\mathbb {A} _{\mathbb {C} }^{2}$ over $X=\mathbb {P} _{a,b}^{1}.$ Consider the sheaf of algebras ${\mathcal {A}}={\mathcal {O}}_{X}[x,y],$ and let ${\mathcal {I}}=(ay-bx)$ be a sheaf of ideals of ${\mathcal {A}}.$ Then the relative spec ${\underline {\operatorname {Spec} }}_{X}({\mathcal {A}}/{\mathcal {I}})\to \mathbb {P} _{a,b}^{1}$ parameterizes the desired family. In fact, the fiber over $[\alpha :\beta ]$ is the line through the origin of $\mathbb {A} ^{2}$ containing the point $(\alpha ,\beta ).$ Assuming $\alpha \neq 0,$ the fiber can be computed by looking at the composition of pullback diagrams
    ${\begin{matrix}\operatorname {Spec} \left({\frac {\mathbb {C} [x,y]}{\left(y-{\frac {\beta }{\alpha }}x\right)}}\right)&\to &\operatorname {Spec} \left({\frac {\mathbb {C} \left[{\frac {b}{a}}\right][x,y]}{\left(y-{\frac {b}{a}}x\right)}}\right)&\to &{\underline {\operatorname {Spec} }}_{X}\left({\frac {{\mathcal {O}}_{X}[x,y]}{\left(ay-bx\right)}}\right)\\\downarrow &&\downarrow &&\downarrow \\\operatorname {Spec} (\mathbb {C} )&\to &\operatorname {Spec} \left(\mathbb {C} \left[{\frac {b}{a}}\right]\right)=U_{a}&\to &\mathbb {P} _{a,b}^{1}\end{matrix}}$
where the composition of the bottom arrows
    $\operatorname {Spec} (\mathbb {C} ){\xrightarrow {[\alpha :\beta ]}}\mathbb {P} _{a,b}^{1}$
gives the line containing the point $(\alpha ,\beta )$ and the origin. This example can be generalized to parameterize the family of lines through the origin of $\mathbb {A} _{\mathbb {C} }^{n+1}$ over $X=\mathbb {P} _{a_{0},...,a_{n}}^{n}$ by letting ${\mathcal {A}}={\mathcal {O}}_{X}[x_{0},...,x_{n}]$ and ${\mathcal {I}}=\left(2\times 2{\text{ minors of }}{\begin{pmatrix}a_{0}&\cdots &a_{n}\\x_{0}&\cdots &x_{n}\end{pmatrix}}\right).$

## Representation theory perspective

From the perspective of representation theory, a prime ideal I corresponds to a module R/I, and the spectrum of a ring corresponds to irreducible cyclic representations of R, while more general subvarieties correspond to possibly reducible representations that need not be cyclic. Recall that abstractly, the representation theory of a group is the study of modules over its group algebra.
The connection to representation theory is clearer if one considers the polynomial ring $R=K[x_{1},\dots ,x_{n}]$ or, without a basis, $R=K[V].$ As the latter formulation makes clear, a polynomial ring is the group algebra over a vector space, and writing in terms of $x_{i}$ corresponds to choosing a basis for the vector space. Then an ideal I, or equivalently a module $R/I,$ is a cyclic representation of R (cyclic meaning generated by 1 element as an R-module; this generalizes 1-dimensional representations).
In the case that the field is algebraically closed (say, the complex numbers), every maximal ideal corresponds to a point in n-space, by the Nullstellensatz (the maximal ideal generated by $(x_{1}-a_{1}),(x_{2}-a_{2}),\ldots ,(x_{n}-a_{n})$ corresponds to the point $(a_{1},\ldots ,a_{n})$). These representations of $K[V]$ are then parametrized by the dual space $V^{*},$ the covector being given by sending each $x_{i}$ to the corresponding $a_{i}$. Thus a representation of $K^{n}$ (K-linear maps $K^{n}\to K$) is given by a set of n numbers, or equivalently a covector $K^{n}\to K.$
Thus, points in n-space, thought of as the max spec of $R=K[x_{1},\dots ,x_{n}],$ correspond precisely to 1-dimensional representations of R, while finite sets of points correspond to finite-dimensional representations (which are reducible, corresponding geometrically to being a union, and algebraically to not being a prime ideal). The non-maximal ideals then correspond to infinite-dimensional representations.

## Functional analysis perspective

The term "spectrum" comes from the use in operator theory. Given a linear operator T on a finite-dimensional vector space V, one can consider the vector space with operator as a module over the polynomial ring in one variable R = K[T], as in the structure theorem for finitely generated modules over a principal ideal domain. Then the spectrum of K[T] (as a ring) equals the spectrum of T (as an operator).
Further, the geometric structure of the spectrum of the ring (equivalently, the algebraic structure of the module) captures the behavior of the spectrum of the operator, such as algebraic multiplicity and geometric multiplicity. For instance, for the 2×2 identity matrix has corresponding module:
    $K[T]/(T-1)\oplus K[T]/(T-1)$
the 2×2 zero matrix has module
    $K[T]/(T-0)\oplus K[T]/(T-0),$
showing geometric multiplicity 2 for the zero eigenvalue, while a non-trivial 2×2 nilpotent matrix has module
    $K[T]/T^{2},$
showing algebraic multiplicity 2 but geometric multiplicity 1.
In more detail:
* the eigenvalues (with geometric multiplicity) of the operator correspond to the (reduced) points of the variety, with multiplicity;
* the primary decomposition of the module corresponds to the unreduced points of the variety;
* a diagonalizable (semisimple) operator corresponds to a reduced variety;
* a cyclic module (one generator) corresponds to the operator having a cyclic vector (a vector whose orbit under T spans the space);
* the last invariant factor of the module equals the minimal polynomial of the operator, and the product of the invariant factors equals the characteristic polynomial.

## Generalizations

The spectrum can be generalized from rings to C*-algebras in operator theory, yielding the notion of the spectrum of a C*-algebra. Notably, for a Hausdorff space, the algebra of scalars (the bounded continuous functions on the space, being analogous to regular functions) is a commutative C*-algebra, with the space being recovered as a topological space from $\operatorname {MaxSpec}$ of the algebra of scalars, indeed functorially so; this is the content of the Banach–Stone theorem. Indeed, any commutative C*-algebra can be realized as the algebra of scalars of a Hausdorff space in this way, yielding the same correspondence as between a ring and its spectrum. Generalizing to non-commutative C*-algebras yields noncommutative topology.