# Ring Localization as directed colimit of finitely generated free module

Let $R$ be a commutative ring. By Lazard's Theorem an $R$-module $M$ is flat if and only if it's directed colimit of finitely generated free modules.

Let $S\subseteq R$ be a multiplicative system of $R$. It's well-know that $S^{-1}R$ is a flat $R$-module. By Lazard's theorem, $S^{-1}R$ is then a directed colimit of finitely generated free $R$-modules.

There exists a simple and explicit directed system of finitely generated free $R$-modules with colimit $S^{-1}R$?

Here are some concrete examples that illustrate what is going on. Say $S$ is generated by one element $s$. Then $S^{-1}R$ is just the colimit of the sequence $$R\to R\to R\to R\to\dots$$ where all the maps are multiplication by $s$. Explicitly, for instance, if $R=\mathbb{Z}$ and $s=2$, you get the sequence $$\mathbb{Z}\stackrel{2}{\to}\mathbb{Z}\stackrel{2}{\to}\mathbb{Z}\stackrel{2}{\to}\mathbb{Z}\stackrel{2}{\to}\dots$$ which is isomorphic to the sequence of inclusions $$\mathbb{Z}\to\frac{1}{2}\mathbb{Z}\to\frac{1}{4}\mathbb{Z}\to\frac{1}{8}\mathbb{Z}\to\dots$$ whose colimit is just their union $\mathbb{Z}[1/2]\subset\mathbb{Q}$, which is the localization of $\mathbb{Z}$ with respect to the powers of $2$.

More generally, if $S$ is countable, then you construct $S^{-1}R$ as the colimit of a sequence $$R\to R\to R\to R\to\dots$$ where each map is multiplication by some element of $S$ and each element of $S$ appears infinitely many times in the sequence.

If $S$ is uncountable, you can't just take a sequential colimit, and so things get hairier. The idea is still the same, though: you're just taking a colimit of copies of $R$ where you get to multiply by the elements of $S$ as many times as you like. One way to do this is explained nicely in Mathein Boulomenos's answer. Another way to do it is to take your index set to be the collection of finite multisets of elements of $S$ (that is, finite collections of elements of $S$ where you can repeat the same element multiple times). Each object in the diagram is a copy of $R$, and the morphism $R\to R$ correspond to adding a new element $s$ to your finite multiset is multiplication by $s$. This diagram maps to $S^{-1}R$ by sending the copy of $R$ corresponding to a multiset $F$ to the fractions in $S^{-1}R$ whose denominator is the product of all the elements of $F$.

(In fact, this last construction works even if $S$ is not multiplicatively closed, and gives you the localization with respect to the multiplicatively closed set generated by $S$.)

Consider the following category $C$, $\operatorname{Obj}(C)=S$ and $\operatorname{Hom}_C(s_1,s_2) = \{t \in S \mid ts_1=s_2\}$. Composition $\operatorname{Hom}_C(s_1,s_2) \times \operatorname{Hom}_C(s_2,s_3) \to \operatorname{Hom}_C(s_1,s_3)$ is given by multiplication. This is not quite a directed set, but it's a filtered category. Generally, every colimit over a filtered category may be replaced with a colimit over a directed set, so we can also work with this category.

Let $M$ by any $R$-module.
Define a functor $F: C \to R\textrm{-}\mathbf{Mod}$ where $F(s) = M, \forall s \in \operatorname{Obj}(C)$ and for $t \in \operatorname{Hom}(s_1, s_2)$, we define $F(t): M \to M$ as multiplication with $t$. One checks that this is indeed a functor.
Claim $\underset{s \in C}{\varinjlim}F(s) \cong S^{-1}M$.

For each $s \in C$, we have a map $F(s)=M \to S^{-1}M$, given by $m \mapsto \frac{m}{s}$. One checks that this defines a cocone over $F$, so we get an induced map $\underset{s \in C}{\varinjlim}F(s) \to S^{-1}M$.
$\underset{s \in C}{\varinjlim}F(s)$ may be concretely described as $\displaystyle\coprod_{s \in C} F(s) /\sim$, where the equivalence relation $\sim$ is generated by $m \in F(s) \sim tm \in F(ts)$. First, we show surjectivity, if $\frac{m}{s} \in S^{-1}M$, then this is the image of $m \in F(s)$ under the induced map on $\displaystyle\coprod_{s \in C} F(s) /\sim$.
Now we show injectivity. Suppose $m \in F(s)$ is mapped to $\frac{m}{s}=0$, then $\exists t \in S$ such that $tm=0$, but this means that $m \in F(s) \sim tm=0 \in F(ts)$, so $m$ is already $0$ in the colimit. Thus the induced map $\underset{s \in C}{\varinjlim}F(s) \to S^{-1}M$ is an isomorphism.
The idea behind this construction can be described with the equation $$S^{-1}M = \bigcup_{s \in S} \frac{1}{s}M$$ Where the union may be interpreted as a colimit. But in this formulation, it's not quite clear what happens if $M \mapsto \frac{1}{s}M$ is not injective, that's why I gave the more precise construction above.

Finally, if we take $M$ to be a finitely generated free module, this gives an explicit direct system of finitely generated free modules with colimit $S^{-1}M$.