We are given two blocks A and B with masses \( m_1 = 10 \) kg and \( m_2 = 5 \) kg on a frictionless table. Block A moves with a velocity \( v_1 = 3 \) m/s towards block B, which is initially at rest (\( v_2 = 0 \) m/s). After the collision, the blocks A and B move together with a common velocity \( v_{cm} \). We can find this common velocity using the principle of conservation of linear momentum:
\[
m_1 v_1 + m_2 v_2 = (m_1 + m_2) v_{cm}
\]
\[
(10 \, \text{kg})(3 \, \text{m/s}) + (5 \, \text{kg})(0 \, \text{m/s}) = (10 \, \text{kg} + 5 \, \text{kg}) v_{cm}
\]
\[
30 \, \text{kg m/s} = (15 \, \text{kg}) v_{cm}
\]
\[
v_{cm} = \frac{30}{15} = 2 \, \text{m/s}
\]
The kinetic energy lost during the inelastic collision is stored as potential energy in the compressed spring. We can use the principle of conservation of energy. The initial kinetic energy of the system is the kinetic energy of block A:
\[
KE_i = \frac{1}{2} m_1 v_1^2 = \frac{1}{2} (10 \, \text{kg}) (3 \, \text{m/s})^2 = \frac{1}{2} (10)(9) = 45 \, \text{J}
\]
The final kinetic energy of the combined mass (\( m_1 + m_2 \)) moving with velocity \( v_{cm} \) is:
\[
KE_f = \frac{1}{2} (m_1 + m_2) v_{cm}^2 = \frac{1}{2} (15 \, \text{kg}) (2 \, \text{m/s})^2 = \frac{1}{2} (15)(4) = 30 \, \text{J}
\]
The loss in kinetic energy is stored as the potential energy in the compressed spring:
\[
PE_{spring} = KE_i - KE_f = 45 \, \text{J} - 30 \, \text{J} = 15 \, \text{J}
\]
The potential energy stored in a compressed spring with spring constant \( k \) and compression \( x \) is given by:
\[
PE_{spring} = \frac{1}{2} k x^2
\]
We are given \( k = 3000 \) N/m. So,
\[
15 = \frac{1}{2} (3000) x^2
\]
\[
15 = 1500 x^2
\]
\[
x^2 = \frac{15}{1500} = \frac{1}{100}
\]
\[
x = \sqrt{\frac{1}{100}} = \frac{1}{10} \, \text{m} = 0.1 \, \text{m}
\]
The compression in the spring is 0.1 m.