# Dimension of an algebraic variety

In mathematics and specifically in algebraic geometry, the dimension of an algebraic variety may be defined in various equivalent ways.
Some of these definitions are of geometric nature, while some other are purely algebraic and rely on commutative algebra. Some are restricted to algebraic varieties while others apply also to any algebraic set. Some are intrinsic, as independent of any embedding of the variety into an affine or projective space, while other are related to such an embedding.

## Dimension of an affine algebraic set

Let K be a field, and L ⊇ K be an algebraically closed extension.
An affine algebraic set V is the set of the common zeros in L$^n$ of the elements of an ideal I in a polynomial ring $R=K[x_{1},\ldots ,x_{n}].$ Let $A=R/I$ be the K-algebra of the polynomial functions over V. The dimension of V is any of the following integers. It does not change if K is enlarged, if L is replaced by another algebraically closed extension of K and if I is replaced by another ideal having the same zeros (that is having the same radical). The dimension is also independent of the choice of coordinates; in other words it does not change if the x$_i$ are replaced by linearly independent linear combinations of them.
The dimension of V is
* The maximal length $d$ of the chains $V_{0}\subset V_{1}\subset \ldots \subset V_{d}$ of distinct nonempty (irreducible) subvarieties of V.
This definition generalizes a property of the dimension of a Euclidean space or a vector space. It is thus probably the definition that gives the easiest intuitive description of the notion.
* The Krull dimension of the coordinate ring A.
This is the transcription of the preceding definition in the language of commutative algebra, the Krull dimension being the maximal length of the chains $p_{0}\subset p_{1}\subset \ldots \subset p_{d}$ of prime ideals of A.
* The maximal Krull dimension of the local rings at the points of V.
This definition shows that the dimension is a local property if $V$ is irreducible. If $V$ is irreducible, it turns out that all the local rings at points of V have the same Krull dimension (see); thus:
* If V is a variety, the Krull dimension of the local ring at any point of V
This rephrases the previous definition into a more geometric language.
* The maximal dimension of the tangent vector spaces at the non singular points of V.
This relates the dimension of a variety to that of a differentiable manifold. More precisely, if V if defined over the reals, then the set of its real regular points, if it is not empty, is a differentiable manifold that has the same dimension as a variety and as a manifold.
* If V is a variety, the dimension of the tangent vector space at any non singular point of V.
This is the algebraic analogue to the fact that a connected manifold has a constant dimension. This can also be deduced from the result stated below the third definition, and the fact that the dimension of the tangent space is equal to the Krull dimension at any non-singular point (see Zariski tangent space).
* The number of hyperplanes or hypersurfaces in general position which are needed to have an intersection with V which is reduced to a nonzero finite number of points.
This definition is not intrinsic as it apply only to algebraic sets that are explicitly embedded in an affine or projective space.
* The maximal length of a regular sequence in the coordinate ring A.
This the algebraic translation of the preceding definition.
* The difference between n and the maximal length of the regular sequences contained in I.
This is the algebraic translation of the fact that the intersection of n – d general hypersurfaces is an algebraic set of dimension d.
* The degree of the Hilbert polynomial of A.
* The degree of the denominator of the Hilbert series of A.
This allows, through a Gröbner basis computation to compute the dimension of the algebraic set defined by a given system of polynomial equations. Moreover, the dimension is not changed if the polynomials of the Gröbner basis are replaced with their leading monomials, and if these leading monomials are replaced with their radical (monomials obtained by removing exponents). So:
* The Krull dimension of the Stanley–Reisner ring $R/J$ where $J$ is the radical of the initial ideal of $I$ for any admissible monomial ordering (the initial ideal of $I$ is the set of all leading monomials of elements of $I$).
* The dimension of the simplicial complex defined by this Stanley–Reisner ring.
* If I is a prime ideal (i.e. V is an algebraic variety), the transcendence degree over K of the field of fractions of A.
This allows to prove easily that the dimension is invariant under birational equivalence.

## Dimension of a projective algebraic set

Let V be a projective algebraic set defined as the set of the common zeros of a homogeneous ideal I in a polynomial ring $R=K[x_{0},x_{1},\ldots ,x_{n}]$ over a field K, and let A=R/I be the graded algebra of the polynomials over V.
All the definitions of the previous section apply, with the change that, when A or I appear explicitly in the definition, the value of the dimension must be reduced by one. For example, the dimension of V is one less than the Krull dimension of A.

## Computation of the dimension

Given a system of polynomial equations over an algebraically closed field $K$, it may be difficult to compute the dimension of the algebraic set that it defines.
Without further information on the system, there is only one practical method, which consists of computing a Gröbner basis and deducing the degree of the denominator of the Hilbert series of the ideal generated by the equations.
The second step, which is usually the fastest, may be accelerated in the following way: Firstly, the Gröbner basis is replaced by the list of its leading monomials (this is already done for the computation of the Hilbert series). Then each monomial like ${x_{1}}^{e_{1}}\cdots {x_{n}}^{e_{n}}$ is replaced by the product of the variables in it: $x_{1}^{\min(e_{1},1)}\cdots x_{n}^{\min(e_{n},1)}.$ Then the dimension is the maximal size of a subset S of the variables, such that none of these products of variables depends only on the variables in S.
This algorithm is implemented in several computer algebra systems. For example in Maple, this is the function Groebner[HilbertDimension], and in Macaulay2, this is the function dim.

## Real dimension

The real dimension of a set of real points, typically a semialgebraic set, is the dimension of its Zariski closure. For a semialgebraic set S, the real dimension is one of the following equal integers:
* The real dimension of $S$ is the dimension of its Zariski closure.
* The real dimension of $S$ is the maximal integer $d$ such that there is a homeomorphism of $[0,1]^{d}$ in $S$.
* The real dimension of $S$ is the maximal integer $d$ such that there is a projection of $S$ over a $d$-dimensional subspace with a non-empty interior.
For an algebraic set defined over the reals (that is defined by polynomials with real coefficients), it may occur that the real dimension of the set of its real points is smaller than its dimension as a semi algebraic set. For example, the algebraic surface of equation $x^{2}+y^{2}+z^{2}=0$ is an algebraic variety of dimension two, which has only one real point (0, 0, 0), and thus has the real dimension zero.
The real dimension is more difficult to compute than the algebraic dimension. For the case of a real hypersurface (that is the set of real solutions of a single polynomial equation), there exists a probabilistic algorithm to compute its real dimension.