Crytek's famous "A bit more deferred" presentation gives the following equations for storing view-space normals in two components:

Storing:

Code :
G=normalize(N.xy)*sqrt(N.z*0.5+0.5)

Reconstructing:

Code :
N.z=length2(G.xy)*2-1
N.xy=normalize(G.xy)*sqrt(1-N.z*N.z)

But they never say how this was derived, why it works, where it came from, etc.

Any ideas?