# Commutative Algebra/Direct products, direct sums and the tensor product
## Direct products and direct sums

Definition 8.1:
Let $M_{\alpha },\alpha \in A$ be modules. The direct product of $M_{\alpha },\alpha \in A$ is the infinite cartesian product
    $\prod _{\alpha \in A}M_{\alpha }$
together with component-wise addition, module operation and thus zero and additive inverses.
Theorem 8.2:
In the category of modules, the direct product constitutes a product.
Proof:
Let ${\mathcal {J}}$ be any index category, that contains one element $j_{\alpha }\in {\mathcal {J}}$ for each $\alpha \in A$, no other elements, and only the identity morphisms. Let $N$ be any other object such that
Definition 8.3:
Let $R$ be a commutative ring, and let $\{M_{\alpha }\}_{\alpha \in A}$ be modules over $R$. The direct sum
    $\bigoplus _{\alpha \in A}M_{\alpha }$
is defined to be the module consisting of tuples $(m_{\alpha })_{\alpha \in A}$ where only finitely many of the $m_{\alpha }$s are nonzero, together with component-wise addition and component-wise module operation.
Lemma 8.4:
Let $M_{\alpha },\alpha \in A$ be modules. Their direct sum is a submodule of the direct product.
Proof:
Both have the same elements and the same operations, and the direct product is a subset that is a module with those operations. Therefore we have a submodule.$\Box$
Lemma 8.5:
For each $\alpha \in A$, there is a canonical morphism
    $M_{\alpha }\to \bigoplus _{\alpha \in A}M_{\alpha }$.
Proof:
    $\iota _{\alpha }:M_{\alpha }\to \bigoplus _{\alpha \in A}M_{\alpha },\iota _{\alpha }(m):=(0,\ldots ,0,\overbrace {m} ^{\alpha {\text{-th place}}},0,\ldots ,0)$.$\Box$
Lemma 8.6:
    $\operatorname {Hom} _{R}\left(\bigoplus _{\alpha \in A}M_{\alpha },N\right)\cong \prod _{\alpha \in A}\operatorname {Hom} _{R}(M_{\alpha },N)$.
Proof:
Consider the morphism
    $\varphi :\operatorname {Hom} _{R}\left(\bigoplus _{\alpha \in A}M_{\alpha },N\right)\to \prod _{\alpha \in A}\operatorname {Hom} _{R}(M_{\alpha },N),f\mapsto (f\circ \iota _{\alpha })_{\alpha \in A}$.
We claim that this is an isomorphism, so we check all points.
1. Well-defined:
Both $\iota _{\alpha }$ and $f$ are morphisms (with suitable domains and images), so $f\circ \iota _{\alpha }$ is as well.
2. Injective:
Assume $(f\circ \iota _{\alpha })_{\alpha \in A}=(g\circ \iota _{\alpha })_{\alpha \in A}$. Then for any $(m_{\alpha })_{\alpha \in A}$ contained in $\bigoplus _{\alpha \in A}M_{\alpha }$ we have
    $f((m_{\alpha })_{\alpha \in A})=\sum _{\alpha \in A}f((0,\ldots ,0,\overbrace {m} ^{\alpha {\text{-th place}}},0,\ldots ,0))=\sum _{\alpha \in A}f\circ \iota _{\alpha }((m_{\alpha })_{\alpha \in A})=\sum _{\alpha \in A}g\circ \iota _{\alpha }((m_{\alpha })_{\alpha \in A})=g((m_{\alpha })_{\alpha \in A})$;
note that the sum is finite, since we are in the direct sum; this is necessary since infinite sums are not defined. Hence $f=g$.
3. Surjective:
Let $(h_{\alpha })_{\alpha \in A}\in \prod _{\alpha \in A}\operatorname {Hom} _{R}(M_{\alpha },N)$. Define
    $f:\bigoplus _{\alpha \in A}M_{\alpha }\to N,f((m_{\alpha })_{\alpha \in A}):=\sum _{\alpha \in A}h_{\alpha }(m_{\alpha })$.
The latter sum is finite because $h_{\alpha }(0)=0$ and all but finitely many $m_{\alpha }$ are nonzero. Thus this is well-defined as a function, and direct computation proves easily that it is $R$-linear. Hence we have a morphism, and further
    $\varphi (f)=(f\circ \iota _{\alpha })_{\alpha \in A}=(h_{\alpha })_{\alpha \in A}$.$\Box$
Theorem 8.7:
direct sum is coproduct in category of modules

## Quotient spaces

To be then used to construct the tensor product.

## The tensor product

Definition 8.8:
Let $R$ be a ring and $M,N$ modules over that ring. Consider the set of all pairs
    $(m,n),m\in M,n\in N$
and endow this with multiplication and addition by formal linear combinations, producing elements such as
    $\sum _{k=1}^{l}r_{k}(m_{k},n_{k})$
where the $r_{k}$ are in $R$. We have obtained the vector space of formal linear combinations (call $V$). Set the subspace
    ${\begin{aligned}S:=\langle \{&(rm,n)-r(m,n),\\&(m,rn)-r(m,n),\\&(m+m',n)-(m,n)-(m',n),\\&(m,n+n')-(m,n)-(m,n')|r\in R,m,m'\in M,n,n'\in N\}\rangle \subseteq V\end{aligned}}$,
the generated subspace. We form the quotient
    $M\otimes N:=V/S$.
This is called the tensor product. To indicate that $M,N$ are $R$-modules, one often writes
    $M\otimes N:=M\otimes _{R}N$.
The following theorem shows that the tensor product has something to do with bilinear maps:
Theorem 8.9:
Let $M,N,K$ be $R$-modules and let $f:M\times N\to K$ be $R$-bilinear. Then there exists a unique morphism $g:M\otimes N\to K$ such that the following diagram commutes:
Proof:
Let $f:M\times N\to K$ be any $R$-bilinear map. Define
    $g\left(\left[\sum _{j=1}^{l}r_{j}(m_{j},n_{j})\right]\right):=\sum _{j=1}^{l}r_{j}f(m_{j},n_{j})$,
where the square brackets indicate the equivalence class.
Once we proved that this is well-defined, the linearity of $g$ easily follows. We thus have to show that $g$ maps equivalent vectors to the same element, which after subtracting the right hand side follows from $g$ mapping $S$ to zero.
Indeed, let
    $\sum _{j=1}^{l}r_{j}s_{j}\in S$,
where all $s_{j}$ are one of the four types of generators of $S$. By distinguishing cases, one obtains that each type of generator of $S$ is mapped to zero by $f$ because of bilinearity. Well-definedness follows, and linearity is clear from the definition and since addition and module operation interchange with equivalence class formation.$\Box$
Note that from a category theory perspective, this theorem 8.9 states that for any two modules $M,N$ over the same ring, the arrow
    $M\times N{\overset {\otimes }{\rightarrow }}M\otimes N$
is a universal arrow. Hence, we call the result of theorem 8.9 the universal property of the tensor product.
Lemma 8.10:
Let $R$ be a ring and $M$ be an $R$-module. Recall that using canonical operations, $R$ is an $R$-module over itself. We have
    $R\otimes _{R}M\cong M$.
Proof:
Define the morphism
    $R\times M\to M,(r,m)\to rm$,
extend it to all formal linear combinations via summation
    $\sum _{k=1}^{l}s_{k}(r_{k},m_{k})\mapsto \sum _{k=1}^{l}s_{k}r_{k}m_{k}$
and then observe that
    $\varphi :R\otimes _{R}M\to M,\varphi \left(\left[\sum _{k=1}^{l}s_{k}(r_{k},m_{k})\right]\right):=\sum _{k=1}^{l}s_{k}r_{k}m_{k}$
is well-defined; again, by subtracting the right hand side, it's enough to show that $S$ is mapped to zero, and this is again done by consideration of each of the four generating types.
This is a morphism as shown by direct computation (using the rules for the module operation), it is clearly surjective (map $[(1,m)]$) and it is injective because if
    $\sum _{k=1}^{l}s_{k}r_{k}m_{k}=\sum _{j=1}^{r}s_{j}'r_{j}'m_{j}'$, then
    $\left[\sum _{k=1}^{l}s_{k}r_{k}m_{k}-\sum _{j=1}^{r}s_{j}'r_{j}'m_{j}'\right]=0$
since $0\in S$.$\Box$
Lemma 8.11:
Let $M,N,K$ be $R$-modules. Then
    $M\otimes (N\otimes K)\cong (M\otimes N)\otimes K$.
Proof:
For $m\in M$ fixed, define the bilinear function
    $f_{m}:N\times K\to (M\otimes N)\otimes K,f_{m}((n,k)):=[([m,n],k)]$.
Applying theorem 8.9 yields
    $g_{m}:N\otimes K\to (M\otimes N)\otimes K$
such that $g_{m}([(n,k)])=[([(m,n)],k)]$. Then define
    $F:M\times (N\otimes K)\to (M\otimes N)\otimes K,F\left(m,\left[\sum _{j=1}^{l}r_{j}(n_{j},k_{j})\right]\right):=g_{m}\left(\left[\sum _{j=1}^{l}r_{j}(n_{j},k_{j})\right]\right)$.
This function is bilinear (linearity in $m$ from
    $[([(m+\lambda m',n)],k)]=[([(m,n)+\lambda (m',n)],k)]=[([(m,n)]+\lambda [(m',n)],k)]=\cdots =[([(m,n)],k)]+\lambda [([(m',n)],k)]$)
and thus theorem 8.9 yields a morphism
    $G:M\otimes (N\otimes K)\to (M\otimes N)\otimes K$
such that
    $G([(m,[(n,k)])])=F(m,[(n,k)])=g_{m}([(n,k)])=[([(m,n)],k)]$.
An analogous process yields a morphism
    $H:(M\otimes N)\otimes K\to M\otimes (N\otimes K)$
such that
    $H([([(m,n)],k)])=[(m,[(n,k)])]$.
Since addition within tensor products commutes with equivalence class formation, $G$ and $H$ are inverses.$\Box$
Lemma 8.12:
Let $N_{\alpha },\alpha \in A$ be $R$-modules, let $M$ be an $R$-module. Then
    $M\otimes \left(\bigoplus _{\alpha \in A}N_{\alpha }\right)\cong \bigoplus _{\alpha \in A}(M\otimes N_{\alpha })$.
Proof:
We define
    $f:M\times \left(\bigoplus _{\alpha \in A}N_{\alpha }\right)\to \bigoplus _{\alpha \in A}(M\otimes N_{\alpha }),(m,(n_{\alpha })_{\alpha \in A})\mapsto \left([(m,n_{\alpha })]\right)_{\alpha \in A}$.
This is bilinear (since formation of equivalence classes commutes with summation and module operation), and hence theorem 8.9 yields a morphism
    $g:M\otimes \left(\bigoplus _{\alpha \in A}N_{\alpha }\right)\to \bigoplus _{\alpha \in A}(M\otimes N_{\alpha })$
such that
    $g([(m,(n_{\alpha })_{\alpha \in A})])=\left([(m,n_{\alpha })]\right)_{\alpha \in A}$.
This is obviously surjective. It is injective because
    ${\begin{aligned}&g\left(\left[\sum _{j=1}^{l}r_{j}(m_{j},(n_{\alpha }^{j})_{\alpha \in A})\right]\right)=g\left(\left[\sum _{q=1}^{p}s_{q}(x_{q},(y_{\alpha }^{q})_{\alpha \in A})\right]\right)\\\Leftrightarrow &\left(\left[\sum _{j=1}^{l}r_{j}(m_{j},n_{\alpha }^{j})\right]\right)_{\alpha \in A}=\left(\left[\sum _{q=1}^{p}s_{q}(x_{q},y_{\alpha }^{q})\right]\right)_{\alpha \in A}\end{aligned}}$
by the linearity of $g$ and component-wise addition in the direct sum, and equality for the direct sum is component-wise. We split the argument up into sums where only one component of the right direct sum matters, and observe equality since we divide out isomorphic spaces.$\Box$
Lemma 8.13:
$M\otimes N\cong N\otimes M$.
Proof:
Linear extension of
    $[(m,n)]\mapsto [(n,m)]$
defines a morphism which is well-defined due to symmetry, linear by definition and bijective because of the obvious inverse.$\Box$
We have proven:
Theorem 8.14:
Let $R$ be a fixed ring. The set of all $R$-modules forms a commutative semiring, where the addition is given by $\oplus$ (direct sum), the multiplication by $\otimes$ (tensor product), the zero by the trivial module and the unit by $R$.
Note that we have more: From lemma 8.12 even infinite direct sums (uncountably many, as many as you like, ...) distribute over the tensor product. Incidentally, only finite direct sums are identical to the direct product. This may give hints for an infinite distributive law for infinitesimals.
Theorem 8.15 ("tensor-hom adjunction"):
Let $M,N,K$ be $R$-modules. Then
    $\operatorname {Hom} (M\otimes N,K)\cong \operatorname {Hom} (M,\operatorname {Hom} (N,K))$.
Proof:
Set
    $\varphi :\operatorname {Hom} (M\otimes N,K)\to \operatorname {Hom} (M,\operatorname {Hom} (N,K)),\varphi (f)(m)=n\mapsto f([(m,n)])$.
Due to the equalities holding for elements of the tensor product and the linearity of $f$, this is well-defined. Further, we obviously have linearity in $f$ since function addition and module operation are defined point-wise.
Further set
    $\psi :\operatorname {Hom} (M,\operatorname {Hom} (N,K))\to \operatorname {Hom} (M\times N,K),\psi (g)(m,n)=g(m)(n)$.
By theorem 8.9 and thinking outside the box, we get a map
    $\theta :\operatorname {Hom} (M,\operatorname {Hom} (N,K))\to \operatorname {Hom} (M\otimes N,K)$
such that
    $\theta (g)([(m,n)])=g(m)(n)$.
Then $\theta$ and $\varphi$ are inverse morphisms, since $f:M\otimes N\to K$ is determined by what it does on elements of the form $[(m,n)]$.$\Box$
Theorem 8.16:
Let $M,N$ be $R$-modules isomorphic to each other (via $\theta :M\to N$), and let $K$ be any other $R$-module. Then
    $M\otimes K\cong N\otimes K$
via an isomorphism
    $\varphi :M\otimes K\to N\otimes K$
such that
    $\varphi ([(m,k)])=[(\theta (m),k)]$
for all $m\in M$, $k\in K$.
Proof:
The map
    $\phi :M\times K\to N\otimes K,\phi (m,k)=\theta (m)\otimes k$
is bilinear, and hence induces a map
    $\varphi :M\otimes K\to N\otimes K$
such that
    $\varphi ([(m,k)])=[(\theta (m),k)]$.
Similarly, the map
    $\phi _{-1}N\times K\to M\otimes K,\phi (n,k)=\theta ^{-1}(n)\otimes k$
induces a map
    $\varphi ^{-1}:N\otimes K\to M\otimes K$
such that
    $\varphi ^{-1}([(n,k)])=[(\theta ^{-1}(n),k)]$.
These maps are obviously inverse on elements of the type $m\otimes k$, $n\otimes k$, and by their linearity and since addition and equivalence classes commute, they are inverse to each other.$\Box$