Localization does not commute canonically with infinite direct products

Ravi's hint is to show that $(1 \ , \ 1/2 \ , \ 1/3 \ , \ \ldots)$ is not in the image of the natural map, so the natural map is not an isomorphism. As user26857 shows though, in this example the vector spaces are actually isomorphic, but not canonically.

It may be more satisfying to see the following example:
Take out ring to be $R=\mathbb{Z},$ $S = \mathbb{Z}\setminus \{ 0\}$ and the modules to be $M_i = \mathbb{Z}/(i) \ , \ i\geq 2.$ Then $S^{-1}M_i=0$ since for all $x\in M_i$ and $s\in S$ we have $$ \frac{x}{s} = \frac{ix}{is} = \frac{0}{is} = \frac01.$$

On the other hand, $S^{-1}\left(\prod_{i\ge2}M_i\right)$ is non-zero. To see this, note that if $\dfrac{(1,1,1,\ldots)}{1} =\dfrac01$ then there exists $s\in S$ such that $s(1,1,1,\ldots)=0.$ But this would mean that every integer $i\geq 2$ divides $s,$ and $s$ must be non-zero so this is impossible.

So we have found an example where localization does not commute with an infinite direct product through any map, not just the natural map.


They are isomorphic as $\mathbb Q$-vector spaces, but not canonically.

Let $B\subset\mathbb Q^{\mathbb N}$ a $\mathbb Q$-basis. Then $|\mathbb Q^{\mathbb N}|=|B||\mathbb Q|$. On the other side, we have $\mathbb Z^{\mathbb N}\subset S^{-1}\mathbb Z^{\mathbb N}\subset\mathbb Q^{\mathbb N}$, so $|\mathbb Z^{\mathbb N}|\le |S^{-1}\mathbb Z^{\mathbb N}|\le|\mathbb Q^{\mathbb N}|$. Since $|\mathbb Z^{\mathbb N}|=|\mathbb Q^{\mathbb N}|$ we get $|S^{-1}\mathbb Z^{\mathbb N}|=|\mathbb Q^{\mathbb N}|$. If $B'\subset S^{-1}\mathbb Z^{\mathbb N}$ is a $\mathbb Q$-basis we have $|S^{-1}\mathbb Z^{\mathbb N}|=|B'||\mathbb Q|$, and therefore $|B|=|B'|$, so $\mathbb Q^{\mathbb N}$ is isomorphic to $S^{-1}\mathbb Z^{\mathbb N}$ as $\mathbb Q$-vector spaces.

The canonical morphism sends $(k_n)_{n\ge 1}/s$ to $(k_n/s)_{n\ge 1}$. If there is such an element which is sent to $(1/n)_{n\ge 1}$, then $k_n/s=1/n$ for all $n\ge 1$, that is, $nk_n=s$ for all $n\ge 1$ (or, if you like, $n\mid s$ for all $n\ge 1$), a contradiction. Thus the canonical morphism is (injective but) not surjective.