The thin lens equation is a formula that relates three distances: how far an object is from a lens, how far the resulting image forms from the lens, and the lens’s focal length. Written as 1/f = 1/p + 1/q, it lets you predict exactly where an image will appear and whether it will be larger or smaller than the original object. It applies to eyeglasses, cameras, telescopes, microscopes, and any other system that uses lenses to bend light.
The Formula and Its Variables
The thin lens equation is:
1/f = 1/p + 1/q
Each variable is a distance measured from the center of the lens. p (sometimes written as do or s) is the object distance, meaning how far the object sits from the lens. q (sometimes di or s’) is the image distance, meaning how far the image forms from the lens on the other side. f is the focal length, which is a fixed property of the lens itself. A lens with a short focal length bends light more sharply than one with a long focal length.
If you know any two of these three values, you can solve for the third. That’s what makes the equation so useful: place an object at a known distance from a lens with a known focal length, and you can calculate exactly where the image will land.
Sign Conventions
The equation only works correctly if you follow a consistent set of sign rules. These conventions tell you when to plug in a positive or negative number for each variable.
- Object distance (p): Positive when the object is on the incoming-light side of the lens (the normal setup). Negative only in rare multi-lens systems where a “virtual object” forms behind the lens.
- Image distance (q): Positive when the image forms on the opposite side of the lens from the object. This is a real image you could project onto a screen. Negative when the image forms on the same side as the object, making it a virtual image visible only by looking through the lens.
- Focal length (f): Positive for a converging (convex) lens, the kind that can focus sunlight to a point. Negative for a diverging (concave) lens, which spreads light outward.
Getting the signs wrong is the most common mistake when using this equation. A negative image distance doesn’t mean you did the math wrong. It means the image is virtual, like the magnified view you see through a magnifying glass held close to a page.
A Worked Example
Suppose you place a 4.00 cm tall light bulb 45.7 cm in front of a converging lens that has a focal length of 15.2 cm. To find where the image forms, rearrange the equation to solve for q:
1/q = 1/f − 1/p
Plugging in the numbers: 1/q = 1/15.2 − 1/45.7 = 0.0658 − 0.0219 = 0.0439. So q = 1/0.0439 = 22.8 cm. The image forms 22.8 cm behind the lens. Because q is positive, the image is real and inverted, meaning it appears upside down relative to the original bulb.
Magnification
Once you know both distances, you can figure out how large the image is compared to the object. The lateral magnification formula is:
m = −q / p
The variable m tells you two things at once. Its absolute value gives the size ratio: if |m| = 2, the image is twice as tall as the object. The sign tells you orientation: a negative m means the image is inverted (flipped upside down), while a positive m means it’s upright.
In the light bulb example, m = −22.8 / 45.7 = −0.499, roughly −0.5. The image is about half the height of the original bulb (2.00 cm tall) and inverted. Move the bulb closer to the lens and the image grows larger and moves farther away. Move it farther from the lens and the image shrinks.
Real vs. Virtual Images
With a converging lens, the type of image depends on where you place the object relative to the focal point. If the object is farther from the lens than one focal length, the equation gives a positive q, and you get a real, inverted image on the far side of the lens. This is how projectors work: a real image is cast onto a screen.
If you move the object inside the focal length (closer to the lens than f), the math yields a negative q. That means no real image forms. Instead, you see a virtual, upright, magnified image when you look through the lens. This is exactly what happens when you use a magnifying glass.
Diverging lenses always produce virtual images regardless of object placement. Because their focal length is negative, q always comes out negative too. The image appears smaller and upright on the same side of the lens as the object.
What “Thin Lens” Actually Means
The word “thin” isn’t just casual description. It’s a specific simplification. The equation assumes the lens is so thin that its thickness is negligible compared to the object distance, image distance, and focal length. In practice, this means you measure all distances from a single point at the center of the lens rather than worrying about where light enters one surface and exits the other.
The equation also relies on the paraxial approximation: light rays stay close to the central axis of the lens and hit it at small angles. Under these conditions, the mathematical shortcut sin(θ) ≈ θ holds true, which is baked into the derivation. For rays that hit the lens far from center or at steep angles, the equation becomes less accurate, and you start seeing blurring and distortion that lens designers call aberrations.
When the Equation Breaks Down
The thin lens equation stops being reliable in a few specific situations. If the lens is physically thick relative to its focal length, you need to account for the separation between the two curved surfaces. Thick lens equations use two reference points (called principal planes) instead of one, adding complexity but handling the geometry correctly.
The equation also loses accuracy when the lens radius becomes large compared to p or q. Wide-angle camera lenses or lenses that capture light from objects very close by can push past the paraxial limit. In those cases, optical designers use computer ray-tracing software that tracks thousands of individual light paths through the real curved surfaces rather than relying on a single algebraic shortcut.
Lens Power in Diopters
Optometrists don’t typically talk about focal length in centimeters. Instead, they describe lenses in diopters, which is simply the reciprocal of the focal length measured in meters. A lens with a focal length of 0.5 meters has a power of 2 diopters. A lens with a focal length of 0.25 meters has a power of 4 diopters. Shorter focal length means stronger bending, which means a higher diopter number.
This convention makes the thin lens equation even simpler for eyeglass prescriptions. When two thin lenses sit in contact (as in a compound lens or a close-up filter stacked on a camera lens), you can add their diopter values directly to find the combined power. That’s much easier than combining focal lengths, which requires a more involved calculation.
Where the Equation Gets Used
The thin lens equation is the starting point for designing nearly every common optical instrument. In a camera, it determines how far the sensor or film must sit behind the lens to bring a subject at a given distance into sharp focus. When you twist a camera’s focus ring, you’re physically changing p and watching the lens shift to keep q landing exactly on the sensor.
In corrective eyewear, the equation helps determine what focal length (and therefore what diopter prescription) a person needs so that light from distant or nearby objects focuses precisely on the retina. Microscopes, binoculars, and refracting telescopes all chain multiple lenses together, but each individual lens in the system still follows the same 1/f = 1/p + 1/q relationship. Understanding that single equation gives you the foundation for understanding them all.

