Gluing schemes

In algebraic geometry, a new scheme (e.g. an algebraic variety) can be obtained by gluing existing schemes through gluing maps.
Statement.
Suppose there is a (possibly infinite) family of schemes formula_1 and for pairs formula_2, there are open subsets formula_3 and isomorphisms formula_4. Now, if the isomorphisms are compatible in the sense: for each formula_5,
then there exists a scheme "X", together with the morphisms formula_10 such that
Examples.
Projective line.
Let formula_16 be two copies of the affine line over a field "k". Let formula_17 be the complement of the origin and formula_18 defined similarly. Let "Z" denote the scheme obtained by gluing formula_19 along the isomorphism formula_20 given by formula_21; we identify formula_22 with the open subsets of "Z". Now, the affine rings formula_23 are both polynomial rings in one variable in such a way
where the two rings are viewed as subrings of the function field formula_26. But this means that formula_27; because, by definition, formula_28 is covered by the two open affine charts whose affine rings are of the above form.
Affine line with doubled origin.
Let formula_29 be as in the above example. But this time let formula_30 denote the scheme obtained by gluing formula_19 along the isomorphism formula_20 given by formula_33. So, geometrically, formula_30 is obtained by identifying two parallel lines except the origin; i.e., it is an affine line with the doubled origin. (It can be shown that "Z" is "not" a separated scheme.) In contrast, if two lines are glued so that origin on the one line corresponds to the (illusionary) point at infinity for the other line; i.e, use the isomrophism formula_21, then the resulting scheme is, at least visually, the projective line formula_28.
Fiber products and pushouts of schemes.
The category of schemes admits both a finite fiber product and a finite pushout; they both are constructed by gluing affine schemes. For affine schemes, fiber products and pushouts correspond to tensor products and fiber squares of algebras.