Differing definitions of Gibbs free energy and Helmholtz free energy I am trying to understand, to me, the difficult concepts of thermodynamic potentials, and I find their definitions numerous and hard to connect between each other. For instance, here are two definitions according to two different sources I consider quite credible:

Helmholtz free energy and Gibbs free energy according to Hyperphysics
According to Hyperphysics, the Helmholtz free energy is qualitatively described as:

The internal energy U might be thought of as the energy required to create a system in the absence of changes in temperature or volume. But if the system is created in an environment of temperature T, then some of the energy can be obtained by spontaneous heat transfer from the environment to the system. The amount of this spontaneous energy transfer is TS where S is the final entropy of the system. In that case, you don't have to put in as much energy. Note that if a more disordered (higher entropy) final state is created, less work is required to create the system. The Helmholtz free energy is then a measure of the amount of energy you have to put in to create a system once the spontaneous energy transfer to the sytem from the environment is accounted for.

And the Gibbs free energy as:

The internal energy U might be thought of as the energy required to create a system in the absence of changes in temperature or volume. But as discussed in defining enthalpy, an additional amount of work PV must be done if the system is created from a very small volume in order to "create room" for the system. As discussed in defining the Helmholtz free energy, an environment at constant temperature T will contribute an amount TS to the system, reducing the overall investment necessary for creating the system. This net energy contribution for a system created in environment temperature T from a negligible initial volume is the Gibbs free energy.


Helmholtz free energy and Gibbs free energy according to Wikipedia
However, according to Wikipedia, Helmholtz free energy

is a thermodynamic potential that measures the useful work obtainable from a closed thermodynamic system at a constant temperature and volume (isothermal, isochoric). 

While, Gibbs free energy

is a thermodynamic potential that can be used to calculate the maximum of reversible work that may be performed by a thermodynamic system at a constant temperature and pressure (isothermal, isobaric).


I don't see how these two definitions connect with eachother, and my understanding of the two is now lacking. I definitely can see intuitively how Hyperphysics defines the two, but I don't understand the Wikipedia definition. I don't know what is meant by "useful" work other than the remaining energy that can be used after work must be done against ambient pressure to create 'space' for the system, and having a bit of energy in store due to ambient temperature providing some assistance raising it to a desired system temperature, but still, given the definition by Hyperphysics, it seems that the ideas behind enthalpy and Helmholtz free energy combined constitute Gibbs free energy yet according to Wikipedia's description Gibbs free energy and Helmholtz free energy seem like two sides of a coin rather than enthalpy and Helmholtz free energy being one.
Can someone provide an intuitive description of these potentials that can connect the two definitions I've provided? If there's a mathsy possible understanding that might be preferred, as I have more of a maths background. Also, I am unclear as to why these two potentials are so useful and prevalent. I know that a system is at equilibrium when $dG = 0$ which suggests it's an important parameter but I don't have a place for it in my head that's clear for its role in thermodynamics still. And I have less of a clue for Helmholtz free energy.
 A: The fundamental thermodynamic relation is $$ dU = T~dS - p~dV + \sum_i \mu_i ~dn_i. $$ This expresses that the internal energy $U$ of a box is a state function of the entropy $S$ (the number of microscopic configurations that all look the same to us), the volume $V$, and the amounts of different substances $n_i$, sometimes other variables enter in. It literally states that if all of those things do not change $dV=0,dS=0,dn_i=0$, then the internal energy does not change, $dU=0.$ The letter $d$ means “the tiniest change in...”. 
This expression also defines some other things, including the absolute temperature $T$, the absolute pressure $p$, the absolute chemical potentials $\mu_i.$ It says for example to measure the pressure of the system, compress it a little bit reversibly, without any reversible heat exchange (that is what $T ~dS$ is, $\delta Q$), or changing the number of particles: and see how much energy needs to go into the system to do that; divide the tiny change in energy by the tiny change in volume to find the pressure.
While this equation is generally correct, it is not always relevant. It speaks about an isolated box that is not exchanging energy with its surroundings, so has a fixed internal energy. That box is not exchanging particles with its surroundings, or volume: it has very rigid walls.
The real world is not always so kind to us.
So if you keep the walls very strong, but they are good thermal conductors, then you are putting your system in contact with a big environment that has a fixed temperature. And then the internal energy is no longer the right way to think about energy, because the internal energy will change all the time due to energy flowing in or out of the system. It is the right way to think of the overall energy of the environment plus your system, but it's not the right way to think about your system. Instead, we want a measure of energy, that stays the same if the temperature stays the same. We want to trade $dS$ for $dT$. And there is a great way to do that, based on the idea that $$(S+dS)(T+dT)=ST+T~dS+S~dT+dS~dT.$$Arguing that the last term is doubly-tiny and therefore insignificant gives $$d(ST)=S~dT+T~dS,$$
And thus $$d(U -TS)=-S~dT - p~dV + \sum_i \mu_i ~dn_i. $$so this “free energy” $U-TS$ is the right concept of energy to deal with the case when temperature is held constant: you see the work $p~dV$ on the right and the condition $dT=0$ puts all that work into $U-TS,$ even though the compression probably raised the temperature and then heat flowed out of the system into its environment so that $S$ has probably decreased and $U$ has therefore not increased as much as it otherwise would have.
I vaguely recall some difficulty when I was an undergrad in trying to justify the term $TS$ in an absolute sense; I am not sure that “zero total free energy,” has a meaning in quite the way that “zero internal energy” sometimes does: but there is no difficulty at all in this way of justifying it differentially as trying to simplify $dU-T~dS$ in cases where $dT$ is more accessible.
Now that you know this trick, you can also apply it to cases where the volume is not constant, adding $PV,$ or the system can borrow particles from its environment, by subtracting $\mu_i~n_i$. There are a bunch of free energies, and they all involve some combination of these transformations. The important thing is the trick, which is called a Legendre transformation. The different free energies are Legendre transformations with respect to your internal energy variables of state, and they correspond to cases where the system can now share that variable with some environment which is so big that it maintains a constant partial derivative with respect to that variable. It is a useful way to think of the energy of the system without the knock-on effects induced in the internal energy by coupling to these environments, which is precisely the sense in which it is “free” for use.
