Legendre transform How do they obtain this?
$$g(x, y, u) = ux − f(x, y)$$
Is in page 3 after eqn 4.4.
 A: It isn't "obtained". It's a definition of the function $g$ and this definition is useful because it leads to the nice symmetric relationships on the rest of the page 3. They exchange the two Legendre-dual variables.
So the definition of $g$ wasn't really "derived" in any straightforward way. It was a clever guess that Legendre made at some point of his life. To understand the logic of it, one must see where it leads and reverse engineer the process. You must understand why it wouldn't work if you defined $g$ differently, and so on. Around the equation, you must just accept that the definition of $g$ is a "let us try this experiment". You just shouldn't get stuck at this point. You may only appreciate this "experiment" with a delay once you understand its consequences. (Physics and even mathematics is obviously full of such "experiments" whose value is only seen once people investigate its consequences in some detail.)
At the end, the most important reason is that the Leibniz rule for the derivative of the product
$$ (uv)' = u'v + uv' $$
has some symmetry between the two terms on the right hand side which is coming from a symmetry between $u$ and $v$. You may also write
$$ u'v = (uv)' - uv' $$
So whenever $u'v$ appears somewhere, and it does in thermodynamics and other Legendre-style situations, and whenever total derivatives such as $(uv)'$ are "more trivial", it makes sense to subtract $(uv)'$ from the derivative of a variable (and therefore $uv$ from the variable). It removes $u'v$ from the derivative of this variable, for the price that it introduces $-uv'$ instead of the original $u'v$. The resulting expressions are basically "equally complex" as the original ones. They are related by the Legendre transform.
