# The universal property of polynomial rings and universal identities

To verify some identity involving say two variables $$x, y \in R$$ for any commutative ring $$R$$ it suffices to verify this identity in $$\mathbb{Z}[x,y]$$. This is just the sort of trick that should be easy to formalise using some category theory and the universal property of polynomial rings. But I'm finding it difficult (mostly because I haven't undertaken serious study of category theory yet). I'm still curious about how one would do it though.

$$\mathbb{Z}[x,y]$$ is the free (commutative, unital) ring on two variables, which means that for any (commutative, unital) ring $$R$$ and any $$a,b\in R$$, there is a unique morphism $$f:\mathbb{Z}[x,y]\to R$$ such that $$f(x) = a, f(y) = b$$. The unicity is true and sometimes important, but for what you want we only need that this map exists.

Well now if you're interested in an identity, say $$p=q$$, and you know $$p(x,y) = q(x,y)$$ holds in $$\mathbb{Z}[x,y]$$ and you want to show that $$p(a,b) = q(a,b)$$ in $$R$$, it's very simple: consider your map $$f$$, and now since $$f$$ is a morphism you get $$p(a,b) = p(f(x),f(y))= f(p(x,y))= f(q(x,y)) = q(f(x),f(y)) = q(a,b)$$.

Now you see that I haven't used anything specific to rings here, I've just used the fact that I had equations and so on; so the right setting for this is universal algebra.

In universal algebra, you have a certain type, $$\tau$$, which is a list of function symbols $$f_i, i\in I$$ together with arities for these symbols, $$n_i, i\in I$$. A $$\tau$$-algebra is then a set $$A$$ together with maps $$f_i^A : A^{n_i}\to A$$ for each $$i\in I$$. You can see rings, groups, monoids, $$R$$-modules and so on as special cases of this.

You can of course define $$\tau$$-algebra morphisms, which are just maps $$g: A\to B$$ such that $$g(f_i^A(x_1,...,x_n)) = f_i^B(g(x_1),...,g(x_n))$$ for all $$x_1,...,x_n\in A$$, and you get a category $$\tau-\mathbf{Alg}$$. I'll call a category of algebras any full subcategory of $$\tau-\mathbf{Alg}$$. If you have a category of algebras $$K$$ you may wonder if it has "free" algebras.

For a category of algebras $$K$$, and a set $$X$$, a free $$K$$-algebra on $$X$$ is an algebra $$A\in K$$ together with a (set) map $$i: X\to A$$ with the following universal property : for any $$j: X\to B$$ where $$B\in K$$, there is a unique algebra morphim $$j^*:A\to B$$ such that $$j^*\circ i = j$$. Some usual category theory (or actually higher level abstract nonsense) shows that if such an algebra exists, it is automatically unique up to isomorphism.

It turns out that if $$K$$ is a nice category of algebras (e.g. a variety, that is, a full subcategory of $$\tau-\mathbf{Alg}$$ whose objects are the algebras that satisfy a certain number of equations of the form $$p=q$$ - equations involving only the function symbols $$\{f_i\}_{i\in I}$$ and formal variables $$\mathbf{x_1,...,x_n}$$), then for any $$X$$ there is a free $$K$$-algebra on $$X$$. This is the case for the category of rings for instance.

Now suppoe you have an equation $$p(\mathbf{x_1,...,x_n}) = q(\mathbf{x_1,...,x_n})$$ in such a nice category of algebras $$K$$, and you want to show that it holds in any object of $$K$$. Well then it suffices to show that it holds in the free algebra on $$\{1,...,n\}$$: it's the exact same proof as the one I presented for rings at the very beginning. It may seem like it's useless because free algebras usually seem more complicated to handle, but for instance $$\mathbb{Z}[x,y]$$ is a very special rings with many nice properties (it's an integral domain so you can embed it in a field, and use linear algebra there, which is very useful for, e.g., properties of the determinant); so it may actually come in handy from time to time.

Now the general scenario for this is the following : when your nice category of algebras $$K$$ has free algebras it essentially means that the forgetful functor $$U: K\to \mathbf{Set}$$ which sends an algebra to its underlying set has a left adjoint $$F: \mathbf{Set}\to K$$ (which sends a set to the free $$K$$-algebra on it); so we may wonder how we can translate what we just said to a more general situation of an adjunction between categories (because they seem to capture the "free-forgetful" situation) $$F\dashv U : \mathcal{A\to B}$$, that is we have a functor $$U: \mathcal{B\to A}$$ and $$F:\mathcal{A\to B}$$ together with a natural transformation $$\eta : \mathrm{Id}_{\mathcal{A}} \implies U\circ F$$, such that for any object $$a$$ in $$\mathcal{A}$$, $$b$$ in $$\mathcal{B}$$ and any arrow $$f: a\to Ub$$, there is a unique arrow $$f^* : Fa \to b$$ such that $$U(f^*)\circ \eta_a = f$$.

This is our situation with $$\mathcal{B}= K, \mathcal{A}= \mathbf{Set}$$, $$U$$ the forgetful functor and $$F$$ the free $$K$$-algebra functor.

How do we think of equations in this more general setting ? Well an equation $$p=q$$ with variables $$\mathbf{x_1,...,x_n}$$ involving the function symbols actually determines a subfunctor of $$U^n$$ : for every $$K$$-algebra $$C$$ we have the set $$\{(c_1,...,c_n)\in C^n \mid p(c_1,...,c_n)=q(c_1,...,c_n)\}$$, which varies functorially with $$C$$. Call this functor $$E$$ (for equation).To say that the equation holds in a given algebra $$C$$ is to say that the inclusion $$E(C)\to U(C)^n$$ is actually surjective, that is here an epimorphism.

So we may wonder : we consider an endofunctor $$T$$ on $$\mathcal{A}$$ (in our situation, $$X\mapsto X^n$$) which will have some nice properties, and a functor $$E$$ with a natural transformation $$E\implies T\circ U$$. We assume that for every object $$a$$ of $$\mathcal{A}$$, $$EFa \to TUFa$$ is an epimorphism. I it then true that for every $$b$$, $$Eb\to TUb$$ is an epimorphism too ?

Actually from the adjunction we may also derive a natural transformation $$\epsilon : FU \implies \mathrm{Id}_\mathcal{B}$$. So given an object $$b$$ we have a commutative square $$\require{AMScd} \begin{CD} EFUb @>{}>> TUFUb;\\ @VVV^{E\epsilon} @VVV^{TU\epsilon} \\ Eb @>{}>> TUb; \end{CD}$$

This implies that if $$TU\epsilon$$ is an epimorphism, then by assumption and because epis compose to give epis, we get an epimorphism $$EFUb \to TUb$$ and thus the map $$Eb\to TUb$$ is an epimorphism too.

In our situation, $$T$$ preserves epimorphisms (since it's just $$X\mapsto X^n$$), and $$U\epsilon$$ is also an epimorphism (easy to check), so indeed we get what we had earlier. However, $$T$$ will not preserve epimorphisms in general and $$U\epsilon$$ won't be an epimorphism either in general so unfortunately the full-blown general result doesn't work : but in many cases, $$T$$ is interesting enough, and $$U\epsilon$$ is an epimorphim and so the whole thing works.

(note, however, that even for some algebras $$U$$ does not preserve epimorphisms and so even if $$\epsilon$$ is an epimorphism -which is always the case for algebras-, it's not enough : for algebras it's really $$U\epsilon$$ that matters and it's the one that is an epimorphism. To give an example where $$U$$ doesn't preserve epimorphisms, consider as algebras the rings, and the inclusion $$\mathbb{Z\to Q}$$ : it is an epimorphism, but $$U$$ of it is not)