In mathematics, a **scheme** is a mathematical structure that enlarges the notion of algebraic variety to include, among other things multiplicities (the equations *x* = 0 and *x*^{2} = 0 define the same algebraic variety and different schemes) and "varieties" defined over rings (for example Fermat curves are defined over the integers).

Schemes were introduced by Alexander Grothendieck in 1960 in his treatise Éléments de géométrie algébrique; one of its aims was developing the formalism needed to solve deep problems of algebraic geometry, such as the Weil conjectures (the last of which was proved by Pierre Deligne). Strongly based on commutative algebra, scheme theory allows a systematic use of methods of topology and homological algebra. By including rationality questions inside the formalism, scheme theory introduces a strong connection between algebraic geometry and number theory, which eventually allowed Wiles' proof of Fermat's Last Theorem.

To be technically precise, a scheme is a topological space together with commutative rings for all of its open sets, which arises from gluing together spectra (spaces of prime ideals) of commutative rings along their open subsets. In other words, it is a locally ringed space which is locally a spectrum of a commutative ring.

Any scheme *S* has a unique morphism to Spec(**Z**), the scheme associated to the ring of integers. Therefore a scheme may be identified to its morphism to Spec(**Z**), in a similar way as rings may be identified to associative algebras over the integers. This is the starting point, of the *relative point of view*, which consists of studying only morphisms of schemes. This does not restrict the generality, and allows easily specifying some properties of schemes. For example, an algebraic variety over a field *F* defines a morphism of a scheme to Spec(*F*), to which the variety may be identified.

For details on the development of scheme theory, which quickly becomes technically demanding, see first glossary of scheme theory.

The algebraic geometers of the Italian school had often used the somewhat foggy concept of "generic point" when proving statements about algebraic varieties. What is true for the generic point is true for all points of the variety except a small number of special points. In the 1920s, Emmy Noether had first suggested a way to clarify the concept: start with the coordinate ring of the variety (the ring of all polynomial functions defined on the variety); the maximal ideals of this ring will correspond to ordinary points of the variety (under suitable conditions), and the non-maximal prime ideals will correspond to the various generic points, one for each subvariety. By taking all prime ideals, one thus gets the whole collection of ordinary and generic points. Noether did not pursue this approach.

In the 1930s, Wolfgang Krull turned things around and took a radical step: start with *any* commutative ring, consider the set of its prime ideals, turn it into a topological space by introducing the Zariski topology, and study the algebraic geometry of these quite general objects. Others did not see the point of this generality and Krull abandoned it.

André Weil was especially interested in algebraic geometry over finite fields and other rings. In the 1940s he returned to the prime ideal approach; he needed an *abstract variety* (outside projective space) for foundational reasons, particularly for the existence in an algebraic setting of the Jacobian variety. In Weil's main foundational book (1946), generic points are constructed by taking points in a very large algebraically closed field, called a *universal domain*.

In 1944 Oscar Zariski defined an abstract Zariski–Riemann space from the function field of an algebraic variety, for the needs of birational geometry: this is like a direct limit of ordinary varieties (under 'blowing up'), and the construction, reminiscent of locale theory, used valuation rings as points.

In the 1950s, Jean-Pierre Serre, Claude Chevalley and Masayoshi Nagata, motivated largely by the Weil conjectures relating number theory and algebraic geometry, pursued similar approaches with prime ideals as points. According to Pierre Cartier, the word *scheme* was first used in the 1956 Chevalley Seminar, in which Chevalley was pursuing Zariski's ideas; and it was André Martineau who suggested to Serre the move to the current spectrum of a ring in general.

Alexander Grothendieck then gave the decisive definition, bringing to a conclusion a generation of experimental suggestions and partial developments. He defined the spectrum of a commutative ring as the space of prime ideals with Zariski topology, but augments it with a sheaf of rings: to every Zariski-open set he assigns a commutative ring, thought of as the ring of "polynomial functions" defined on that set. These objects are the affine schemes; a general scheme is then obtained by "gluing together" several such affine schemes, in analogy to the fact that general varieties can be obtained by gluing together affine varieties.

The generality of the scheme concept was initially criticized: some schemes are removed from having straightforward geometrical interpretation, which made the concept difficult to grasp. However, admitting arbitrary schemes makes the whole category of schemes better-behaved. Moreover, natural considerations regarding, for example, moduli spaces, lead to schemes that are "non-classical". The occurrence of these schemes that are not varieties (nor built up simply from varieties) in problems that could be posed in classical terms made for the gradual acceptance of the new foundations of the subject.

Subsequent work on algebraic spaces and algebraic stacks by Deligne, Mumford, and Michael Artin, originally in the context of moduli problems, has further enhanced the geometric flexibility of modern algebraic geometry. Grothendieck advocated certain types of ringed toposes as generalisations of schemes, and following his proposals relative schemes over ringed toposes were developed by M. Hakim. Recent ideas about higher algebraic stacks and homotopical or derived algebraic geometry have regard to further expanding the algebraic reach of geometric intuition, bringing algebraic geometry closer in spirit to homotopy theory.

An affine scheme is a locally ringed space isomorphic to the spectrum of a commutative ring. We denote the spectrum of a commutative ring *A* by Spec(*A*). A **scheme** is a locally ringed space *X* admitting a covering by open sets *U*_{i}, such that the restriction of the structure sheaf *O*_{X} to each *U*_{i} is an affine scheme. Therefore one may think of a scheme as being covered by "coordinate charts" of affine schemes. The above formal definition means exactly that schemes are obtained by glueing together affine schemes for the Zariski topology.

In the early days, this was called a *prescheme*, and a scheme was defined to be a separated prescheme. The term prescheme has fallen out of use, but can still be found in older books, such as Grothendieck's Éléments de géométrie algébrique and Mumford's *Red Book*.

Schemes form a category if we take as morphisms the morphisms of locally ringed spaces. (See also: morphism of schemes.)

Morphisms from schemes to affine schemes are completely understood in terms of ring homomorphisms by the following contravariant adjoint pair: For every scheme *X* and every commutative ring *A* we have a natural equivalence

Hom
S
c
h
e
m
e
s
(
X
,
Spec
(
A
)
)
≅
Hom
C
R
i
n
g
(
A
,
O
X
(
X
)
)
.
Since **Z** is an initial object in the category of rings, the category of schemes has Spec(**Z**) as a final object.

The category of schemes has finite products, but one has to be careful: the underlying topological space of the product scheme of (*X*, *O*_{X}) and (*Y*, *O*_{Y}) is normally *not* equal to the product of the topological spaces *X* and *Y*. In fact, the underlying topological space of the product scheme often has more points than the product of the underlying topological spaces. For example, if *K* is the field with nine elements, then Spec *K* × Spec *K* ≈ Spec (*K* ⊗_{Z} *K*) ≈ Spec (*K* ⊗_{Z/3Z} *K*) ≈ Spec (*K* × *K*), a set with two elements, though Spec *K* has only a single element.

For a scheme
S
, the category of schemes over
S
has also fibre products, and since it has a final object
S
, it follows that it has finite limits.

Every affine scheme
Spec
(
R
)
is a scheme.
For a graded ring
R
, there is a scheme
Proj
(
R
)
. When
R
has elements of non-zero degree, this scheme is not affine.
In particular, let
R
=
C
[
x
,
y
,
z
]
where each monomial has degree
1
. Then
Proj
(
C
[
x
,
y
,
z
]
)
is the complex projective plane
P
2
.
The spectrum
Spec
(
Q
[
x
,
y
]
/
(
y
2
−
x
(
x
−
1
)
(
x
−
λ
)
)
)
is the affine scheme corresponding to an affine plane curve. This curve is an elliptic curve with a single point removed.
The previous example can be completed to an elliptic curve in the projective plane. This is done by homogenizing the equation of the curve and taking
Proj
instead of
Spec
. That is, the curve is
Proj
(
Q
[
X
,
Y
,
Z
]
/
(
(
Y
2
Z
−
X
(
X
−
Z
)
(
X
−
λ
Z
)
)
)
.
The quotient of
A
1
∐
A
1
by the equivalence relation
G
m
↪
A
1
∐
A
1
. As rings, the equivalence relation is
Z
[
x
]
×
Z
[
y
]
→
Z
[
t
,
t
−
1
]
, where the homomorphism sends
x
and
y
to
t
. This scheme is a line with two origins. It is not separated over
Spec
Z
, so in particular, it is not affine.
Another example of a non-affine scheme is
A
C
n
∖
{
P
1
,
…
,
P
m
}
, where
{
P
1
,
…
,
P
m
}
is a finite set of points and
m
>
1
. (The restriction on
m
is necessary because
Spec
(
C
[
x
,
(
x
−
P
1
)
−
1
,
…
,
(
x
−
P
m
)
−
1
]
)
is the affine line with
{
P
1
,
…
,
P
m
}
removed.) The cohomology of the structure sheaf may be calculated using Čech cohomology and is non-trivial in degrees
0
and
n
. Since cohomology groups on an affine scheme are trivial outside of degree zero, this scheme is not affine.
Let
k
be a field. Then the scheme
Spec
(
∏
n
=
1
∞
k
)
is an affine scheme whose underlying topological space is the Stone–Čech compactification of the natural numbers (with the discrete topology). In fact, the prime ideals of this ring are in bijective correspondence with the ultrafilters on the natural numbers, with the ideal
∏
{
m
:
m
≠
n
}
k
corresponding to the principal ultrafilter on the natural number
n
. This makes the space zero-dimensional, and in particular, each point of this space is an irreducible component. Since affine schemes are quasi-compact, this is an example of a quasi-compact scheme with infinitely many irreducible components.
Just as the *R*-modules are central in commutative algebra when studying the commutative ring *R*, so are the *O*_{X}-modules central in the study of the scheme *X* with structure sheaf *O*_{X}. (See locally ringed space for a definition of *O*_{X}-modules.) The category of *O*_{X}-modules is abelian. Of particular importance are the coherent sheaves on *X*, which arise from finitely generated (ordinary) modules on the affine parts of *X*. The category of coherent sheaves on *X* is also abelian.

The sections of the structure sheaf *O*_{X} of *X* are called regular functions, which are defined on each open subsets *U* in *X*. The invertible subsheaf of *O*_{X}, denoted *O*^{*}_{X}, consists only of the invertible germs of regular functions under the multiplication. In most situations, the sheaf *K*_{X} is defined on an open affine subset Spec *A* of *X* as the total quotient rings *Q*(*A*) (though there are cases where the definition is more complicated). The sections of *K*_{X} are called *rational functions* on *X*. The invertible subsheaf of *K*_{X} is denoted by *K*^{*}_{X}. The equivalent class of this invertible sheaf turns to be an abelian group with tensor products and isomorphic to *H*^{1}(*X*, *O*^{*}_{X}), which is called Picard group. On projective varieties the sections of the structure sheaf *O*_{X} defined on each open subsets *U* of *X* are also called regular functions though there are no global sections except for constants.

Considered as its functor of points, a scheme is a functor which is a sheaf for the Zariski topology on the category of commutative rings, and which, locally in the Zariski topology, is an affine scheme. This can be weakened in several ways. One is to use the étale topology. An algebraic space may be viewed as a functor which is a sheaf in the étale topology and which, locally in the étale topology, is an affine scheme. Equivalently, these functors arise as the quotient of a scheme by an étale equivalence relation. Algebraic spaces were introduced by Michael Artin to study problems in deformation theory. A powerful result, the Artin representability theorem, gives simple conditions for a functor to be represented by an algebraic space.

A frequently used generalization is the idea of a stack. Grothendieck originally introduced stacks as a tool for the theory of descent. In Grothendieck's original formulation, stacks were (informally speaking) sheaves of categories, whereas schemes were sheaves of sets. This had technical advantages when trying to prove that certain moduli functors, such as the Picard functor, were representable by schemes. The stacks themselves, however, were too general to have much geometric structure of their own. The study of the moduli spaces of algebraic curves led Deligne and Mumford to introduce a restricted class of stacks with a rich geometric structure. These are now called Deligne–Mumford stacks. These may be loosely imagined as schemes where some of the points are allowed to have finite automorphism groups, much like an orbifold. Weaker than a Deligne–Mumford stack is an Artin stack. Here, the automorphism group of a point may be infinite. The Keel–Mori theorem implies that an Artin stack has a coarse moduli space which is an algebraic space. Both Deligne–Mumford and Artin stacks are sometimes referred to as "algebraic stacks."

Another type of generalization is to enrich the structure sheaf. This kind of construction arises in homotopy theory. In this setting, known as derived algebraic geometry or spectral algebraic geometry, the structure sheaf is replaced by a homotopy analog of a sheaf of commutative rings. These sheaves admit algebraic operations which are associative and commutative only up to an equivalence relation. Taking the quotient by this equivalence relation yields the structure sheaf of an ordinary scheme. Not taking the quotient, however, leads to a theory which can remember higher information, in the same way that derived functors in homological algebra yield higher information about operations such as tensor product and
Hom
.