In Euclidean domains, such as $\mathbb Z$ and $\rm\:F[x],\:$ the gcd is often defined as a common divisor that is "greatest" as measured by the Euclidean valuation, here $\rm\:|n|\:$ and $\rm\:deg\ f(x)\:$ resp. But general integral domains may not come equipped with such structure, so in this more rarified atmosphere one is forced to rely only on the divisibility relation itself to specify the appropriate extremality property. Namely, one employs the following universal dual definitions of LCM and GCD
Definition of LCM $\quad$ If $\quad\rm a,b\mid c \iff [a,b]\mid c \quad$ then $\,\quad\rm [a,b] \;$ is an LCM of $\:\rm a,b$
Definition of GCD $\quad$ If $\quad\rm c\mid a,b \iff c\mid (a,b) \quad$ then $\quad\rm (a,b) \;$ is an GCD of $\:\rm a,b$
Notice $\rm\,(a,b)\mid a,b\,$ by the direction $(\Rightarrow)$ for $\rm\,c=(a,b),\,$ i.e. $\rm\,(a,b)\,$ is a common divisor of $\rm\,a,b.\,$ Conversely direction $(\Leftarrow)$ implies $\rm\,(a,b)\,$ is divisible by every common divisor $\,\rm c\,$ of $\rm\,a,b\,$ therefore $\rm\,(a,b)$ is a "greatest" common divisor in the (partial) order given by divisibility. Similarly, dually, the lcm definition specifies it as a common multiple that is "least" in the divisiility order.
One easily checks that this universal definition is equivalent to the more specific notions employed in Euclidean domains such as $\,\Bbb Z\,$ and $\rm\,F[x].$
Such universal definitions frequently enable one to give slick bidirectional proofs that concisely unify both arrow directions, e.g. consider the following proof of the fundamental lcm $*$ gcd law.
Theorem $\rm\;\; (a,b) = ab/[a,b] \;\;$ if $\;\rm\ [a,b] \;$ exists.
Proof $\ \ \ \rm d\mid (a,b)\iff d\:|\:a,b \iff a,b\:|\:ab/d \iff [a,b]\:|\:ab/d \iff d\:|\:ab/[a,b] $
Many properties of domains are purely multiplicative so can be described in terms of monoid structure. Let R be a domain with fraction field K. Let R* and K* be the
multiplicative groups of units of R and K respectively. Then
G(R), the divisibility group of R, is the factor group K*/R*.
R is a UFD $\iff$ G(R) $\:\rm\cong \mathbb Z^{\:I}\:$ is a sum of copies of $\rm\:\mathbb Z\:.$
R is a gcd-domain $\iff$ G(R) is lattice-ordered (lub{x,y} exists)
R is a valuation domain $\iff$ G(R) is linearly ordered
R is a Riesz domain $\iff$ G(R) is a Riesz group, i.e.
an ordered group satisfying the Riesz interpolation property: if $\rm\:a,b \le c,d\:$ then $\rm\:a,b \le x \le c,d\:$ for some $\rm\:x\:.\:$ A domain $\rm\:R\:$ is Riesz if every element is primal, i.e. $\rm\:A\:|\:BC\ \Rightarrow\ A = bc,\ b\:|\:B,\ c\:|\:C,\:$ for some $\rm b,c\in R.$
For more on divisibility groups see the following surveys:
J.L. Mott. Groups of divisibility: A unifying concept for
integral domains and partially ordered groups, Mathematics
and its Applications, no. 48, 1989, pp. 80-104.
J.L. Mott. The group of divisibility and its applications,
Conference on Commutative Algebra (Univ. Kansas, Lawrence, Kan.,
1972), Springer, Berlin, 1973, pp. 194-208. Lecture Notes in Math.,
Vol. 311. MR 49 #2712
What you are doing in your scheme is exactly factoring out the common prime factors $p_1,...,p_n$ from your two numbers $a,b$ (the numbers on the left side of your scheme). What is left after this factoring process are numbers $A$ and $B$ that do not share any more common primes to factor out (the bottom numbers of your scheme). We have
$$(*)\qquad a=p_1\cdots p_n\cdot A,\qquad b=p_1\cdots p_n\cdot B.$$
Now, note
$$\mathrm{lcm}(a,b)=a\cdot B=b\cdot A$$
because $B$ is exactly the factor missing from $a$ to make it a multiple of $b$ (you see $a\cdot B$ contains the primes $p_i$ and the factor $B$, exactly what $b$ needs). Equivalently for $A$ and $b$. So choose one of these identities $-$ say $a\cdot B$ $-$ and plug in $a$ from $(*)$ to get
$$\mathrm{lcm}(a,b)=a\cdot B=p_1\cdots p_n\cdot A\cdot B,$$
and this is exactly what you learned. The $p_i$ are from the left and the $A$ and $B$ are the numbers from the bottom.
Best Answer
What is going on at the top is finding factors common to all the numbers. The black $2,2,3$ are those. The product of them is the greatest common divisor of all the numbers. Once we get to $4,6,9$ there are no longer any common factors, so the greatest common divisor has been determined. Now we are using the fact that the least common multiple of $an, bn$ is $n\operatorname{lcm}(\frac an, \frac bn)$. We use that until there are no pairs of numbers with a common factor, here $2,1,3$. Finally we use the fact that $\operatorname{lcm}(a,b)=ab$ whenever $a$ and $b$ are coprime.