Solution (source code)

= Solution

For a <multiplicatively closed set> $S$ containing one, the <localization of a ring> $S^{-1}R$ consists of fractions $r/s$ with $r\in R,s\in S$, under the equivalence
$$
\boxed{\frac rs=\frac{r'}{s'}\iff\exists u\in S:\ u(rs'-r's)=0.}
$$
The factor $u$ is needed when the <ring> has <zero divisors>. Addition and multiplication are
$$
\frac rs+\frac{r'}{s'}=\frac{rs'+r's}{ss'},\qquad
\frac rs\frac{r'}{s'}=\frac{rr'}{ss'}.
$$
The canonical map sends $r$ to $r/1$ and makes every element of $S$ a <unit>. It is universal with this property: a <ring homomorphism> $\phi:R\to T$ taking $S$ into <units> extends uniquely by $r/s\mapsto\phi(r)\phi(s)^{-1}$. Usually zero is excluded from $S$; if it is included, this construction is the <zero ring>.