Localization of an UFD that is a PID

Let $R$ be an UFD and $r\in R$ irreducible. If $S=R-(r)$, why is $S^{-1}R$ a PID?

I've finished proving the integral domain part, which was pretty easy.

How to prove it's principal? consider $R \subset S^{-1}R \subset F$, where $F$ is the field of fractions of $R$?

thank you! :p

-

Every element of $S^{-1}R$ is of the form $ur^n$, where $u$ is a unit. It follows that every ideal is of the form $(r^n)$ for some $n\geq 0$.

Edit to fill in this answer some:

First of all, why is every element of $S^{-1}R$ of the form $ur^n$, where $u$ is a unit and $n\geq 0$? An element of $S^{-1}R$ is of the form $a/b$, where $r\nmid b$. The factorization of $a$ has some power of $r$ in it, so $a = r^nc$ for some $n\geq 0$, where $r\nmid c$. Thus $a/b = ur^n$, where $u = c/b$ is a unit in $S^{-1}R$.

Now let $I$ be any ideal in $S^{-1}R$. Let $m = \min\{n : ur^n\in I, u$ a unit$\}$. I claim that $I = (r^m)$. By our choice of $m$, there is at least one element of the form $ur^m$ in $I$, with $u$ a unit. Thus $I\supseteq (ur^m) = (r^m)$. On the other hand, any element of $I$ is of the form $ur^n$ where $n\geq m$. Since $r^m\mid ur^n$, one has $ur^n\in (r^m)$. This proves $I\subseteq (r^m)$. We conclude $I = (r^m)$.

-
hmmm......why $ur^n$? –  treasure Dec 31 '12 at 3:23
@treasure: What does a factorization in $R$ look like? –  Hurkyl Dec 31 '12 at 3:27
It would be nice if you explain how it follows that $(r^n)$ are the only ideals of $S^{-1}R$. –  user26857 Dec 31 '12 at 11:30
@Hurkyl: {r/s:r in R, s in S}. but S in just a multiplicative set.....any further hints? –  treasure Dec 31 '12 at 14:28
@treasure: I've edited my answer to provide further details. –  froggie Dec 31 '12 at 15:05