Units in a ring of fractions 
Let $R$ be a UFD and $D \subseteq R$ multiplicative set.  What are the units in $D^{-1}R$?

I assume the answer should be $D^{-1}R^{\times}$, but I get stuck:
If $a/b$ is a unit, then there exists $c/d$ so that
$$\frac{a}{b} \cdot \frac{c}{d} = \frac{1}{1} \Longleftrightarrow ac = bd,$$
but I don't see what this tells me.  For example, just because $ac \in D$ doesn't seem to imply anything about $a, c$.
 A: We can assume $0\notin D$, or the ring $D^{-1}R$ would be trivial. Also it's not restrictive to assume $1\in D$.
Let $a/b$ be a unit in $D^{-1}R$. Then there exists $c/d\in D^{-1}R$ such that
$$
\frac{a}{b}\cdot\frac{c}{d}=\frac{1}{1}
$$
so
$$
ac=bd
$$
In particular, $ac\in D$, because $b,d\in D$. Thus $a$ divides an element of $D$.
Conversely, suppose $ac\in D$, for some $c\in R$ and let $b\in D$; then
$$
\frac{a}{b}\cdot\frac{bc}{ac}=\frac{abc}{bac}=\frac{1}{1}
$$
Therefore $a/b$ is a unit in $D^{-1}R$. Note that $(bc)/(ac)\in D^{-1}R$ because $ac\in D$.
So we can summarize the facts above in a proposition. For a subset $X$ of $R$ denote by $\hat{X}$ the set
$$
\hat{X}=\{r\in R:rs\in X\text{ for some }s\in R\}
$$
often called the saturation of $X$.
Proposition. An element $a/b\in D^{-1}R$ $(a\in R, b\in D)$ is invertible if and only if $a\in\hat{D}$.
Since $R$ is a UFD, we can say that $D^{-1}$ is the set of elements whose prime factor decomposition contains only primes appearing in the prime factor decomposition of an element of $D$.

Something should be noted more generally. I'll not assume that $R$ is a domain; when writing $a/b$, the hypothesis that $b\in D$ will be implicit.
If $a/b\in D^{-1}R$ is invertible, then $(a/b)(c/d)=1/1$ for some $c/d\in D^{-1}R$. Thus, for some $z\in D$, we have
$$
acz=bdz
$$
so that $a\in\hat{D}$ (same definition as before), because $bdz\in D$.
Conversely, if $a\in\hat{D}$, so $ac\in D$ for some $c\in R$, we have
$$
\frac{a}{b}\cdot\frac{bc}{ac}=\frac{1}{1}
$$
and $a/b$ is invertible for every $b\in D$.
Thus we see that the hypothesis that $R$ is a domain is completely irrelevant.
The saturation of $D$ is closed under multiplication and it's a good exercise in ring of fractions proving that
$$
D^{-1}R\cong\hat{D}^{-1}R
$$
the isomorphism being the obviously defined one. Note that the saturation of $\hat{D}$ is $\hat{D}$ itself.
So if $D$ is saturated (that is, $\hat{D}=D$), then the set of units of $D^{-1}R$ can be described easily as the set of fractions $a/b$ with $a\in D$.
An important case in which $D$ is saturated is when $D=R\setminus P$, when $P$ is a prime ideal of $R$. The proof is very simple.
A: It is clear that $\dfrac{1}{1} = \dfrac{d}{d}, d \in D$ is the identity element of $D^{-1}R.$ We want to find the units. Let $u \in R$ is  a unit. So there exists $v \in R$ such that $uv = vu = 1.$ Then obviously, $\dfrac{u}{1} \cdot \dfrac{v}{1} = \dfrac{v}{1} \cdot \dfrac{u}{1} = \dfrac{1}{1},$ showing that $\dfrac{u}{1}$ is a unit in $D^{-1}R.$ Also for each $d \in D, \dfrac{1}{d} \cdot \dfrac{d}{1} = \dfrac{d}{1} \cdot \dfrac{1}{d} = \dfrac{1}{1}.$ So, every element of the form $\dfrac{1}{d}$ and $\dfrac{d}{1}$ where $d \in D$ are units. Now suppose $\dfrac{a}{b}$ is a unit in $D^{-1}R.$ Then there exists $\dfrac{c}{d}$ such that $\dfrac{a}{b} \cdot \dfrac{c}{d} = \dfrac{c}{d} \cdot \dfrac{a}{b} = \dfrac{1}{1}.$ So we have, $ac = bd.$ This shows that both $a$ and $c$ must divide an element of $D.$ On the other hand, suppose $0 \neq a \in R$ be such that $a|d,$ for some $d \in D.$ Let $ab = d.$ Then for any $c \in D, \dfrac{a}{c} \cdot \dfrac{bc^2}{cd} = \dfrac{1}{1},$ proving that $\dfrac{a}{c}$ is a unit in $D^{-1}R.$
If $R$ is a UFD, then we can say more. Every element $d \in D$ is either a unit in $R$ of has a unique prime factorization in $R$ (up to units). Let $S$ be the multiplicative subset of $R$ generated be all the primes that occurs in the prime factorization of elements of $D.$ Then it is easy to show that $D^{-1}R \cong S^{-1}R.$ Form above we see that any element of the form $\dfrac{a}{b}, b \in S$ and $a$ divides some element of $S$ is a unit. This shows that $a \in S.$ So the units of $D^{-1}R$ are precisely of the form $\frac{u}{1}$ where $u$ is a unit in $R$ or of the form $\dfrac{a}{b}$ where both $a, b \in S.$
The last conclusion is not true in general, if we don't assume $R$ is a UFD. Let $R := k[x^2, x^3],$ where $k$ is field, i.e. $R$ is the subring of the polynomial ring $k[x]$ consisting of polynomials whose co-efficient of the degree $1$ term is zero. Then it is not a UFD ($x^6 = (x^2)^3 = (x^3)^2$). Let $D = \{1, x^2, x^4, x^6, \cdots \}.$ Then the element $\dfrac{x^3}{1}$ is a unit in $D^{-1}R: \dfrac{x^3}{1} \cdot \dfrac{x^3}{x^6} = \dfrac{1}{1},$ but $x^3 \notin D.$
