A small trouble understanding the AMGM inequality usage for some basic minimization problems? I'm reading Byrne's "A first course in optimization". After the presentation and proof of the AMGM inequality, the author gives two examples:
Here's the first:



I guess I understand what was done, it seems he writes in a convenient form with the AMGM inequality:
$$\left(\frac{3\cdot12}{x} \cdot\frac{3\cdot18}{y} \cdot 3\cdot xy\right)^{\frac{1}{3}}\leq \frac{1 }{3} \left( \frac{3\cdot12}{x} +\frac{3\cdot18}{y} + 3\cdot xy\right)$$
Which in turn, yields:
$$\left(3^3\cdot 12 \cdot 18\right)^{\frac{1}{3}}=\left(3^3 2^3 3^3\right)^{\frac{1}{3}}=18\leq \frac{12}{x} +\frac{18}{y} + xy$$
From here, I know that for all possible choices of $x,y$, then $18$ is the smaller value, but I'm not sure on how to find the actual $x,y$. Given that he mentions that the smaller value for $\frac{1}{3} f(x,y)$ is $6$, then I guess he did the following:
$$\frac{1}{3} f(x,y)+\frac{1}{3} f(x,y)+\frac{1}{3} f(x,y) \leq 6+6+6=18$$
$$\overbrace{\left(\frac{4}{x} +\frac{6}{y} + \frac{xy}{3}\right)}^{= \;6}+\overbrace{\left(\frac{4}{x} +\frac{6}{y} + \frac{xy}{3}\right)}^{=\;6}+\overbrace{\left(\frac{4}{x} +\frac{6}{y} + \frac{xy}{3}\right)}^{=\;6}\leq 6+6+6=18$$
$$\overbrace{\left(\frac{4}{x} +\frac{4}{x} + \frac{4}{x}\right)}^{= \;6}+\overbrace{\left(\frac{6}{y} +\frac{6}{y} + \frac{6}{y}\right)}^{= \;6}+\overbrace{\left(\frac{xy}{3} +\frac{xy}{3} + \frac{xy}{3}\right)}^{= \;6}=\frac{12}{x} +\frac{18}{y} + xy\leq 18$$
And it seems that solving each of them individually yields the desired result, I am confused at why reorganizing $3$ sums whose total is $6$ in this way (supposing it is what actually was done) yields exactly the the minimal solution. 

My doubt in the following example may stem from the same doubt I had before:



Here, he talks about a "constant sum" which is perhaps something very similar to what was done before, but I don't understand what is this "constant sum" nor why it is needed, I see that the second centered equation is the same as the first but I don't understand the workings of this "constant sum". I have tried to rewrite the equation in several other ways (on paper) to check if I could uncover something but I couldn't. Could you clarify?

In both cases it was used:
$$a+b+c\ge 3\sqrt[3]{abc},$$
the equality occurs when $a=b=c$.
Example 1:
$$\frac{12}{x}+\frac{18}{y}+xy\ge 3\sqrt[3]{\frac{12}{x}\cdot \frac{18}{y}\cdot xy}=18,$$
$$\frac{12}{x}=\frac{18}{y}=xy \Rightarrow x=2, y=3$$
Example 2:
$$\frac{1}{12}\cdot (3x)(4y)(72-3x-4y)\le \frac{1}{12}\left(\frac{3x+4y+72-3x-4y}{3}\right)^3=1152, $$
$$3x=4y=72-3x-4y \Rightarrow x=8, y=6.$$
