[proofplan]
We reduce the statement to the positive integers $|a|$ and $|b|$, since signs do not affect the positive [greatest common divisor](/page/Greatest%20Common%20Divisor) or least common multiple. We then write both positive integers using a common list of prime factors and compare exponents. The gcd uses the minimum exponent, the lcm uses the maximum exponent, and the identity follows from $\min(\alpha,\beta)+\max(\alpha,\beta)=\alpha+\beta$ for each prime.
[/proofplan]
[step:Replace the integers by their absolute values]
Define
\begin{align*}
A := |a|, \qquad B := |b|.
\end{align*}
Since $a$ and $b$ are nonzero, $A,B \in \mathbb{N}$. The positive common divisors of $a$ and $b$ are exactly the positive common divisors of $A$ and $B$, and the positive common multiples of $a$ and $b$ are exactly the positive common multiples of $A$ and $B$. Hence
\begin{align*}
\gcd(a,b) = \gcd(A,B)
\end{align*}
and
\begin{align*}
\operatorname{lcm}(a,b) = \operatorname{lcm}(A,B).
\end{align*}
It is therefore enough to prove
\begin{align*}
\gcd(A,B)\operatorname{lcm}(A,B) = AB.
\end{align*}
[/step]
[step:Write both positive integers with respect to one prime list]
By the standard unique prime factorization theorem, choose distinct primes $p_1,\dots,p_r$ containing every prime divisor of $A$ or $B$, and choose exponents $\alpha_i,\beta_i \in \mathbb{Z}_{\ge 0}$ such that
\begin{align*}
A = \prod_{i=1}^r p_i^{\alpha_i}
\end{align*}
and
\begin{align*}
B = \prod_{i=1}^r p_i^{\beta_i}.
\end{align*}
Here $r$ may be $0$ when $A=B=1$, and in that case every product over $i=1,\dots,r$ is interpreted as the empty product $1$. Exponents equal to $0$ are included so that the same prime list works for both $A$ and $B$.
[/step]
[step:Identify the prime exponents of the gcd and the lcm]
By [citetheorem:9894], applied to the above prime factorizations of $A$ and $B$,
\begin{align*}
\gcd(A,B) = \prod_{i=1}^r p_i^{\min(\alpha_i,\beta_i)}.
\end{align*}
We claim that
\begin{align*}
\operatorname{lcm}(A,B) = \prod_{i=1}^r p_i^{\max(\alpha_i,\beta_i)}.
\end{align*}
Indeed, define
\begin{align*}
L := \prod_{i=1}^r p_i^{\max(\alpha_i,\beta_i)}.
\end{align*}
For each $i \in \{1,\dots,r\}$, one has $\alpha_i \le \max(\alpha_i,\beta_i)$ and $\beta_i \le \max(\alpha_i,\beta_i)$, so $A \mid L$ and $B \mid L$. Thus $L$ is a positive common multiple of $A$ and $B$.
Now let $M \in \mathbb{N}$ be any positive common multiple of $A$ and $B$. In the prime factorization of $M$, the exponent of $p_i$ is at least $\alpha_i$ because $A \mid M$, and at least $\beta_i$ because $B \mid M$. Hence it is at least $\max(\alpha_i,\beta_i)$ for every $i$. Therefore $L \mid M$. Since $L$ is a positive common multiple dividing every positive common multiple, it is the least common multiple of $A$ and $B$.
[guided]
We first determine the gcd. The theorem [citetheorem:9894] applies because $A$ and $B$ are positive integers and have been written as products over the same finite list of distinct primes:
\begin{align*}
A = \prod_{i=1}^r p_i^{\alpha_i}
\end{align*}
and
\begin{align*}
B = \prod_{i=1}^r p_i^{\beta_i}.
\end{align*}
If $r=0$, these are empty products, each equal to $1$, which is precisely the case $A=B=1$.
It gives
\begin{align*}
\gcd(A,B) = \prod_{i=1}^r p_i^{\min(\alpha_i,\beta_i)}.
\end{align*}
For the lcm, the relevant exponent must be the larger of the two exponents. Define
\begin{align*}
L := \prod_{i=1}^r p_i^{\max(\alpha_i,\beta_i)}.
\end{align*}
Why is this a common multiple? For each index $i$, the exponent $\max(\alpha_i,\beta_i)$ is at least $\alpha_i$, so the prime-power divisibility test gives $A \mid L$. The same exponent is also at least $\beta_i$, so $B \mid L$. Hence $L$ is a positive common multiple.
Why is it the least one? Let $M \in \mathbb{N}$ be any positive common multiple of $A$ and $B$. Since $A \mid M$, the exponent of $p_i$ in the prime factorization of $M$ is at least $\alpha_i$. Since $B \mid M$, that same exponent is at least $\beta_i$. Therefore it is at least $\max(\alpha_i,\beta_i)$ for each $i$. This means precisely that
\begin{align*}
L \mid M.
\end{align*}
Thus $L$ divides every positive common multiple of $A$ and $B$, and since $L$ itself is a positive common multiple, the definition of the least common multiple gives
\begin{align*}
\operatorname{lcm}(A,B) = L = \prod_{i=1}^r p_i^{\max(\alpha_i,\beta_i)}.
\end{align*}
[/guided]
[/step]
[step:Multiply the exponent formulas prime by prime]
Using the formulas just obtained,
\begin{align*}
\gcd(A,B)\operatorname{lcm}(A,B)
=
\left(\prod_{i=1}^r p_i^{\min(\alpha_i,\beta_i)}\right)
\left(\prod_{i=1}^r p_i^{\max(\alpha_i,\beta_i)}\right).
\end{align*}
Combining powers with the same base gives
\begin{align*}
\gcd(A,B)\operatorname{lcm}(A,B)
=
\prod_{i=1}^r p_i^{\min(\alpha_i,\beta_i)+\max(\alpha_i,\beta_i)}.
\end{align*}
For every pair of integers $\alpha_i,\beta_i \in \mathbb{Z}_{\ge 0}$,
\begin{align*}
\min(\alpha_i,\beta_i)+\max(\alpha_i,\beta_i)=\alpha_i+\beta_i.
\end{align*}
Therefore
\begin{align*}
\gcd(A,B)\operatorname{lcm}(A,B)
=
\prod_{i=1}^r p_i^{\alpha_i+\beta_i}.
\end{align*}
Combining powers again,
\begin{align*}
\prod_{i=1}^r p_i^{\alpha_i+\beta_i}
=
\left(\prod_{i=1}^r p_i^{\alpha_i}\right)
\left(\prod_{i=1}^r p_i^{\beta_i}\right)
=
AB.
\end{align*}
Thus
\begin{align*}
\gcd(A,B)\operatorname{lcm}(A,B)=AB.
\end{align*}
Since $A=|a|$ and $B=|b|$, this is
\begin{align*}
\gcd(a,b)\operatorname{lcm}(a,b)=|a||b|=|ab|.
\end{align*}
This proves the desired identity.
[/step]