The final ingredient in the definition of an affine scheme is the structure sheaf , which we will think of as the sheaf of algebraic functions. For example, in , we expect that on the open set , is an algebraic function. The function will have values at points, but won't be determined by their values at points; instead, they will be determined by their germs. It suffices to describe the structure sheaf as the sheaf of rings on the base of distinguished open sets.
Define to be the localization of ring at the multiplicative sets of all functions that do not vanish outside of ; i.e. those for which or equivalently . This depends only on and not on itself.
If , define the restriction map:
in the obvious way; the latter ring is a further restriction of the former ring. The restriction maps obviously commute, and this is a presheaf on a distinguished base.
The data just described give a sheaf on a distinguished open set, and hence determine a sheaf on the topological space on . The topological space along with the structure sheaf will be called an affine scheme. The notation will henceforth denote the data of the topological space along with the structure sheaf. contains data not just of the sheaf, but also the underlying distinguished base that provides a good way of working with . To prove this, we need to show that base gluability and base identity axioms hold on . Suppose , or equivalently, the ideal generated by is the entire ring . By quasicompactness of , for finite ; i.e. . Suppose we are given such that for all for all ; then we wish to show that . This implies that there is some such that for all such that . Now, , so there are with from which
Hence, we have shown base identity axiom. For the base gluability axiom, we have agreeing on overlaps . Letting , using , our elements are of the form . The fact that and agree on overlap means that for some ,
Taking , we get:
for all . Let for all , and , so . On each , we have a function , and the overlap condition is:
Now implying that , for some . Define . This will be an element of that restricts to each . Indeed, from the overlap condition,
completing the proof.
Suppose is an module. The following construction describes sheaf on a distinguished base. Define to be the localization of at a multiplicative set of all functions that do not vanish on . Define restriction maps in an analogous way to . This defines a sheaf on a distinguished base, and hence on . Hence, this is an module.
Note that is not a localization of at the multiplicative set of functions that do not vanish at any point on . For instance, let be two copies of glued together at their origins, and be a complement of the origins. Then, the function which is on the first copy of is on the second copy of . Let us collect five counterexamples which we will see in more detail later:

The cone over the quadratic surface, and , where .

Two planes meeting at a point.

Affine plane minus the origin, ; its inclusion with ; and with its doubled origin; each with .

Infinite disjoint union of schemes, especially, .

.
Visualizing schems: nilpotents
In the affine scheme , the information about nilpotents is invisible at the level of points. We have the following inclusionreversing bijections:

Maximal ideals of closed points of

Prime ideals of irreducible closed subsets of

Nilradicals of closed subsets of
Our goal now is to figure out how to picture ideals that are not radical. We immediately picture as closed subsets of , . In particular, the map can be shown to be a restriction of to . Similarly, can be thought of as a point at the origin with some "fuzz" remembering information about the first derivative.
can be pictured as a "circular fuzz" around origin remembering first and second derivatives, while can be thought of as a square fuzz around origin that is circumscribed by , and inscribed by . In fact, given two ideals of , should be pictured as the intersection of pictures and in . As another example, consider a polynomial in ; knowing what it is is equivalent to knowing its values on the axis, as well as its firstderivative information around the origin.
Next, consider the intersection of the parabola and the axis:
We interpret this intersection as having multiplicity on the axis.
Definition of schemes
First, define isomorphism of ringed spaces as:

A homeomorphism from to .

An isomorphism of sheaves , considered to be on the same space via . In other words, it is the isomorphism , or equivalently using adjoints, of sheaves on .
We have a correspondence between sets, topologies, and structure sheaves. An affine scheme is a ringed space isomorphic to for some . A scheme is a ringed space such that every point has open neighborhood , and is an affine scheme. The topology on a scheme is the Zariski topology. The isomorphism between two schemes is an isomorphism as ringed spaces. If is an open set, is said to be a function on ; this generalizes in the obvious way to functions on an affine scheme.
From the definition of a structure sheaf on an affine scheme, if is an affine scheme, we can recover its ring where by taking global sections as :
We can recognize as the scheme on : we get the isomorphism . For example, if is a maximal ideal of , .
Given , . Under natural inclusion , the Zariski topology on restricts to that in . Moreover, the structure sheaf on restricts to the structure sheaf on .
We say that is an open subscheme of . If is also an affine scheme, is called affine open subscheme, or simply affine open. For example, is an affine open subscheme.
Open subsets of schemes come with a natural scheme structure. For comparison, closed subschemes on are, informally, a particular kind of scheme structure on closed subsets of . For example, if is an ideal, then endows with a scheme structure, but note that there can be different ideals with the same vanishing set; for example, in .
The stalk of sheaf at point is . A section is determined by its germs meaning that is an inclusion. For example, an module is zero iff all its localizations at prime ideals are zero.
We say that a ringed space is a locally ringed space if all its stalks are local rings. Schemes and manifolds are examples of locally ringed spaces. Taking quotient at the maximal ideal can be interpreted as evaluation at the point. The maximal ideal of a local ring is denoted by and the residue field is denoted by . Functions on an open subset of a locally ringed space have values at each point of . The value of such a function lies in . We say that a function vanishes at point if its value at is . Notice that we can't even make sense of a "function vanishing" on a ringed space in general.
Consider the point of an affine scheme . The residue field is isomorphic to , the fraction field of the quotient. Note that the following diagram commutes:
Consider an example in , in which is a field of characteristic not . Then its value at is . Its value at the generic point on the axis is , which we see by setting . Note that is not algebraically closed, even when is a finitelygenerated algebra.
As another example, consider in . Its value at is . Its value at generic point is , and it vanishes at .
If is an module on scheme , or more generally, a locally ringed space, define the fiber of at a point by:
For example, .
Three examples
We can really work with a structure sheaf, and can compute the ring of sections of open sets that aren't just distinguished open sets of affine schemes.
First example: The plane minus the origin. Our goal here is to show that a distinguished base is something we can work with. Let so that . Let us work with the space of functions in . It is not immediately obvious if this is a distinguished open set. In any case, we can describe the union of two distinguished open sets . We will find functions in by gluing together functions in and . Functions on are, by definition, , and those on are . Notice that injects into its localizations, as it is an integral domain, so it injects onto both and , and both inject into ; indeed . So we are looking for functions on ; i.e. we are interpreting in or in . Clearly, those rational functions with powers in in the denominator and those with powers in in the denominator, are the polynomials. In other words, . Thus we get:
We get no extra functions by removing the origin. Notice how any function on extends over all of . This is an analog of Hartogs's lemma in complex geometry: any holomorphic function defined on the complement of a set of codimension atleast two can be extended to a complex manifold over the missing set. This works in a general algebraic setting: we can extend points in codimension atleast two, not only if they are smooth, but also if they are mildly singular (or normal).
is a scheme but not an affine scheme. Otherwise, , then we can recover by taking global sections:
So if is affine, then . But this bijection between prime ideals in a ring and points in the spectrum of the ring is more constructive than that: given prime ideal , you can recover the point as a generic point of the closed subset cut out by , , and given point , you can recover the ideal as those functions vanishing at , . In particular, the prime ideal should cut out a point of . But on , . In conclusion, is not an affine scheme.
We have now seen two examples of nonaffine schemes: infinite disjoint union of nonempty schemes, and . Before reviewing more examples, let us see how to glue topological spaces together along isomorphic open sets. Given two topological spaces and open subsets , along with the homeomorphism , we can create a new topological space , that we obtain by gluing together along . It is the quotient of the disjoint union by equivalence relation , where the quotient is given by quotient topology. Then are naturally identified with open subsets of , and indeed cover . Now, let us glue schemes together. Let be open subsets, along with a homeomorphism , and isomorphism of structure sheaves ; i.e. an isomorphism of sheaves . Then, we can glue these together to get a single scheme; let be glued together using . Then the structure sheaves can be glued together to get a sheaf of rings. This is indeed a scheme: any point has an the open neighborhood that is an affine scheme.
Now we will look at examples of nonaffine schemes by gluing together . Let . In both examples, we will glue along ; the difference is in how we glue.
Second example: Affine line with doubled origin. Consider the isomorphism via given by . This can be intuitively thought of as an analog of failure of Hausdorffness, although itself is not Hausdorff. We will define separatedness later, which will be the right condition for Hausdorffness. In a separated scheme, the affine base of a Zariski topology is nice: the intersection of two open affine sets will be affine.
Third example: The projective line. Consider isomorphism via the isomorphism given by . The resulting scheme is called the projective line over field , and is denoted by . Traditional point on the line is glued to point on the line assuming , and generic point on the line maps to the generic point on the line, under the isomorphism . If is algebraically closed, we can interpret the closed points of in the following way: the points are where both are nonzero, and is identified with . If , this is identified with on the line, and if , this is identified with on the line.
To prove that is not affine, we compute the ring of global sections. Global sections correspond to sections on and sections on that agree on overlap. Restricting to overlap, we get polynomials in , and in . We want , but the only polynomials that are both polynomials in and are the constants . Thus, if we affine, , and hence, , i.e. one point. But it isn't: it has lots of points. We have proved an analog of an important theorem: the only holomorphic functions on are constants.
We will now define projective space over field , , by gluing open sets, each isomorphic to . We think of points in the projective space as being equivalent upto scalars; is equivalent to . The first patch can be thought of as points where , and the second patch can be thought of as points where . It will be useful, to instead use the notation for and for . Then, the open set will have coordinates . It will be convenient to write this as:
so we have introduced dummy variable which we immediately set to . We glue distinguished open sets of to distinguished open sets of , by identifying these two schemes by describing the identification of rings
via and , which implies that .
The Chinese remainder theorem is embedded in our argument; it can be thought of as a geometric fact. The prime ideals of are , and its stalks are . Nilpotents at can be thought of as a fuzz at in the corresponding picture. The global sections on this scheme are sections on the open sets , and . Indeed, there is a natural isomorphism of rings:
Projective schemes
Schemes that were of interest in classical geometry are projective schemes or open subsets thereof, quasiprojective schemes. There are very few examples of schemes that are not provably quasiprojective. The notion of a projective scheme is a good approximation of the algebrogeometric version of compactness, or properness. Although projective schemes can be obtained by gluing together affine schemes, it can be annoying to keep track of gluing information. Just as there is a rough correspondence between rings and affine schemes, there is also a correspondence between graded rings and projective schemes. can be interpreted as lines through origin in , and subsets as unions of lines thereof, and closed subsets as such unions that are closed. We can picture as being points at infinite distance in , with points at infinity in one direction being associated with points at infinitely in the other direction. To make this precise, let us define the decomposition:
by which we mean that the open subset of is identified with , the points with the last projective coordinate nonzero, and the complementary closed subset with the last coordinate zero.
For example, an equation cutting out a set of points in also cut out a set of points in that will be a closed union of lines. We will call this the affine cone of . This equation will cut out some union of s in , and we will call this the projective cone of . The projective cone is the disjoint union of the affine cone and . For example, the affine cone defined by in can be pictured as a classical cone in . For our construction, we switch coordinates from to .
We informally observe that degree polynomials in variables over a field form a vector space of dimension . It is not true that any two polynomials cut out the same subset of if one is a nonzero multiple of the other; and show this. Instead, two polynomials cut out the same closed subscheme if one is a nonzero multiple of the other.
The construction produces a scheme out of a graded ring. We will now discuss graded rings. A graded ring is , where the subscript is called grading; i.e. it sends to . Clearly is a subring, each is an module, and is an algebra. Suppose that is a graded ring. Those elements of some are called homogenous elements of ; nonzero homogenous elements have an obvious degree. An ideal of is a homogenous ideal if it is generated by homogenous elements. If is a multiplicative subset of containing only homogenous elements, then has a natural structure as a graded ring.
A ring is a graded ring with no elements of negative degree. Henceforth, a graded ring will refer to ring. is assumed to be a graded ring. Fix ring as the base ring. If , we say that is a graded ring over . A key example is or even where is a homogenous ideal with . Here, we take conventional grading on where each has weight . The subset is an ideal, called the irrelevant ideal. If the irrelevant ideal is finitely generated, we say that is a finitely generated graded ring over . If is generated by as an algebra, we say that is generated in degree .
We now define the scheme , where is a graded ring. Let us start with two instructive examples. If , we will recover ; and if , where is homogenous, we construct something cut out in by .
As we did with the spectrum of a ring, we will construct first as a set, then as a topological space, and finally as a ringed space. As in our preliminary discussion, we will glue together wellchosen affine spaces, but we do it by considering all possible affine open sets. Our affine building blocks will be as follows. For each , note that the localization is naturally a graded ring, where . Consider , a zerograded piece of the ring ; the first and third subscripts refer to grading, and the second to localization. Applying this ring to where , we obtain the ring:
The points of are the set of homogenous prime ideals of not containing the irrelevat ideal .
The correspondence of with homogenous prime ideals helps us picture . For example, if with the usual grading, then we picture the homogenous prime ideal first as the subset of ; it is a cone. We picture as the plane at infinity. Thus, we picture this equation as cutting out a conic at infinity in . If is the set of homogenous elements of , define the projective vanishing set to be those homogenous prime ideals containing , but not . Define if is a homogenous element of positive degree, and if is a homogenous ideal contained in . Define , the projective distinguished open set, to be the complement of . Once we define a scheme structure on , we will define to be, not just the open subset, but the open subscheme. As in the affine case, s satisfy the axioms for a closed set in topology, and we call this the Zariski topology on . Many results about Zariski topology in the spectrum of a ring carry over with a little extra work. Clearly by the same immediate argument as in the affine case.
We now redefine the projective space over a ring by . This definition involves no messing gluing or choice of patches. Note that projective coordinates is part of the definition.
We call a scheme that is isomorphic to , where is a finitely generated graded ring over , a projective scheme over , or a projective scheme. A quasiprojective scheme is a quasicompact open subscheme of a projecive scheme.
Consider the example of projectivization of . Let be an dimensional vector space over . Define:
If, for example, is the dual of the vector space with basis associated to , we would have . Then we can define . In this language, can be interpreted as linear functionals on the underlying vector space . We can also describe a natural bijection between the points of and closed points of . This construction respects the affine/projective cone picture.