The Lens & Mirror Equation โ The Complete Guide
Every camera lens, telescope, microscope, and pair of glasses relies on a single, elegant equation to predict exactly where an image will form. The lens equation (identical in form to the mirror equation) relates the distance to an object, the distance to its resulting image, and the focal length of the lens or mirror producing that image โ a relationship simple enough to compute by hand, yet powerful enough to underlie the design of every optical instrument ever built.
Whether you're focusing a camera, designing a telescope, or understanding why reading glasses help someone see a book clearly, the same underlying mathematics applies โ only the sign conventions and specific values change from one application to another, making this single equation one of the most broadly useful tools in all of applied optics.
What is the Lens/Mirror Equation?
The lens equation, 1/f = 1/v + 1/u, relates three key distances: the object distance (u, how far the object is from the lens or mirror), the image distance (v, how far the resulting image forms), and the focal length (f, an intrinsic property of the lens or mirror describing how strongly it converges or diverges light). Given any two of these three quantities, the third can always be found.
Magnification (m = โv/u) describes how much larger or smaller the image is compared to the object, and whether it's upright or inverted. A positive image distance (v > 0) indicates a real image โ one that light rays actually converge to form, which can be projected onto a screen. A negative image distance indicates a virtual image โ one that appears to come from a location where light rays don't actually meet, like the enlarged, upright image seen through a magnifying glass.
The Formula Explained
This calculator uses the "real-is-positive" sign convention common in physics education: focal length is positive for converging lenses/mirrors (convex lenses, concave mirrors) and negative for diverging ones (concave lenses, convex mirrors); image distance is positive for real images and negative for virtual ones. Different textbooks sometimes use different sign conventions โ always check which convention a given problem or textbook is using before comparing results.
How to Use This Calculator
Select which quantity you're solving for based on the two you know, enter the values with correct signs per the convention above, and the calculator returns the third distance plus magnification and whether the resulting image is real or virtual.
Worked Example โ A Camera Lens
Problem: A converging lens with focal length 10 cm forms an image of an object placed 15 cm away. Find the image distance and magnification.
1/v = 1/f โ 1/u = 1/10 โ 1/15 = 1/30
v = 30 cm (positive โ real image)
m = โv/u = โ30/15 = โ2 (inverted, magnified 2ร)
Common Mistakes
Mixing sign conventions: the single biggest source of error โ always confirm which convention (real-is-positive vs Cartesian) a problem uses before substituting values.
Forgetting the negative sign in magnification: the minus sign in m = โv/u is what correctly indicates image orientation (inverted vs upright) โ dropping it loses this information.
Real-World Applications
Cameras: autofocus systems continuously solve the lens equation to position the lens at the correct distance for a sharp image on the sensor, adjusting in real time as the subject or camera moves.
Corrective eyewear: opticians prescribe lenses of specific focal lengths to shift where the eye's own lens forms an image, correcting near- or far-sightedness.
Telescopes and microscopes: multi-lens optical systems are designed by applying the lens equation sequentially, using each lens's output image as the next lens's object โ a telescope's objective lens forms a real image that the eyepiece then magnifies further, exactly the same principle used in a compound microscope.
Lens Power and Diopters
Opticians and lens manufacturers often describe lenses not by focal length directly but by power, measured in diopters (D), defined as P = 1/f with f in metres. A stronger (higher power) lens has a shorter focal length and bends light more sharply; a weaker lens has a longer focal length and bends light more gently. This is why eyeglass prescriptions are written as diopter values (such as "-2.5 D" for mild short-sightedness) rather than focal lengths directly โ diopter values conveniently add when lenses are combined, since combining two thin lenses in contact simply sums their individual powers: P_total = Pโ + Pโ.
This additive property of diopters is why opticians can precisely fine-tune a prescription by testing different lens combinations, and why multi-element camera lenses and telescopes can be analysed by summing the powers of each individual lens element in the system, rather than solving the full lens equation separately and repeatedly for each surface.
Worked Example 2 โ A Concave Mirror
Problem: A concave mirror with focal length 20 cm forms an image of an object placed 30 cm in front of it. Find the image distance and describe the image.
1/v = 1/f โ 1/u = 1/20 โ 1/30 = 1/60
v = 60 cm (positive โ real image)
m = โv/u = โ60/30 = โ2 (real, inverted, magnified 2ร) โ this is exactly the geometry used in a shaving or makeup mirror when the object (your face) sits inside the focal length rather than beyond it, though that specific case produces a different, virtual result worth exploring separately
Virtual Images and Magnifying Glasses
When an object is placed closer to a converging lens than its focal length (u < f), the lens equation produces a negative image distance โ a virtual image. This is precisely how a magnifying glass works: holding it close to a small object (closer than its focal length) produces an enlarged, upright, virtual image that the eye perceives as if it were located much farther away, behind the lens, even though no light actually converges there. This same virtual-image principle underlies the everyday experience of looking through reading glasses, a jeweller's loupe, or a simple magnifying glass, all of which rely on placing the viewed object within the lens's focal length.
The maximum useful magnification of a simple single-lens magnifier is limited by how short a focal length can practically be manufactured before optical aberrations become severe โ which is precisely why serious magnification (microscopes, high-power loupes) requires multi-lens systems rather than a single, extremely short-focal-length lens.
Converging vs Diverging Lenses and Mirrors
Converging lenses (convex, thicker in the middle) and concave mirrors both have positive focal length in the sign convention used here, and both can form either real or virtual images depending on where the object is placed relative to the focal point. Diverging lenses (concave, thinner in the middle) and convex mirrors both have negative focal length, and โ crucially โ always produce virtual, upright, reduced images regardless of object distance, which is exactly why convex mirrors are used for wide-angle security and vehicle side mirrors: they always show a smaller, non-inverted view over a wider field.
Recognising which category a given optical element falls into โ before even doing any calculation โ is often the fastest way to sanity-check a result: if a diverging lens or convex mirror calculation ever produces a real image, something has gone wrong in the arithmetic or sign convention.
Multi-Lens Systems and Compound Optics
Real optical instruments โ cameras, telescopes, microscopes, binoculars โ almost never use a single lens. Instead, they combine multiple lens elements, each correcting for a specific limitation of the others: reducing chromatic aberration, flattening the image field, or achieving a specific magnification and focal range unattainable with any single lens. These multi-element systems are analysed by applying the lens equation sequentially โ the image formed by the first lens becomes the object for the second lens, and so on down the chain, with each lens's magnification multiplying together to give the overall system magnification.
A compound microscope, for example, uses an objective lens close to the specimen to form a real, magnified intermediate image, which the eyepiece lens (acting as a simple magnifying glass) then further magnifies into a large virtual image for the eye to view โ two lenses working in sequence to achieve magnification far beyond what either could accomplish alone, all governed by the same lens equation applied twice in succession.
Depth of Field and Aperture
While the lens equation predicts exactly where an image forms for a single object distance, real scenes contain objects at many different distances simultaneously โ only one of which can be perfectly in focus at the image plane at any given moment. Depth of field describes the range of object distances that appear acceptably sharp in the resulting image, and it depends heavily on the lens aperture (the effective diameter of the light-admitting opening): a smaller aperture produces a larger depth of field (more of the scene in focus), while a larger aperture produces a shallower depth of field (a more pronounced blur for anything not at the precise focal distance) โ the basis of the deliberately blurred backgrounds prized in portrait photography.
This aperture effect isn't captured by the basic lens equation itself (which treats the lens as an idealised single point), but emerges from a more detailed treatment of how a finite-sized lens aperture allows light rays from slightly out-of-focus points to blur into small circles (called circles of confusion) rather than converging to perfectly sharp points โ an important refinement for anyone working seriously with camera or telescope optics.