Algebraic variety

 This article is about algebraic varieties. For varieties of algebras, and an explanation of the difference, see variety (universal algebra).
An affine algebraic variety is essentially the set of common zeroes of a set of polynomials, and is one of the central objects of study in classical (and to some extent, modern) algebraic geometry. Historically, the fundamental theorem of algebra established a link between algebra and geometry by saying that a polynomial in one variable over the complex numbers is determined by the set of its roots, which is an inherently geometric object. Building on this result, Hilbert's Nullstellensatz provides a fundamental correspondence between ideals of polynomial rings and subsets of affine space. Using the Nullstellensatz and related results, we are able to capture the geometric notion of a variety in algebraic terms as well as bring geometry to bear on questions of ring theory.
Contents 
Definition
Let k be a field and let k^n be affine nspace over k. The polynomials f in k[x_{1}, ..., x_{n}] can be viewed as kvalued functions on k^n by evaluating f at the points in k^n. This gives a ring of kvalued functions on k^n called the coordinate ring of k^n. By considering the set of common zeros of a set of functions, each subset S of the coordinate ring determines a subset Z(S) of affine space.
Let I(S) be the ideal of all functions vanishing on the subset S of affine space. The quotient of the polynomial ring by this ideal is the coordinate ring of the affine algebraic variety.
A subset V of k^n is called an affine algebraic set (or simply an algebraic set) if V = Z(S) for some subset S of the coordinate ring. There are a number of close connections between an algebraic set and its corresponding coordinate ring that we will not detail here.
A nonempty affine algebraic set V is called irreducible if it cannot be written as the union of two proper algebraic subsets. An irreducible affine algebraic set is called an affine variety.
Basic results
 An affine algebraic set V is a variety if and only if I(V) is a prime ideal; equivalently, V is a variety if and only if its coordinate ring is an integral domain.
 Every nonempty affine algebraic set may be written uniquely as a union of algebraic varieties (where none of the sets in the decomposition are subsets of each other).
 Let k[V] be the coordinate ring of the variety V. Then the dimension of V is the transcendence degree of the field of fractions of k[V] (which is an integral domain) over k.
Discussion and generalizations
The basic definitions and facts above enable one to do a lot of classical algebraic geometry. To be able to do more  for example, to deal with varieties over fields that are not algebraically closed  some foundational changes are required. The current notion of a variety is considerably more abstract than the one above, though equivalent in the case of varieties over algebraically closed fields. An abstract algebraic variety is a particular kind of scheme; the generalization to schemes on the geometric side enables an extension of the correspondence described above to a wider class of rings. A scheme is a locally ringed space such that every point has a neighbourhood, which, as a locally ringed space, is isomorphic to a spectrum of a ring. Basically, a variety is a scheme whose structure sheaf is a sheaf of Kalgebras with the property that the rings R that occur above are all domains and are all finitely generated Kalgebras, i.e., quotients of polynomial algebras modulo prime ideals.
This definition works over any field K. It allows you to glue affine varieties without worrying whether the resulting object can be put into some projective space. This also leads to problems since one can introduce somewhat pathological objects, e.g. an affine line with zero doubled. These are usually not considered varieties, and we get rid of them by requiring the schemes underlying a variety to be separated. (There is strictly speaking also a third condition, namely, that in the definition above one needs only finitely many affine patches.)
Here are some interesting subclasses of varieties. A projective variety is a variety which admits an embedding into projective space. A complete variety is a variety such that any map from an open subset of a nonsingular curve into it can be extended uniquely to the whole curve. Every projective variety is complete, but not vice versa.
These varieties have been called 'varieties in the sense of Serre', since Serre's foundational paper FAC on sheaf cohomology was written for them. They remain typical objects to start studying in algebraic geometry, even if more general objects are also used in an auxiliary way.
One way that leads to generalisations is to allow reducible algebraic sets (and fields K that aren't algebraically closed), so the rings R may not be integral domains. This is not a big step technically. More serious is to allow nilpotents in the sheaf of rings. A nilpotent in a field must be 0: these if allowed in coordinate rings aren't seen as coordinate functions.
From the categorical point of view, nilpotents must be allowed, in order to have finite limits of varieties. Geometrically this says that fibres of good mappings may have 'infinitesimal' structure. In the theory of schemes of Grothendieck these points are all reconciled: but the general scheme is far from having the immediate geometric content of a variety.
See also
 function field
 dimension of an algebraic variety
 singular point of an algebraic variety
 birational geometry
 scheme
References
 David Cox, John Little, Donal O'Shea, Ideals, Varieties and Algorithms, An Introduction to Computational Algebraic Geometry and Commutative Algebra, (1997), SpringerVerlag ISBN 0387946802.
 David Eisenbud. Commutative Algebra with a View Toward Algebraic Geometry, Springer.
 David Dummit and Richard M. Foote. Abstract Algebra, Wiley.