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.