Codimension of an algebraic subvariety (source code)

= Codimension of an algebraic subvariety
{title2=$\operatorname{codim}_X Y=\dim X-\dim Y$}

= Algebraic codimension
{synonym}

For an irreducible closed subvariety $Y$ of an irreducible variety $X$, its codimension is $\dim X-\dim Y$. In an affine chart it also equals the height of the corresponding <prime ideal>, by the dimension formula for finite-type domains over a field.