Proof (existence and uniqueness of GCD and LCM in UFD)

Let $R$ be a unique factorisation domain, and $a_1, \ldots, a_n \in R$. Let $p_1, \ldots, p_m$ be the list of irreducible factors of the $a_i$'s with no two associate of each other. Then write $$ \begin{align*} a_i = u_i\prod_{j=1}^{m} p_j^{n_{ij}} \end{align*} $$ where $n_{ij} \in \Z_{\geq 0}$ and $u_i$ is a unit.

Take $m_j = \min_i n_{ij}$ and define $$ \begin{align*} d = \prod_{j=1}^{m} p_j^{m_j}. \end{align*} $$ Since $m_{j} \leq n_{ij}$, $d\mid a_i$ for all $i$.

Suppose $d'\mid a_i$ for all $i$. By unique factorisation, $$ \begin{align*} d' = u' \prod_{j=1}^{m} p_j^{t_j} \end{align*} $$ with $t_j \leq n_{ij}$ for all $i,j$ and $u'$ a unit. Therefore $t_j \leq m_j$ and thus $d' \mid d$. Hence $d$ is a greatest common divisor.

Any two GCDs must divide each other, so they must be associates. Therefore GCDs are unique up to associates.

Similar for least common multiples.