In special relativity, the length contraction of an object moving with speed v is given by [tex]L=L_0 \sqrt{1- \frac{v^2}{c^2} } [/tex] where L is the measured length L0 is the proper length v is the speed of the object c is the speed of light
In our problem, the measured length is 30 m while the proper length was 40 m, therefore if we re-arrange the equation we can calculate the speed of the spaceship: [tex]v=c \sqrt{1- (\frac{L}{L_0})^2 }=(3 \cdot 10^8 m/s ) \sqrt{1-( \frac{30m}{40 m} )^2}=1.98 \cdot 10^8 m/s [/tex]