Here's how to do it:

Spoiler:

It is well known that the solution for SHM with ( when ) is:

with

where is the amplitude of oscillations and .

Now in the first instance when the particle is at let the time be and let so then

and

which after dividing gives us:

.

Similarly in the second instance when the particle is at let the time be and so then

and

which after dividing gives us:

. (Note this is in 2nd quadrant).

Thus (taking into account the quadrants) we have:

so

Hence

.