A regular local ring is a ring whose maximal ideal needs exactly as many generators as it must. Two things are counted: the Krull dimension, which is the length of chains of prime ideals, and the smallest number of generators of the maximal ideal. The ring is regular when the two agree [1].
Let (R, \mathfrak{m}) be a Noetherian local ring with residue field k = R/\mathfrak{m}. Then R is regular when \dim R = \dim_k \mathfrak{m}/\mathfrak{m}^2. The left side is the Krull dimension and the right side is the dimension of the Zariski cotangent space, whose dual, the Zariski tangent space, plays the part of the tangent space in geometry.
The right side is also called the embedding dimension: the number of variables needed when the ring is written with as few variables as possible. The figure pairs the two counts for several rings. They differ in one direction only: there are always at least as many generators as the dimension, and equality is the best case.
The right side is the smallest number of generators because of Nakayama's lemma. Suppose the images of x_1, \ldots, x_n \in \mathfrak{m} span \mathfrak{m}/\mathfrak{m}^2 over k, so that \mathfrak{m} = (x_1, \ldots, x_n) + \mathfrak{m}^2. Putting M = \mathfrak{m}/(x_1, \ldots, x_n), we get \mathfrak{m} M = M.
Since M is finitely generated, Nakayama's lemma gives M = 0, so x_1, \ldots, x_n generate \mathfrak{m}. Conversely, generators of \mathfrak{m} always span \mathfrak{m}/\mathfrak{m}^2. The smallest number of generators is therefore \dim_k \mathfrak{m}/\mathfrak{m}^2.
Here \mathfrak{m}^2 is the ideal of finite sums of products of two elements of \mathfrak{m}, not the set of squares. A question about generating an ideal has become a question of linear algebra, the dimension of a vector space, and this is the core of the definition. In the figure the equality \mathfrak{m} = (x_1, x_2) + \mathfrak{m}^2 gives \mathfrak{m} = (x_1, x_2) + \mathfrak{m}^3, then (x_1, x_2) + \mathfrak{m}^4, because \mathfrak{m}^2 = \mathfrak{m} \cdot \mathfrak{m}: the part covered by x_1 and x_2 grows one layer at a time, and Nakayama's lemma closes what is left at once.
That the counts can differ in one direction only takes a single theorem. By Krull's height theorem, a prime ideal minimal over an ideal generated by n elements has height at most n [2].
If \mathfrak{m} is generated by n elements, then \mathfrak{m} itself has height at most n. In a local ring \dim R = \operatorname{ht} \mathfrak{m}, so \dim R \leq \dim_k \mathfrak{m}/\mathfrak{m}^2.
Regular means that this inequality is an equality: not a single generator is superfluous. In the figure the plane, a curve through the point and the point itself give the chain (0) \subsetneq \mathfrak{p}_1 \subsetneq \mathfrak{m} of length 2 in k[x, y]_{(x, y)}, and the two generators x and y are just enough.
In a field k we have \mathfrak{m} = (0). A chain of prime ideals has only one term, so \dim k = 0, and \mathfrak{m}/\mathfrak{m}^2 = 0 makes the right side 0 as well: a field is a regular local ring. Fields are the only regular local rings of dimension 0, since \mathfrak{m} = \mathfrak{m}^2 gives \mathfrak{m} = 0 by Nakayama's lemma.
Next take a Noetherian local domain, not a field, whose maximal ideal is principal, \mathfrak{m} = (\pi). One generator is enough, so the embedding dimension is 1, and the dimension is 1 too, because the only prime ideals are (0) \subsetneq (\pi).
So a discrete valuation ring is regular, and conversely a regular local ring of dimension 1 has a principal maximal ideal and is a discrete valuation ring [4]. The standard examples are k[[t]], \mathbb{Z}_{(p)} and \mathbb{Z}_p [1]. In the figure, in \mathbb{Z}_{(3)} with \pi = 3, each integer carries a vertical line as high as its valuation: an element with valuation v reaches the level of (\pi^v) but not that of (\pi^{v+1}).
Let R = k[x_1, \ldots, x_n]_{(x_1, \ldots, x_n)}. The maximal ideal is (x_1, \ldots, x_n), with n generators.
A basis of \mathfrak{m}/\mathfrak{m}^2 is given by the images of x_1, \ldots, x_n: every monomial of degree 2 or more falls into \mathfrak{m}^2, and only the terms of degree 1 remain. The dimension is also n, because the Krull dimension of a polynomial ring equals its number of variables [3].
Both sides are n, so the ring is regular. This is the algebraic form of the fact that every point of affine space is smooth. In the figure the terms of degree 2 or more fade away modulo \mathfrak{m}^2, and only the two coefficients of x and y remain.
The ring k[[x_1, \ldots, x_n]] is also a regular local ring of dimension n, with its maximal ideal generated by the variables. The computation is the same as for polynomials, since the terms of degree 2 or more still fall into \mathfrak{m}^2.
This ring is the model for all the others: a complete Noetherian regular local ring that contains a field is isomorphic to a formal power series ring over its residue field [1]. So for a Noetherian local ring that contains a field, regularity means that after completion \hat{R} \cong k[[x_1, \ldots, x_n]]: nothing is left but the variables.
The circle x^2 + y^2 = 2y in the figure passes through the origin with the linear term -2y. In the completion y becomes a power series in x, y = x^2/2 + x^4/8 + x^6/16 + \cdots, and the truncations follow the circle ever more closely near the origin: the completed local ring is k[[x]].
Regularity can be seen in a picture. In the figure a point stops at several places on the cusp, short lines around it show every direction, and the directions that keep the equation zero to first order are highlighted. At a smooth point only the two along the tangent line are highlighted: the tangent space is a single line, of the same dimension 1 as the curve.
At the tip every direction is highlighted. The tangent space spreads over the whole plane, too large for a curve of dimension 1, and the point is not regular. When the point arrives at the tip, the tangent space jumps from a line to the whole plane.
The cotangent space \mathfrak{m}/\mathfrak{m}^2 is dual to this tangent space. Comparing the two dimensions in the definition is comparing the two sizes in the figure.
Whether a point is regular is decided by whether the defining equation has a term of degree 1. For t \neq 0 the equation y^2 = x^3 + t\, x has the linear term tx, and with f = y^2 - x^3 - tx we get f_x(0, 0) = -t \neq 0, so the origin is smooth.
Only at the moment t = 0 does the linear term disappear. Then no relation links x and y in \mathfrak{m}/\mathfrak{m}^2, and the embedding dimension jumps to 2.
For t \neq 0 the equation gives tx = y^2 - x^3 \in \mathfrak{m}^2, so x vanishes in \mathfrak{m}/\mathfrak{m}^2 and y alone spans it. The term of degree 1 is the only part of an equation that survives in \mathfrak{m}/\mathfrak{m}^2, and whether a relation reaches it decides regularity.
The cusp k[x, y]_{(x, y)}/(y^2 - x^3) has dimension 1. Its equation has only terms of degree 2 or more, so \mathfrak{m}/\mathfrak{m}^2 is spanned by the images of x and y and has dimension 2: the gap is 1. The node k[x, y]_{(x, y)}/(y^2 - x^2 - x^3) also has dimension 1 and embedding dimension 2, so this count alone cannot tell the two apart.
The vertex of the cone, k[x, y, z]_{(x, y, z)}/(xy - z^2), has dimension 2. The equation is quadratic, so \mathfrak{m}/\mathfrak{m}^2 is spanned by x, y and z and has dimension 3, a gap of 1. This ring is an integrally closed domain, and still it is not regular.
In k[x]/(x^2) the only prime ideal is (x), so the dimension is 0, but \mathfrak{m} = (x) and \mathfrak{m}^2 = 0 give embedding dimension 1 [1]. This ring is not even a domain, while regular local rings always are. In the figure the line y = c meets the parabola y = x^2 in two points, and as c goes to 0 they merge into one point that keeps a direction; its ring is k[x]/(x^2). The size of the gap is related to how severe the singularity is, but it does not decide its type: the cusp and the node give the same number.
When R is regular of dimension n, any n elements x_1, \ldots, x_n that generate \mathfrak{m} form a regular system of parameters. They are the local coordinates: an n-dimensional space described by n coordinates, said in the language of algebra.
To find one, choose a basis of \mathfrak{m}/\mathfrak{m}^2, lift it to generators of \mathfrak{m} by Nakayama's lemma, and check that their number equals the dimension. When R is not regular, no choice of n elements is enough, and this is what is meant by saying that coordinates cannot be taken there.
The lift is determined only up to elements of \mathfrak{m}^2, and this freedom is a change of coordinates. In the figure the coordinate x is replaced by x' = x + a y^2: the curves x' = c bend, but the one through the origin stays tangent there to the old line x = 0, because x and x' have the same image in \mathfrak{m}/\mathfrak{m}^2.
Regularity has strong consequences, and the first is that R is a domain. Form the associated graded ring \operatorname{gr}_{\mathfrak{m}}(R) = \bigoplus_{i \geq 0} \mathfrak{m}^i/\mathfrak{m}^{i+1}. When R is regular of dimension n, it is isomorphic to the polynomial ring in n variables over k, which is a domain.
Take nonzero a and b with a \in \mathfrak{m}^i \setminus \mathfrak{m}^{i+1} and b \in \mathfrak{m}^j \setminus \mathfrak{m}^{j+1}. Their images in the graded ring have a nonzero product, so ab \notin \mathfrak{m}^{i+j+1}, and in particular ab \neq 0.
The degrees i and j exist because of Krull's intersection theorem, \bigcap_n \mathfrak{m}^n = 0, and this is where the Noetherian hypothesis is used. In the figure the sizes of a = x + y^2, b = y^2 + x^3 and ab on a small circle of radius \varepsilon around the origin are drawn against \varepsilon on logarithmic scales: the slopes are 1, 2 and 3, the degrees of the lowest parts x, y^2 and xy^2, and the slope of ab is the sum 1 + 2.
An even stronger theorem holds: every regular local ring is a unique factorization domain [1]. This is the theorem of Auslander and Buchsbaum, proved with homological algebra, and the classical uniqueness of prime factorization comes out of the agreement of two dimensions. The converse fails: some unique factorization domains are not regular.
A localization of a regular local ring at a prime ideal is again a regular local ring [1]. This does not follow from the naive definition: localizing at a prime changes both the dimension and the embedding dimension, and nothing in the definition shows why they should stay equal.
The key is Serre's homological characterization: a Noetherian local ring is regular exactly when its global dimension is finite [1]. Finite global dimension survives localization, so regularity does too. In the figure the point is \mathfrak{m} and the curve through it is a prime \mathfrak{p}; the local ring along the curve is regular because the one at the point is.
The rephrasings met so far fit in four lines. The definition says that the dimension equals the embedding dimension; the tangent space says that \dim T_P = \dim R; homology says that \operatorname{gldim} R < \infty; completion says that \hat{R} \cong k[[x_1, \ldots, x_n]], when R contains a field.
The first two say the same thing in the language of geometry and of algebra. The last two bring in other tools, and in exchange they carry stronger conclusions, such as the stability under localization.
Whatever the form, the thing not to confuse is what is being counted: the left side of the definition is the length of a chain, and the right side is the dimension of a vector space.
The geometric word smooth and the word regular do not always mean the same, because the base field is involved. Over a perfect field, a point of an algebra of finite type is smooth exactly when its local ring is regular [5], and algebraically closed fields are perfect, so this is the standard case.
Over a field that is not perfect the agreement breaks: there are varieties that are regular but not smooth, with examples in positive characteristic. Regularity is a property of the ring itself, while smoothness is relative to the base field.
Smoothness is tested with derivatives, as in the figure: the gradient of f = y^2 - x^2 - x^3 along the node vanishes only at the origin, the one point where the local ring is not regular. When working in characteristic p over a field that is not perfect, check which of the two words is in use; over an algebraically closed field the difference never shows.