---
title: "Dimension of Ideals"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/dimension.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/dimension.md"
part: "Commutative Algebra"
chapter: "Polynomial Ring Ideal Operations"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Polynomial Ring Ideal Operations", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/index-polynomial-ring-ideal-operations.md"}
prev: {"title": "Extension and Contraction of Ideals", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/extension-contraction.md"}
next: {"title": "Radical and Decomposition of Ideals", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/radical-decomposition.md"}
intrinsics:
  - {"name": "Dimension", "signature": "Dimension(I): RngMPol -> RngIntElt, [ RngIntElt ]"}
---

<a id="dimension"></a>
<a id="dpoly-ideal-secdim"></a>
# Dimension of Ideals

Let $I$ be an ideal of the polynomial ring $P = K[x_1, \ldots, x_n]$, where $K$ is a field. Let $X$ be the set $\lbrace x_1, \ldots, x_n \rbrace$ of variables of $P$. A subset $U$ of $X$ is called *independent modulo* $I$ if $I \cap K[U] = \emptyset$. A subset $U$ of $X$ is called *maximally independent modulo* $I$ if $U$ is independent modulo $I$, and no proper superset of $U$ is independent modulo $I$. The *dimension* of $I$ is defined to be the maximum of the cardinalities of all the independent sets modulo $I$. It is not too hard to see in this case that this coincides with the more abstract commutative algebra definition of the Krull dimension of the *quotient algebra* $P/I$ as the maximal length of a chain of prime ideals. Note that the definition given above of zero-dimensionality (as the case when the quotient of $P$ by $I$ has finite dimension as a vector space over the coefficient field) coincides with the definition of zero-dimensionality as dimension 0.

<a id="function-dpoly-ideal-dimension"></a>
## `Dimension(I): RngMPol -> RngIntElt, [ RngIntElt ]`

Given an ideal $I$ of a polynomial ring $P$ defined over a field, return the dimension $d$ of $I$, together with a (sorted) sequence $U$ of integers of length $d$ such that the variables of $P$ corresponding to the integers of $U$ constitute a maximally independent set modulo $I$. If $I$ is the full polynomial ring $P$, the dimension is defined to be $-1$, and the second return value is not set. The algorithm implemented is that given in [[BW93](https://docs.magma-maths.org/v2.30-1/references.md#cite-beckerweispfenning), p. 449].
