# Minimal systems of generators for commutative rings

Let $S$ be some base ring (a commutative ring or even just a field), and $R$ a commutative ring containing $S$ which is finitely generated (as an algebra) over $S$. What conditions guarantee that any two minimal systems of generators of $R$ over $S$ have the same size?

I'm especially interested in a geometric picture to explain the situation, and whether it links to other geometrical ideas such as height or the Cohen-Macaulay property.

I'd also like to know what happens for graded rings - for instance, when are the degrees of two minimal systems of homogeneous generators the same (up to permutation)? What's the geometry behind this?

-