Let $A$ be a commutative ring and $S$ a multiplicative closed subset of $A$. If $A$ is a PID, show that $S^{-1}A$ is a PID.

I've taken an ideal $I$ of $S^{-1}A$ and I've tried to see that is generated by one element; the ideal $I$ has the form $S^{-1}J$ with $J$ an ideal of $A$. $J$ is generated by one element but I can't see why $I$ has to be generated by one element, maybe I'm wrong.


If $I$ is an ideal of $S^{-1}A$, then there exists an ideal $J$ of $A$ such that $I = JS^{-1}A$. Now there exists $r \in A$ such that $J = (r)$. We show that $$ I = (r) $$ where $r$ is now thought of as an element of $S^{-1}A$.

Firstly, if $x \in (r)$, then $x = \frac{a}{b}r$ where $\frac{a}{b} \in S^{-1}A$ and so $x \in JS^{-1}A = I$.

Secondly, if $y \in I = JS^{-1}A$, then $y = nr\frac{a}{b}$, where $nr \in J$ and $\frac{a}{b} \in S^{-1}A$, so $y = n\frac{a}{b}r \in (r)$.


An arbitrary element $x$ of $S^{-1}J$ is of the form $$ x=\sum_is_i^{-1}j_i $$ with $s_i\in S, j_i\in J$ for all $i$. If $j$ is a generator of $J$ as an ideal, then $j_i=a_ij$ for some $a_i\in A$. Can you now write $x$ in the form $x=x'j$ for some $x'\in S^{-1}A$?