Make X the subject of the formula

S= W√a²- x²

s^2 = w^2/(a^2-x^2)

a^2-x^2 = w^2/s^2
x^2 = a^2 - w^2/s^2