Answer: The required length is \(\displaystyle \frac95a\).
Initially particles \(P\) and \(Q\) hang in equilibrium, so the total mass supported by the string is
\(m+4m=5m.\)
Let the initial extension of the string be \(e\). By Hooke's law,
\(\frac{5mg}{a}e=5mg,\)
so
\(e=a.\)
Therefore the initial length of the string is \(a+e=2a\).
After \(Q\) is detached, only \(P\), of mass \(m\), remains. Let \(x\) be the length of the string when the speed of \(P\) is first
\(\sqrt{\frac75ag}.\)
The elastic potential energy in a string with extension \(s\) is
\(\frac{\lambda s^2}{2l}.\)
Here \(\lambda=5mg\) and \(l=a\). Initially the extension is \(a\), so the initial elastic potential energy is
\(\frac{5mg a^2}{2a}.\)
When the length is \(x\), the extension is \(x-a\), so the elastic potential energy is
\(\frac{5mg(x-a)^2}{2a}.\)
The particle has risen a distance \(2a-x\), so its gain in gravitational potential energy is \(mg(2a-x)\). Conservation of energy gives
\(\frac{5mg a^2}{2a} =\frac{5mg(x-a)^2}{2a}+mg(2a-x)+\frac12m\left(\frac75ag\right).\)
Cancel \(mg\) and simplify:
\(\frac52a=\frac{5(x-a)^2}{2a}+2a-x+\frac{7}{10}a.\)
Multiplying by \(10a\),
\(25a^2=25(x-a)^2+20a^2-10ax+7a^2.\)
Expanding and simplifying gives
\(25x^2-60ax+27a^2=0.\)
Hence
\((5x-9a)(5x-3a)=0.\)
The two algebraic roots are \(x=\frac95a\) and \(x=\frac35a\). The value \(\frac35a\) is less than the natural length \(a\), so it is not valid for this stretched-string energy equation. The first time the given speed occurs is therefore
\(x=\frac95a.\)