Confusion with Formula for LM317 circuit

I found this more detailed diagram: http://www.globalspec.com/reference/81979/203279/chapter-4-linear-power-supplies

And got abit more confused =(

Can some kind soul explain to me how this circuit works?
As in how are the voltages at the inverting and non-inverting input determined and stuff

Thanks in advance