Unique factorization of an element in an UFD By definition:


  An integral domain $R$ is a unique factorization domain if the following conditions are satisfied:
  
  
  Every element $a \in R$, $a \neq 0$ that is not a unit can be factored into a product $a = c_1 \cdots c_n$ where $c_1,\dots,c_n \in R$ are irreducible elements.
  If $c_1,\dots,c_n$ and $d_1,\dots,d_m$ are two factorizations of the same element of $R$ into irreducibles, then $n = m$ and $d_j$ can be renumbered so that $c_i$ and $d_i$ are associates.
  


I need to prove that every element $a \in R$, $a \neq 0$ which is not a unit can be written uniquely as:
\begin{equation}
 a = up_1^{e_1} \cdots p_s^{e_s}
\end{equation}
where $u \in R$ is a unit, $p_1,\dots,p_s \in R$ are irreducible elements mutually not associate and $e_1,\dots,e_s \in \mathbb{N} \setminus \{0\}$. I think I need to start with an arbitrary factorization $a = c_1 \cdots c_n$, then use the following result, but honestly I don't know how to put it formally.


  Let $R$ be an integral domain and let $a,b \in R$. If $a$ and $b$ are associate elements, then $a,b \neq 0$ and $a = b \cdot u$ for some unit $u \in R$.
The action you take is identical to the following situation where you consider words that are monomials in several variables: for example $$(\frac{3}{4}x)(5y)(x)(\frac{5}{3}x)(\frac{2}{5}z)(\frac{1}{4}y) $$
First group all associates: $$(\frac{3}{4}x)(x)(\frac{5}{3}x).(5y)(\frac{1}{4}y). (\frac{2}{5}z)$$
Then for each group of accociates extract a unique unit: $$(\frac{3}{4}\frac{5}{3})(x)(x)(x).(5\frac{1}{4})(y)(y).(\frac{2}{5})(z) $$
Then bring all units together and simplify them and exponentiate the rest:
$$ \frac{5}{8}x^3y^2z $$
The action you take is identical to the following situation where you consider words that are monomials in several variables: for example $$(\frac{3}{4}x)(5y)(x)(\frac{5}{3}x)(\frac{2}{5}z)(\frac{1}{4}y) $$
First group all associates: $$(\frac{3}{4}x)(x)(\frac{5}{3}x).(5y)(\frac{1}{4}y). (\frac{2}{5}z)$$
Then for each group of accociates extract a unique unit: $$(\frac{3}{4}\frac{5}{3})(x)(x)(x).(5\frac{1}{4})(y)(y).(\frac{2}{5})(z) $$
Then bring all units together and simplify them and exponentiate the rest:
$$ \frac{5}{8}x^3y^2z $$