The magnification of a thin lens is given by m=f+uf.
Given that the size of the images is equal for two different object positions, the magnitudes of the magnifications must be equal: ∣m1∣=∣m2∣.
For a single lens to produce images of the same size at two different object distances, one image must be real and the other must be virtual.
Let u1=−8 cm and u2=−24 cm.
Then, m1=−m2 (since one is real and one is virtual).
f+u1f=−f+u2f
f−81=−f−241
f−24=−(f−8)
f−24=−f+8
2f=32
f=16 cm.
The focal length of the lens is 16 cm.