Why is factorization in the localization of a UFD actually unique? I was reading Arturo Magidin's answer here, which states that the localization of a UFD over a multiplicative subset not containing $0$ is still a UFD. It makes sense that a factorization into units and irreducibles exists, but I don't see uniqueness.
He says it follows by cross multiplying and using the claims. Ok, I let $a/s\in S^{-1}D$. I can factor it into irreducibles
$$
\frac{a}{s}=\frac{p_1}{s_1}\cdots\frac{p_n}{s_n}=\frac{q_1}{t_1}\cdots\frac{q_m}{t_m}.
$$
If I crossmultiply I get different types of terms all over the place and don't know what to compare?
 A: Remember that the factorization in an UFD is only unique up to multiplication by units.
If you have $a=s\cdot \prod \frac{p_i}{s_i}$, where $\frac{p_i}{s_i}$ are irreducible, then ${p_i}$ must also be irreducible in the localisation, we can assume without loss of generality that they are irreducible in the original ring as well (if necessary putting away their factors from $S$ into $s$), and you have $a\cdot \prod s_i=s\prod p_i$.
Then $p_i$, along with irreducible factors of $s$, factor $a\cdot \prod s_i$ into irreducible terms. Some of them will come from the factorization of $\prod s_i$, and those are units in the localisation anyway (because their product is a unit) and as such don't really matter, similarly the factors coming from $s$, and others come from the factorization of $a$ and those are uniquely determined up to equivalence in the original ring, and even more so in the localisation (as it's easier to be equivalent with more units).
A: It suffices to show primes $\,p\,$ in $D\,$ that do  not map to units in $\,E = S^{-1}D\,$ remain prime in $E.$  
But that is easy to prove. $ $ Suppose $\ \dfrac{p}u {\biggm|} \dfrac{a}s\dfrac{b}t.\ $ Then $\ \dfrac{p}u \dfrac{c}v\, =\, \dfrac{a}s\dfrac{b}t\ \,$ so $\,\ pcst\, =\, abuv$.
Since $\,p\,$ is prime in $D,\,$ we infer $\,p\,$ divides one of $\,a,b,u,v.\,$ But if $\,p\mid u\,$ or $\,p\mid v\,$ in $D\,$ then that remains true in $E\,$ so, being a factor of a unit in $E,\,$ we infer $\,p\,$ is a unit in $E,\,$ contra hypothesis. Thus $\,p\mid a\,$ or $\,p\mid b\,$ in $D,\,$ so also in $E,\,$ so $\,p/u\mid a/s\,$ or $\,p/u\mid b/t,\,$ hence $\,p\,$ remains prime in $E.$ 
