# Filtered colimit of integral domains is an integral domain

I am having trouble solving the following problem.

Let $$\mathcal B$$ be a small filtered subcategory of the category of commutative $$k$$-algebras, and suppose that all objects in $$\mathcal B$$ are integral domains. Show that the colimit of this inclusion diagram is an integral domain.

I think I can show that, if $$L$$ is the colimit of this diagram with maps $$\psi_B:B\to L$$ for all $$B\in\operatorname{ob}(\mathcal B)$$, then $$L\cong\cup_{B\in\operatorname{ob}(\mathcal B)} \operatorname{Im}(\psi_B)$$. Now I suppose that $$ab=0$$ in $$L$$, then there exists $$x\in B_1$$ and $$y\in B_2$$ in $$\mathcal B$$ such that $$\psi_{B_1}(x)=a$$ and $$\psi_{B_2}(y)=b$$. Then, using the filtered condition, we get maps to a common object $$B$$ in $$\mathcal B$$ so $$x\mapsto x'\in B$$ and $$y\mapsto y'\in B$$. Now we have $$\psi_B(x')=\psi_{B_1}(x)$$ and $$\psi_B(y')=\psi_{B_2}(y)$$, so $$0=ab=\psi_B(x')\psi_B(y')=\psi_B(x'y')$$.

Now I am stuck, because I don't know that $$x'y'=0$$ in $$B$$. If I did, then I could use that $$B$$ is an integral domain to get the $$x'=0$$ or $$y'=0$$, and if $$x'=0$$ then $$a=0$$ and if $$y'=0$$ then $$b=0$$.

Any help on where I am stuck would be appreciated, or if anyone has an alternative solution then I would also like to see that.

First, it will be useful to describe the colimit a little more precisely. We have $$L = \coprod_{B \in \operatorname{Ob}(\mathcal{B})} B / \sim,$$ where the equivalence relation $$\sim$$ is defined as follows. For $$a \in B_1$$, $$b \in B_2$$ we have $$a \sim b$$ when there are maps $$B_1 \xrightarrow{f} B \xleftarrow{g} B_2$$ in $$\mathcal{B}$$ such that $$f(a) = g(b)$$. The coprojections $$\psi_B: B \to L$$ are then given by taking the equivalence class of an element.
This has the nice property that whenever we have finitely many elements in $$a_1, \ldots, a_n \in L$$, there are $$a_1', \ldots, a_n' \in B$$ for some $$B$$ in $$\mathcal{B}$$, such that $$a_i = [a_i']$$ for all $$1 \leq i \leq n$$ (this is because $$\mathcal{B}$$ is filtered). Here $$[a_i']$$ denotes the equivalence class of $$a_i'$$.
Then operations on $$L$$ are defined as follows. For $$a, b \in L$$, let $$a', b'$$ be representatives in some $$B$$. Then we define $$ab = [a'b']$$, and similar for other operations. Because the maps in the diagram are homomorphisms and the diagram is filtered, this is well-defined.
Now to answer your question: let $$a,b \in L$$ such that $$ab = 0$$. Then there are $$a', b', z$$ in some $$B$$ such that $$a = [a'], b = [b'], 0 = [z]$$ and $$[a'b'] = [z]$$, because of how operations are defined on $$L$$. Denote by $$0_B \in B$$ the zero in $$B$$, then $$[0_B] = 0 = [z] = [a'b']$$. So using the definition of $$\sim$$ and filteredness of $$\mathcal{B}$$ we find $$f: B \to B'$$ in $$\mathcal{B}$$ such that $$f(a')f(b') = f(a'b') = f(z) = f(0_B) = 0_{B'}.$$ So because $$B'$$ is an integral domain, we see that either $$f(a') = 0_{B'}$$ or $$f(b') = 0_{B'}$$. That means that either $$[f(a')] = [0_{B'}] = 0$$ or $$[f(b')] = [0_{B'}] = 0$$, and so we conclude that $$L$$ is an integral domain.