When the object is at distances u1 and u2 from the optical center of a convex lens, a real and a virtual image of the same magnification are obtained. The focal length of the lens is
Let us say it is a convex lens of focal length f. It can form both real and virtual images.
1/v1 - 1/u1 = 1/f, here v & f are positive and u is negative.
1/v1 + 1/u1 = 1/f --- (1)
=> u1/v1 + 1 = u1/f -- (2)
The virtual image is formed in front of the lens. So v and u1 are negative.
- 1/v2 + 1/u2 = 1/f --- (3)
- u2/v2 + 1 = u2/f --(4)
Magnification = v1/u1 = v2/u2 ---(5)
Add (2) and (4) and use (5) to get: 2 = u1/f + u2/f
=> f = (u1 + u2)/2