Step-by-step explanation:
It is given that,
The object distance from the lens is 10 cm, u = -10 cm
Image is formed at a distance of 40 cm away from the lens, u = 40 cm
The lens formula is :
, v is image distance

The focal length is 8 cm
Magnification,

The magnification is negative, it means that the formed image is inverted.