Hanging mass from spring/ Setting potential to 0 I'm working a problem from Taylor's Classical Mechanics Book, and it's highlighted a couple issues I never quite wrapped my head around (despite getting good marks in advanced undergrad mechanics and EM).
Here are the questions:

a) Show that a spring obeying Hooke's Law has a corresponding potential energy $U = \frac{1}{2}kx^2$ if we choose $U$ to be zero at the equilibrium position.
b) If this spring is hung vertically with a mass $m$ suspended from the other end and constrained to move only in the vertical direction, find the extension $x_0$ of the new equilibrium position. Show that the total potential (spring plus gravity) has the same form $\frac{1}{2}ky^2$ if we use the coordinate $y$ equal to the displacement measured from the new equilibrium position at $x=x_0$, and redefine our reference point so that $U=0$ at $y=0$.

What I Know
I know that we define the potential of a field as the work done to move an object through the field from a reference point $x_0$ at which we define the potential to be $0$
$U(\vec{r}) = -\int_{\vec{r_0}} ^{\vec{r}}\vec{F}\cdot{d\vec{r}}~~$
What I'm not clear about
What I am not clear on is what we are actually doing mathematically when we "set $U =0$". I've thought of it several different ways and I've never been super clear on which is correct:
1) I've thought about it as an application of the fundamental theorem of calculus
$U(\vec{r}) = -\int_{\vec{r_0}} ^{\vec{r}}\vec{F}\cdot{d\vec{r}} = -[U(\vec{r}) - U(\vec{r_0})]~~$
This last equality is where I'm a little confused (obviously because I just proved that something equals its own additive inverse)
Now, $U(r_0)$ vanishes, because we chose it to be zero.
Edit it has been pointed out that this is faulty because the antiderivative of the force evaluated at a point is not by itself a potential.
2) Alternatively, we change our coordinate system such that we place the origin where $U = 0$. Assuming all potentials depend on position such that the potential is zero when $\vec{r} = 0$, this works nicely, but I don't know if there are exotic potentials that depend on $\vec{r}$ some other way.
My attempt at solutions
1)
If I fix my coordinate axes such that the non-fixed end of the spring lies at the origin ($\vec{r}= 0$), we get that the work done to stretch the spring is:
$\int_0^x \vec{F} \cdot d\vec{r} = -\int_0^x kx'dx' = -\frac{kx'^2}{2}\big|_0 ^ x = -\frac{kx^2}{2}$.
So that works, but I'm not clear if I'm correctly "setting $U$ to zero at the reference point.
2)
Finding the new equilibrium position is simple; I need to know when the force due to gravity is equal to the force of the spring; that is when
$$-kx = mg$$ (defining force positive downwards).
So our new $x_0 = \frac{mg}{k}$
The next part is quite confusing to me; if we set our new zero potential to the new equilibrium position, and then the force on the spring is $mg - ky$, where $y$ is the displacement from this new equilibrium and I'm eliding the fact that these are vectors since we're constrained to 1-D movement. Then the potential for any given displacement is $\int_0^y (mg- ky )dy = mgy -\frac{ky^2}{2}$. But I'm trying to show that the total potential is of the form $-\frac{ky^2}{2}$. What am I missing?
Edit it was pointed out that the force exerted by the spring is actually dependent on its displacement from its resting length. Thus the potential should be $\int_0^y (mg- k(y-\frac{mg}{k})dy = -\frac{ky^2}{2}$
Any clarification on these topics would be greatly appreciated.
 A: Your first question is due to a confusion. The complete integral is equal to the negative PE. If the primitive of the integral will be P(r) then the definite integral on the right hand side will be P(r)-P(ro) and the negative of this is the potential energy. But P(r) and P(ro) are not potential energies by themselves. 
For the second part, consider the fact that the elastic force depends on the distortion of the spring in respect to the non-deformed state. So the elastic force is not given by ky where y is displacement from the new equilibrium.
For the spring without mass attached, the PE will be
$U(x)= -\int_0^xF(x)dx = -\int_0^x kx dx = -\frac{1}{2} kx^2|^x_0=-[\frac{1}{2} kx^2-0]=-\frac{1}{2} kx^2$
This is just a special case of the more general: 
$\Delta U= -\int_{x_1}^{x_2}F(x)dx = -\frac{1}{2} kx^2|^{x_2}_{x_1}=-[\frac{1}{2} kx_2^2- \frac{1}{2} kx_1^2]$
This is the change in PE when the body is moved from 1 to 2. 
A: The energy stored in a spring is the area under an applied external force against extension graph.

When a mass is used to extend a vertical spring you also need to consider the change in the gravitational potential energy of the mass $m$.  

At equilibrium the potential energy of the spring-mass (and Earth) system is $U_{\rm o}=\frac 1 2 k x_{\rm o}^2- mg x_{\rm o}$  
but $mg = k x_{\rm o}$ at the equilibrium position so $U_{\rm o}=-\frac 1 2 k x_{\rm o}^2$
Now extend the spring a further $y$.
$U_{\rm y}=\frac 1 2 k (x_{\rm o}+y)^2- mg (x_{\rm o}+y) =  -\frac 1 2 k x_{\rm o}^2 + \frac 1 2 k y^2$
Changing the zero of potential energy to the equilibrium position requires you to add $\frac 1 2 k x_{\rm o}^2$ to the potential energies found above.
$\Rightarrow U_{\rm new,y} = \frac 1 2 k y^2$
