we have to transpose the following equation to find p, but I don't quite understand how to come up with the correct answer:

x^2/p^2 + y^2/q^2 = 1

Appreciate help, thanks

That is an ellipse. I do not know why you are interested in its length along the x axis but ok.

x^2/p^2 = (1 - y^2/q^2)

p^2 = x^2/(1 - y^2/q^2)

p = +/- x / (1-y^2/q^2)^.5

note if y = 0 then x = +/- p =the semi axis of the ellipse