The differential equation [itex]m\frac{dv}{dt}= -\frac{k}{x^2}[/itex] can't just be "integrated twice" because you don't know x as a function of t.
However, since t does not appear explicitely in the equation, there is a standard "trick" for reducing to a first order equation which can be integrated:
[itex]\frac{dv}{dt}= \frac{dv}{dx}\frac{dx}{dt}[/itex] by the chain rule.
But [itex]\frac{dx}{dt}= v[/itex] so the equation becomes:
[tex]mv\frac{dv}{dx}= -\frac{k}{x^2}[/tex]
That's a "separable" differential equation. We separate it to get
[tex]m v dv= -\frac{kdx}{x^2}[/tex]
and integrate to get
[tex]\frac{1}{2}m v^2= \frac{k}{x}+ C[/tex]
When t=0, v= 0 and x= a so we have [itex]0= \frac{k}{a}+ C[/itex] or [itex]C= -\frac{k}{a}[/itex] which gives
[tex]v^2= \frac{2k}{m}(\frac{1}{x}-\frac{1}{a})[/tex]
[tex]= \frac{2k}{ma}\frac{a-x}{x}[/tex]
Which reduces to
[tex]v= \frac{dx}{dt}= \sqrt\(\frac{2k}{ma}\frac{a-x}{x}\)}[/tex]
or
[tex]\sqrt{\frac{x}{a-x}}dx= \sqrt{\frac{2k}{ma}}dt[/tex]
To integrate that let u= (a-x)1/2 so that du= (1/2)(a-x)-1/2dx and u2= a-x so x= a- u2. The equation becomes
[tex]2\sqrt{a-u^2}du= \sqrt{\frac{2k}{ma}}dt[/tex].
The left hand side is now a fairly standard trigonometric substitution:
Let u= √(a) sin(θ) so that du= √(a) cos(θ)dθ and √(a- u^2) becomes √(a) cos(θ) so the equation, in terms of θ is:
[tex]2a cos^2\theta dx= \sqrt{\frac{2k}{ma}} dt[/tex]
To integrate that, use the trig identity cos2θ= (1/2)(1+ cos(2θ)) so that the equation becomes:
[tex]a(1+ cos(2\theta))d\theta= \sqrt{\frac{2k}{ma}}dt[/tex]
That can be integrated directly to get
[tex]a(\theta+ \frac{1}{2}sin(2\theta)= \sqrt{\frac{2k}{ma}}t+ C[/tex]
When t= 0, x= a so that u= 0 and θ= 0. The equation becomes
a(0+ 0)= 0+ C so C= 0.
When x= 0, [itex]u= \sqrt{a}[/itex] and [itex]\theta= \frac{\pi}{2}[/itex]. Of course, in that case [itex]2\theta= \pi[/itex] so [itex]sin(2\theta)= 0[/itex] and our formula becomes
[tex]\frac{a\pi}{2}= \sqrt{\frac{2k}{ma}}T[/tex]
and
[tex]T= \frac{\pi a}{2}\sqrt{\frac{ma}{2k}}[/tex]
as advertised!
Wow! I hope you teacher had some simpler way of doing that!