How to construct polynomial ring $K[x]$ over commutative ring $K$ by making use of universal arrows. In CWM of Mac Lane I encounter: 

the construction of a polynomial ring
  $K\left[x\right]$ in an indeterminate $x$ over a commutative ring
  $K$ is a universal construction.

Unfortunately this as an exercise (on pg 59) and I don't manage to
solve it. Can someone help me with this?
 A: This might be a bit abstract, but I thought it might be useful to see how the polynomial algebra functor is related to various other constructions you come across in algebra, such as the tensor algebra and symmetric algebra.
The polynomial algebra of a commutative ring $K$ is a special case of the "free commutative $K$-algebra functor" $K[-]: \mathsf{Sets} \to K\mathsf{ComAlg}$ whose right adjoint is the obvious forgetful functor. In particular, the polynomial algebra on one indeterminate, $K[x]$, is just the free commutative $K$-algebra on the set $\{x\}$ with one element. 
There are several equivalent ways of constructing the free commutative algebra, as shown in the diagram below, where every square and triangle is commutative when you compose adjoints with the correct handedness (left with left; right with right). As long as you start in the bottom right corner and compose left adjoints until you get to the top left, no matter which way you go you will get the free commutative algebra functor.

Since the free $K$-module functor $K(-): \mathsf{Sets} \to K\mathsf{Mod}$ is strong monoidal, (i.e. $K(X \times Y) \cong K(X) \otimes_K K(Y)$) it sends monoids in $\mathsf{Sets}$ to monoids ($K$-algebras!) in $K\mathsf{Mod}$. The induced functor
$$K(-): \mathsf{Mon} \to \mathsf{Mon}(K\mathsf{Mod})=K\mathsf{Alg}$$ is the monoid algebra functor. It obviously sends commutative monoids to commutative monoids in $K\mathsf{Mod}$ (commutative $K$-algebras), and hence also restricts to a functor
$$K(-): \mathsf{ComMon} \to \mathsf{ComMon}(K\mathsf{Mod})=K\mathsf{ComAlg}.$$
The functors denoted $\mathrm{ab}$ are abelianization functors, which take a monoid object and make the free commutative monoid object.
The functor $\mathcal{T}: K\mathsf{Mod} \to K\mathsf{Alg}$ is the tensor algebra functor, and the functor $\mathrm{Sym}: K\mathsf{Mod} \to K\mathsf{ComAlg}$ is the symmetric algebra functor.
The functor $\mathrm{Lib}: \mathsf{Sets} \to \mathsf{Mon}$ is the free monoid functor on a set. The word "libre" is the French word for "free".
A: It seems to me that there are (at least) two universal properties which one might cite, because the polynomial ring construction is "functorial in both arguments". 
To see this, first let $U\colon \mathbf{CRing}\to \mathbf{Set}$ be the forgetful functor. There's a functor $$\operatorname{Poly}\colon \mathbf{CRing}\times\mathbf{Set}\to(1_{\mathbf{Set}} \downarrow U)$$ 
(by $(1_{\mathbf{Set}} \downarrow U)$ I mean the comma category) defined by
$$
(K,X)\mapsto (X,\,X\xrightarrow{\iota_{K,X}} U(K[X]),\,K[X])$$ 
(where $\iota_{K,X}$ is a fixed embedding of $X$ into $K[X]$) for any (unital) commutative ring $K$ and any set $X$ and
$$
\left(K\xrightarrow{\varphi} L, X\xrightarrow{f} Y\right)\mapsto 
\left(X\xrightarrow{f} Y,\,K[X]\xrightarrow{\operatorname{Poly}(\varphi,f)}L[Y]\right)
$$
for any ring homomorphism $\varphi$ and any function $f$ as above, where $\operatorname{Poly}(\varphi,f):K[X]\to L[Y]$ is the unique ring homomorphism from $K[X]$ to $L[Y]$ such that $\operatorname{Poly}(\varphi,f)(c) = \varphi(c)$ for $c\in K$ and $\operatorname{Poly}(\varphi,f)(\iota_{K,X}(x)) = \iota_{L,Y}(f(x))$ for $x\in X$. Note that for any such pair $(\varphi,f)$, the square
$\require{AMScd}$
\begin{CD}
X      @>\iota_{K,X}>>U(K[X])\\
@VfVV                @VV\operatorname{Poly}(\varphi,f)V\\
Y      @>\iota_{L,Y}>>U(L[Y])\\
\end{CD}
commutes by definition, so $\operatorname{Poly}$ really is a functor into the comma category (preservation of composition and identity are easy to verify).
If we fix the ring $K$, we get a functor $K[\cdot]\colon\mathbf{Set}\to K\mathbf{Alg}$, left adjoint to the forgetful functor $K\mathbf{Alg}\to\mathbf{Set}$, as in the previous answers.
On the other hand, if we fix the set $X$, we get a functor $F\colon \mathbf{CRing}\to (X \downarrow U)$ given by
$$
K\mapsto (X\xrightarrow{\iota_{X,K}}U(K[X]), \, K[X])
$$
and
$$
\left(K\xrightarrow{\varphi}L\right)\mapsto \left(K[X]\xrightarrow{\tilde{\varphi}} L[X]\right),
$$
where $\tilde{\varphi}\colon K[X]\to L[X]$ is the unique ring homomorphism from $K[X]$ to $L[X]$ with $\tilde{\varphi}(c) = \varphi(c)$ for $c\in K$ and $\tilde{\varphi}(\iota_{K,X}(x)) = \iota_{L,X}(x)$.
The category $(X \downarrow U)$ has as objects distinguished mappings of $X$ into commutative rings, and as morphisms the ring homomorphisms which preserve the respective distinguished mappings of $X$; in a sense, $(X \downarrow U)$ is a precise way of generalizing the category of pointed rings to a category of rings with multiple distinguished elements.  If I'm not mistaken, the functor $F$ is left adjoint to the forgetful functor $G$ from $( X \downarrow U)$ to $\mathbf{CRing}$, and $K\hookrightarrow K[X]$ is a universal arrow to the functor $G$.
In the case when $|X| = 1$, this turns into the statement that the functor $K\mapsto (K[x],x)$ is left-adjoint to the forgetful functor from pointed commutative rings to commutative rings, which aligns (pleasantly?) with the intuition that the adjoining an indeterminate $x$ to a ring is the most general way of picking a "distinguished element".
A: The universal property of the polynomial ring $K[x]$ is that 
$$\hom_K(K[x], R) \simeq |R|,$$
where $\hom$ is taken in the category of $K$-algebras, and $|R|$ is the underlying set of $R$. The bijection is determined by looking at the image of the free variable $x$. In other words, a free variable is free to go where it wants. 
Another way to say this is that $K[x]$ represents the forgetful functor from $K$-algebras to sets. 
In MacLane's language, the element $x \in |K[x]|$ is the "universal element" for the forgetful functor.
A: Strictly speaking, the question in the title differs from the quote in Mac Lane's book. It is stronger. So let me explain how to construct $K[x]$ using category theory.
Consider the forgetful functor $U : K\mathsf{Alg} \to \mathsf{Set}$. I claim that $U$ has a left adjoint, i.e. that for every set $X$ the free $K$-algebra $K[X]$ on $X$  exists. We use the general adjoint functor theorem. Clearly $K\mathsf{Alg}$ is complete and $U$ is continuous, this just comes from the usual construction of limits of $K$-algebras. For the solution set condition, let $X \to U(A)$ be a map. Let $B$ be the subalgebra of $A$ generated by the image of $X$. Then every element of $B$ is a $K$-linear combination of elements of the form $x_1^{\alpha_1} \cdot \dotsc \cdot x_n^{\alpha_n}$. Cardinal arithmetic tells us that $B$ has at most $\aleph_0 \cdot |K| \cdot |X|$ elements. This does not depend on $A$, and there is only set of such algebras up to isomorphism. QED
This argument carries over from $K\mathsf{Alg}$ to any variety. For example it produces free modules, free Lie algebras, and so on.
When you go through the details of the proof above, you also get a construction of $K[X]$: Take the solution set of all $B$ discussed above, and take their product. Then $K[X]$ is the equalizer of all endomorphisms of this product. Of course this construction is not useful at all. One needs the explicit structure of the elements of $K[X]$. Actually this can be derived from the universal property:
Let $B$ be the subalgebra of $K[X]$ generated by the image of $X$. Then $X \to U(B)$ extends to $K[X] \to B$, and $K[X] \to B \to K[X]$ is the identity, since this is the case on $X$. Thus, $B \to K[X]$ is surjective, i.e. $K[X]$ is generated by the image of $X$. Thus, every element can be written as $\sum_\alpha \lambda_\alpha x^{\alpha}$; here $\alpha$ is a multiindex, and $x^{\alpha}$ is the product of all $x^{\alpha_x}$. I claim that this representation is unique. For simplicitly let us assume $X=\{x\}$, i.e. that we have just one variable, and $\sum_n \lambda_n x^n = 0$. By the universal property there is a homomorphism $K[x] \to K$ mapping $x \mapsto 0$. Applying this to the equation, we get $\lambda_0=0$. It follows $x \cdot \sum_{n \geq 1} \lambda_n x^{n-1} = 0$. So we only have to prove that $x$ is regular. I don't have a proof for this, yet (which doesn't just use the explicit construction of $K[x]$).
A: See S. Lang, Algebra,  1st edition (1965), Chapter V, Section 2, Theorem 1.
