The lens equation, written 1/f = 1/do + 1/di, relates the focal length of a thin lens or spherical mirror to the object distance and the image distance. Rearranged, it locates an image from any two known quantities: a positive image distance means a real image, a negative one means a virtual image.
Hold a magnifying glass over this page and the letters swell. Lift it away slowly and something odd happens — the text blurs, then flips upside down. Nothing about the glass changed. Only the distance did.
That flip is not a quirk. It is one equation crossing zero, and the same equation tells a phone camera where to put your face, a projector where to throw a film, and an optician which lens will fix your vision.
What Is the Lens Equation?
The lens equation is the formula that links an optical element’s focal length to where an object sits and where its image forms. Give it any two of those three distances and it hands you the third.
Its real power is that it does not care what the element is. A glass lens bends light by refraction; a curved mirror bends it by reflection. Two completely different physical mechanisms — and one identical piece of algebra.
That is why physicists usually call it the lens and mirror equation, or the thin-lens equation when a lens is specifically meant. The name changes; the maths does not.

The three quantities in the lens equation, drawn to scale for a converging lens with the object beyond twice the focal length.
Real images and virtual images
A real image is one that light actually reaches. Put a screen there and a picture appears — that is a cinema, a camera sensor, the retina at the back of your eye.
A virtual image is where the light only appears to come from. Your brain traces the outgoing rays backwards and places an image behind the glass. Put a screen there and you get nothing at all.
The lens equation tells you which one you have, and it tells you with a single minus sign.
The Lens Equation Formula
The equation in its standard form is short enough to memorise in one reading.
Two companion formulas travel with it and you will need both. The first gives image size, the second converts a mirror’s curvature into a focal length.
| Symbol | Quantity | SI unit | Sign rule |
|---|---|---|---|
| f | Focal length | metre (m) | Positive if converging, negative if diverging |
| do | Object distance | metre (m) | Positive for any real object |
| di | Image distance | metre (m) | Positive if real, negative if virtual |
| m | Magnification | dimensionless | Positive if upright, negative if inverted |
| ho, hi | Object and image height | metre (m) | Positive above the optical axis |
| R | Radius of curvature (mirrors) | metre (m) | Positive for a concave mirror |
| P | Optical power | dioptre (D) = m−1 | P = 1/f, with f in metres |
Note the units carefully. The equation itself is happy with centimetres, millimetres or metres — as long as all three distances use the same one. Optical power is the exception: dioptres demand metres.
The Three Sign Rules That Decide Every Answer
Nearly every wrong answer in geometric optics is a sign error, not an arithmetic one. Three rules prevent almost all of them.
- Object distance is always positive. For any real object sitting in front of the lens or mirror, do is greater than zero. You will rarely meet the exception (a “virtual object” inside a multi-lens system).
- Focal length carries the element’s character. Converging elements — a convex lens, a concave mirror — take a positive f. Diverging elements — a concave lens, a convex mirror — take a negative f.
- Image distance is an output, never an input. You do not decide its sign. The equation returns it, and its sign is the answer: positive means real, negative means virtual.
Rule three is the one students fight. A negative di feels like a mistake, so they quietly drop the minus sign and lose the whole result. It is not a mistake — it is the equation telling you the image is virtual.

Where each quantity is positive and negative, for a thin lens and for a spherical mirror.
Why your textbook may print a different formula
Search the lens equation and you will meet a rival version: 1/v − 1/u = 1/f. Many UK and Indian syllabuses use it, and so do our companion guides to the concave and convex lens and the concave and convex mirror.
Neither version is wrong. They are the same physics with different bookkeeping — the Cartesian convention measures every distance as a signed coordinate along the direction light travels, so a real object to the left of the lens gets a negative distance. Georgia State University’s HyperPhysics reference on the thin lens equation sets both forms side by side and notes the Cartesian one is favoured in advanced texts because it scales better to multi-lens instruments.
Here is the exact translation.
| Quantity | This article (real-is-positive) | Cartesian convention |
|---|---|---|
| Lens equation | 1/f = 1/do + 1/di | 1/v − 1/u = 1/f |
| Mirror equation | 1/f = 1/do + 1/di (identical) | 1/v + 1/u = 1/f |
| Real object | do positive | u = −do (negative) |
| Real image, lens | di positive | v = +di (positive) |
| Real image, mirror | di positive | v = −di (negative) |
| Magnification | m = −di/do | lens: m = v/u mirror: m = −v/u |
Substitute the middle column into the right column and the two collapse into one another exactly. In practice, pick whichever convention your course uses and never mix them inside a single problem — that is where the marks go missing.
How to Use the Lens Equation in Four Steps
Start by writing down what you know with its sign attached, before touching any algebra. The method below works for lenses and mirrors alike.
- Sign your knowns. Object distance positive. Focal length positive for converging, negative for diverging. For a mirror, get f from f = R/2 first.
- Rearrange for the unknown. Solving for image distance gives di = 1 / (1/f − 1/do).
- Compute the reciprocals separately. Work out 1/f and 1/do as decimals, subtract, then invert at the very end.
- Read the signs back. Positive di means real; negative means virtual. Then find m = −di/do: negative m means inverted, and a magnitude above 1 means enlarged.
Step three is where most arithmetic slips happen, because it is tempting to invert too early. If you would rather have the algebra checked for you while you learn the pattern, our Lens & Mirror Calculator solves for whichever quantity you leave blank and shows the working line by line.
The simulator below is the fastest way to build intuition. Drag the object closer and watch the image distance swing to infinity and come back on the other side as a negative number.
Where the Lens Equation Comes From
The equation is not a rule handed down from nowhere. It falls out of two similar triangles and, underneath that, out of Snell’s law applied twice.
Look back at the ray diagram. The undeviated ray through the centre of the lens creates a pair of similar triangles either side, which gives hi/ho = di/do — that is the magnification relation.
The ray that arrives parallel to the axis and leaves through the far focal point makes a second similar pair, this time involving f. Set the two ratios equal, tidy the algebra, and 1/f = 1/do + 1/di is what is left.
Go one level deeper and the lens is simply two refracting surfaces in series. Light bends entering the glass and bends again leaving it, each bend governed by Snell’s law — the same reflection and refraction behaviour you see at any boundary. OpenStax works through this two-surface derivation in full in University Physics Volume 3, section 2.4.
That derivation also produces the lensmaker’s equation, 1/f = (n − 1)(1/R1 − 1/R2), which builds the focal length from the glass’s refractive index and the curvature of its two faces. In short: geometry sets where the image goes, and the material sets f.
What the Equation Predicts as the Object Moves Closer
Feed a converging lens a steadily shrinking object distance and the image runs through a complete life cycle. This single table answers most exam questions about image type without any calculation at all.
| Object position | Image distance | Image type | Size | Everyday case |
|---|---|---|---|---|
| Very far away | di is close to f | Real, inverted | Tiny | Telescope, phone camera |
| Beyond 2f | Between f and 2f | Real, inverted | Diminished | Ordinary photography |
| Exactly at 2f | di = 2f | Real, inverted | Same size | 1:1 macro copying |
| Between f and 2f | Beyond 2f | Real, inverted | Enlarged | Projector, enlarger |
| Exactly at f | Infinite | No image forms | — | Lighthouse, collimator |
| Closer than f | Negative | Virtual, upright | Enlarged | Magnifying glass |
| Diverging lens, any distance | Always negative | Virtual, upright | Diminished | Door peephole, myopia lens |
That row where the image distance runs to infinity is the magnifying-glass flip you saw at the start. Cross the point where do equals f and the answer changes sign — real becomes virtual, inverted becomes upright.
Real-World Examples of the Lens Equation
Your phone camera barely moves its lens
A phone camera has a focal length of roughly 5 mm. For a selfie at 50 cm, the equation puts the sensor at 5.05 mm behind the lens; for a mountain 5 km away, at 5.005 mm.
The entire focus range of the camera is about forty microns of travel — thinner than a sheet of paper. That is why phone autofocus is a whisper-quiet voice coil rather than a visible barrel twist.
The eye does the opposite
Your retina cannot move, so di is locked at roughly 2 cm. To keep the equation balanced as objects come closer, the eye changes the only quantity it can — the ciliary muscle squeezes the lens and shortens f.
That process is called accommodation, and it stiffens with age. Reading glasses simply add the focal power the lens can no longer supply.
Cinema projectors sit just outside the focal point
Put the film a fraction beyond f and the image lands far away and hugely enlarged — row four of the table. Because the image is real and inverted, the film runs through the gate upside down so the picture arrives the right way up.
Car wing mirrors are honest liars
A convex mirror has a negative focal length, so di is negative for every possible object position. The image is always virtual, upright and shrunken — which widens the field of view but makes cars look further away than they are.
That is the entire physics behind the etched warning on the glass.
Telescopes park the sensor at the focal plane
For a star, do is effectively infinite, so the 1/do term vanishes and di = f exactly. Every telescope is built around that simplification: the detector sits at the focal plane and nothing needs refocusing between targets.
Common Misconceptions About the Lens Equation
“So f equals do plus di“
No — reciprocals do not add that way. With do = 30 cm and di = 15 cm, the correct focal length is 10 cm, not 45 cm.
Always add the reciprocals first, then invert once at the end. Inverting term by term is the single most common error in this topic.
“A negative image distance means I made a mistake”
It means you found a virtual image, which is a legitimate physical answer. Every magnifying glass, every peephole and every wing mirror produces one.
Report it with the minus sign intact and say what it means: image on the same side as the object, upright, not projectable onto a screen.
“Covering half the lens cuts the image in half”
It does not. Every point on the object sends light through the whole lens, and all of those rays reconverge at the same image point.
Block half and you remove half the rays, so the image gets dimmer — but it stays complete. Try it with a magnifying glass and a card; the effect is genuinely surprising the first time.
“The equation always works”
It is an approximation with two conditions attached. The lens must be thin compared with its radii of curvature, and the rays must stay close to the axis (paraxial).
Break either and real lenses show aberrations. Because refractive index varies with wavelength, f itself differs slightly for red and blue light — the same dispersion of light that makes a prism work also produces the coloured fringing that camera designers spend fortunes correcting.
How the Lens Equation Relates to Mirrors, Refraction and Lens Power
Think of this equation as the hub of geometric optics, with three spokes running off it.
- To mirrors: the same formula, with f = R/2 converting curvature into focal length. Which sign R takes depends on whether the mirror is concave or convex.
- To refraction: the lensmaker’s equation supplies f from the glass’s refractive index and the two surface curvatures, so Snell’s law sits one level below.
- To optical power: P = 1/f in dioptres. A prescription of minus 2.5 D is a diverging lens with f = −0.40 m, and closely spaced lens powers simply add.
Once the equation is fluent, the rest of the subject unpacks quickly. If you want the device-by-device picture rather than the algebra, the guides to concave and convex lenses and concave and convex mirrors cover the ray diagrams case by case.

Worked Problems
Show Solution
Solution:
Step 1: Sign the knowns. Converging lens, so f = +12 cm; real object, so do = +36 cm. Use 1/f = 1/do + 1/di.
Step 2: Rearrange and substitute. 1/di = 1/f − 1/do = 1/12 − 1/36 cm−1.
Step 3: Common denominator: 3/36 − 1/36 = 2/36 = 1/18 cm−1, so di = +18 cm.
Step 4: Magnification. m = −di/do = −18/36 = −0.50. Positive di means real; negative m means inverted.
Answer: di = +18 cm, m = −0.50 — a real, inverted image at half size.
Show Solution
Solution:
Step 1: f = +10 cm, do = +6.0 cm. The object is inside the focal length, so expect a virtual image.
Step 2: 1/di = 1/10 − 1/6.0 = 3/30 − 5/30 = −2/30 = −1/15 cm−1.
Step 3: di = −15 cm. The minus sign places the image 15 cm from the lens on the same side as the stamp.
Step 4: m = −di/do = −(−15)/6.0 = +2.5.
Answer: di = −15 cm, m = +2.5 — a virtual, upright image 2.5 times larger.
Show Solution
Solution:
Step 1: Diverging lens, so f = −20 cm. do = +30 cm, ho = 4.0 cm.
Step 2: 1/di = 1/(−20) − 1/30 = −3/60 − 2/60 = −5/60 = −1/12 cm−1.
Step 3: di = −12 cm, so the image is virtual and 12 cm from the lens on the object’s side.
Step 4: m = −(−12)/30 = +0.40, so hi = 0.40 × 4.0 cm = 1.6 cm.
Answer: di = −12 cm, hi = 1.6 cm upright — virtual, upright and diminished, as a diverging lens always gives.
Show Solution
Solution:
Step 1: Convert curvature to focal length. f = R/2 = 40/2 = +20 cm, positive because the mirror is concave.
Step 2: Same equation as a lens. 1/di = 1/20 − 1/30 cm−1.
Step 3: 3/60 − 2/60 = 1/60 cm−1, so di = +60 cm, in front of the mirror.
Step 4: m = −60/30 = −2.0. The object lies between f and 2f, so an enlarged real image is exactly what the table predicts.
Answer: di = +60 cm, m = −2.0 — real, inverted and twice the size.
Show Solution
Solution:
Step 1: Convex mirror, so f = −R/2 = −1.5 m. do = +5.0 m.
Step 2: 1/di = 1/(−1.5) − 1/5.0 = −0.6667 − 0.2000 = −0.8667 m−1.
Step 3: di = −1.15 m — virtual, about 1.2 m behind the mirror surface.
Step 4: m = −(−1.15)/5.0 = +0.23.
Answer: di = −1.15 m, m = +0.23 — upright and 23% of full size, which is precisely why objects are closer than they appear.
Show Solution
Solution:
Step 1: Both distances are known and the image is real, so do = +0.60 m and di = +3.0 m. Solve for f.
Step 2: 1/f = 1/do + 1/di = 1/0.60 + 1/3.0 = 1.6667 + 0.3333 m−1.
Step 3: 1/f = 2.000 m−1, so f = 0.50 m = 50 cm.
Step 4: m = −3.0/0.60 = −5.0, so the picture is five times the slide and inverted — hence the film is loaded upside down.
Answer: f = 0.50 m, m = −5.0.
Show Solution
Solution:
Step 1: A real image is inverted, so m = −4.0. From m = −di/do this gives di = 4.0 do.
Step 2: Substitute into the lens equation. 1/10 = 1/do + 1/(4.0 do).
Step 3: Combine the right side over a common denominator: 1/10 = (4 + 1)/(4 do) = 5/(4 do).
Step 4: Cross-multiply. 4 do = 50, so do = 12.5 cm and di = 4.0 × 12.5 = 50 cm.
Step 5: Check. 1/12.5 + 1/50 = 0.0800 + 0.0200 = 0.100 = 1/10 cm−1. Correct.
Answer: do = 12.5 cm and di = 50 cm, so lens to screen is 50 cm and the total object-to-screen span is 62.5 cm.