Newton's law of gravitation states that the acceleration of an object at a distance $r$ from the centre of an object of mass $M$ is given by $$\frac{d^2r}{dt^2}=-\frac{GM}{r^2},$$ where $G$ is the universal gravitational constant.
(a) Use the identity $$\frac{d^2r}{dt^2}=\frac{d}{dr}\left(\frac12v^2\right),$$ combined with integration with respect to $r$. Determine the resulting constant of integration using the condition $u=v(R)$ and show that $$v^2-u^2=\frac{2GM}{r}-\frac{2GM}{R}$$ (b) Now write $r=R+s$ where $s$ is the height of the object above the surface of the Earth, radius $R$ and mass $M$. Use the binomial series to expand the factor $(1+s/R)^{-1}$ to show that, close to the surface of the Earth, $$v^2\approx u^2-2gs,$$ for some constant $g$. Find the expression for $g$.
Reminder: The binomial series is $(1+x)^{-1}=1-x+x^2-x^3+\cdots$, which converges for $|x|\lt 1$.
(In case it is unclear, I am assuming that $G$ and $M$ are constants, and $v$ is purely a function of $r$, since that's what the question appears to mean.)
So far I have done the following:
I equated the two expressions for $\frac{d^2r}{dt^2}$ (which I'm not sure is correct, since if two functions have the same derivative, they may differ by a constant, so if their second derivatives are equal then I feel as though there should be two constants, but I haven't included any constants), then integrated both sides with respect to $r$.
$$\int \frac{d}{dr} \left(\frac12v^2\right) dr = -GM \int \frac{1}{r^2} dr$$ $$\implies\frac12v^2=\frac{GM}{r}+C$$ $$\implies v^2=\frac{2GM}{r}+C$$ $$\implies v=\sqrt{\frac{2GM}{r}+C}$$ $$u=v(R)=\sqrt{\frac{2GM}{R}+C}$$ $$\implies u^2=\frac{2GM}{R}+C$$ Since the constants are the same, they cancel when subtracted. $$v^2-u^2=\frac{2GM}{r}-\frac{2GM}{R}$$ I'm doubtful if this method is correct because of the problem with the constants I referred to before, and also because I couldn't "determine the resulting constant of integration using the condition $u=v(R)$" as the question asked, rather I just cancelled the constants with subtraction. Is equating the two expressions for $\frac{d^2r}{dt^2}$ allowed?
As for part (b), I think I need the constant of integration from (a) to get the full expression for $v^2$, which I do not know how to find.