Skip to main content

Thin Lens Equation Solver: Image Distance, m, Real/Virtual

Calculate image distance, object distance, focal length, and magnification using the thin lens equation. Understand real vs virtual images, converging vs diverging lenses, and optical systems with interactive ray diagrams.

Last updated:
Formulas verified by Abbas Kalim Khan, Associate Scientist
Loading calculator...
Last Updated: February 2026

A thin lens is one whose thickness you can ignore relative to the focal lengths and object distances involved. That's the whole approximation, and it's where 1/f = 1/u + 1/v comes from. Real lenses bend light at two surfaces, but if those surfaces are close together compared to f, you can treat the whole element as a single refracting plane. Within that approximation, all the work is sign conventions. Positive f is converging, negative is diverging. Positive image distance is real (opposite side of the lens from the object), negative is virtual (same side as the object). Get the signs right and the algebra is grade-school. This thin lens equation calculator handles the reciprocals and flags real-vs-virtual and upright-vs-inverted.

Before plugging numbers blindly, you need to understand what each ray actually does when it hits the lens. The ray diagram isn't decoration; it's the check that catches sign errors before they cascade. A labeled sketch shows whether light converges to a real focus or diverges as if coming from a virtual point behind the lens.

Wave Geometry and Phase: The Quantities That Define a Wave

Geometric optics treats light as rays that travel in straight lines and bend at interfaces. That's a high-frequency approximation to wave optics: it ignores wavelength entirely. The thin-lens equation itself never mentions λ. The wavelength shows up only when you ask about diffraction, image resolution, and chromatic effects (since refractive index n depends on λ). For the calculator on this page, λ is hidden inside f and you don't need to track it explicitly.

Plane-wave description of light:

E(x, t) = E_0 cos(kx − ωt + φ)

k = 2π/λ is the wavenumber and ω = 2πf is the angular frequency. v = c/n is the phase speed in a medium of index n. Visible light: λ runs from about 380 nm (violet) to 750 nm (red). The thin-lens result is geometric and treats k as effectively infinite, so a ray is a line and the wavefronts are perpendicular to it.

The three principal rays you draw on a thin-lens diagram are shorthand for three special wavefronts. The parallel ray represents a wavefront from infinity, focused to a point at F'. The focal ray comes from F and emerges as a plane wavefront. The central ray passes undeviated through the lens because the local surfaces are parallel there. The image is wherever any two of these rays cross; the third is your sanity check.

The three principal rays

  1. Parallel ray: travels parallel to the optical axis until it hits the lens. A converging lens bends it through the far focal point F'. A diverging lens bends it so that it appears to come from the near focal point F.
  2. Focal ray: passes through (or toward) the near focal point F before hitting the lens. After refraction, it exits parallel to the optical axis.
  3. Central ray: passes straight through the lens center. Thin-lens approximation says it emerges undeviated because the two surfaces are locally parallel there.

Phase enters the picture only when the ray approximation breaks. At the diffraction limit, λ controls how tightly you can focus a beam: the smallest spot a perfect lens can make has a radius of about 1.22 λ f / D, where D is the aperture diameter. For a 50 mm lens at f/2 imaging green light (λ ≈ 550 nm), that limit is around 0.7 μm. Aberrations, sensor pixel size, and diffraction together set the practical resolution; the thin-lens calculator only handles the geometric piece.

Sign Conventions in Optics: What's Real and What's Virtual

Sign errors wreck thin-lens problems faster than arithmetic mistakes. There are two competing conventions, and they give the same physics but different equation signs. Pick one and stay with it. The calculator on this page uses the real-is-positive convention.

Real-is-positive convention (used here):

  • u > 0 for a real object on the incoming side of the lens.
  • v > 0 for a real image on the outgoing side. v < 0 for a virtual image on the incoming side.
  • f > 0 for a converging lens. f < 0 for a diverging lens.
  • m = h'/h = −v/u. Negative m is inverted, positive m is upright.
CaseLensufvmImage
1Convergingu > 2f++ (f < v < 2f)−, |m| < 1Real, inverted, reduced
2Convergingu = 2f++ (v = 2f)−1Real, inverted, same size
3Convergingf < u < 2f++ (v > 2f)−, |m| > 1Real, inverted, enlarged
4Convergingu = f+±∞±∞Image at infinity
5Convergingu < f+− (|v| > u)+, |m| > 1Virtual, upright, enlarged
6Divergingany u > 0− (|v| < |f|)+, |m| < 1Virtual, upright, reduced

Convention reminder. This table uses the real-is-positive convention. Hecht and many US textbooks use the Cartesian convention with opposite signs on u (light travels left to right, so u is negative for objects on the left). The physics is identical. Confirm which convention your course uses before applying these rules.

Case 5 is the magnifying-glass regime: object inside the focal length yields a virtual, upright, enlarged image. Case 6 shows that diverging lenses always produce virtual images regardless of object placement. Cases 1 to 3 cover camera, projector, and macro setups. Case 4 is the collimator condition (parallel light out, used to send beams to telescopes for testing).

Magnification formula:

m = h'/h = −v/u

|m| > 1 enlarged, |m| < 1 reduced, |m| = 1 same size. m < 0 inverted, m > 0 upright. The negative sign in the formula is not optional under this convention.

Sound, Light, Mechanical Waves: Where the Equations Differ

All three obey v = fλ, but only light bends through refractive lenses the way the thin-lens equation describes. Sound bends too, at boundaries between air and water or warm air and cold air, with Snell's law in the form sin θ_1 / v_1 = sin θ_2 / v_2 (the indices of refraction for sound are c_ref / v_local, swapping the role water and glass play for light). Mirage formation in hot air is sound-and-light refraction in temperature gradients; the two share the same governing equation.

What lensing means in different domains

  • Optical lens: refractive index n > 1 in glass, curved surfaces, 1/f = (n − 1)(1/R_1 − 1/R_2) (lensmaker's equation).
  • Acoustic lens: sound speed differs across boundary. A balloon filled with CO₂ in air focuses sound (CO₂ has lower v, acts like a converging lens for acoustic waves).
  • Gravitational lens: mass curves spacetime, deflecting light by an angle 4GM/(rc²). Distant galaxy clusters magnify the galaxies behind them. Same imaging math, very different physics underneath.
  • Electron lens: magnetic fields focus electron beams in TEMs and SEMs. Aperture, focal length, and magnification have direct optical analogues, just with field strength replacing surface curvature.

Where light differs sharply from sound is in dispersion. n(λ) for glass varies smoothly across visible wavelengths, with n_blue typically a percent or two larger than n_red. The result: blue rays focus closer to a converging lens than red rays do. That's chromatic aberration, and it's why a single-element lens can't form a sharp white-light image. The fix, an achromatic doublet, uses a converging crown-glass element and a diverging flint-glass element with carefully chosen powers so that two wavelengths (typically the F and C lines, blue and red) come to focus at the same point. Sound, by contrast, is essentially non-dispersive in air at audio frequencies; a complex sound waveform travels intact.

For mechanical waves on a string, no lensing analogue applies because the wave is constrained to one dimension. The string analogue of a "lens" is a load at a junction (a clamped or massive point) that partially reflects and partially transmits. The math is impedance matching, not refraction. Different domain, similar shapes of equations, different intuition pumps.

Multi-Element Setups (or Multi-Source Interference)

A single thin lens is rarely the whole story in a real instrument. Cameras use multi-element groups to control aberrations. Microscopes pair an objective with an eyepiece. Telescopes do the same. The thin-lens equation extends to multi-element systems by sequential application: solve element 1, take the image as the object for element 2, solve element 2, and so on. The new object distance for element k+1 is s_o,k+1 = d − s_i,k where d is the separation. Negative s_o,k+1 means the rays are still converging when they hit the next element, which is a virtual object. That isn't a glitch; it's the calculator capturing a real geometric situation.

Where to go for multi-element work. This page handles single-element thin lenses. For two- and three-element systems (compound microscopes, refracting telescopes, telephoto pairs), use the dedicated Lens-Mirror Combination Calculator, which ray-traces through the system and tracks signs across boundaries.

Total magnification across a chain is the product of the local magnifications: M_total = m_1 · m_2 · m_3 · …. Each negative factor flips orientation once. A compound microscope with a 40× objective (m_1 ≈ −40) and a 10× eyepiece (m_eye ≈ +10 in the angular sense) produces an upright virtual image at infinity with M_total ≈ 400×. A simple refracting telescope inverts overall, which is why astronomical refractors render the moon upside-down and terrestrial spotting scopes add an erecting prism.

Two thin lenses in contact (d ≈ 0) behave as a single lens with 1/f_eq = 1/f_1 + 1/f_2; powers add. Eyeglass prescriptions use this directly: a +2.0 D reading add over a −3.0 D distance prescription gives −1.0 D net power for near vision through the bifocal segment. Once the elements are separated by distance d, the rule changes to 1/f_eq = 1/f_1 + 1/f_2 − d/(f_1·f_2). The third term is what makes camera-lens design possible: a positive front group with a negative rear group separated by the right d gives a long effective focal length in a short physical package, which is the entire idea of a telephoto.

Interference, Beats, and Phase-Shift Diagnostics

Geometric optics ignores interference. The thin-lens equation predicts an infinitely sharp point image, which can't be right because diffraction sets a finite spot size. The Airy disk has a radius of about 1.22 λ f / D where D is the aperture. For green light (λ ≈ 550 nm) through a 50 mm lens at f/2 (D = 25 mm), the Airy radius is about 0.7 μm. That's the diffraction-limited resolution; aberrations and pixel size in real cameras add to it.

Two-slit interference and the diffraction grating are the textbook places where wavelength reasserts itself. Bright fringes occur where the path-length difference is nλ; the n = 0 fringe is on the optical axis and successive ones step off by Δθ ≈ λ/d for small angles, where d is the slit separation. A grating with N slits sharpens the principal maxima: their angular width drops like 1/N, which is why high-resolution spectrometers use thousands of grooves per millimetre. The same Δφ = (2π/λ) ΔL relation that governs sound interference governs light interference; the only real difference is the size of λ.

Phase-shift diagnostics that show up in lens problems

  • A flat optical wavefront entering a thin lens emerges curved by the local thickness profile. The lens delays the centre more than the edges (for a converging lens with positive power), bending the wavefront to converge at f.
  • Anti-reflection coatings exploit destructive interference. A layer of MgF₂ (n ≈ 1.38) at thickness λ/4n introduces a half-cycle round-trip phase shift, cancelling the reflection at one wavelength. Multi-layer coatings stretch the cancellation across the visible.
  • Newton's rings appear between a curved lens and a flat plate: alternating bright and dark fringes from the air gap, with spacing that maps the gap thickness to within λ/4. This is how lens curvatures get measured to optical-quality tolerances.

For a calculator that ignores wave optics, the diagnostic question to ask when results don't match an actual experiment is whether you've hit the diffraction limit, whether chromatic aberration is doing damage at the edges of the spectrum, or whether a thick-lens correction (principal planes shifted from the physical surfaces) is changing where the image actually forms. The thin-lens equation is correct in its regime; outside that regime you need wave optics or matrix methods.

Worked Example: 50 mm Camera Lens with Object at 75 mm

A camera lens with f = 50 mm photographs a small subject placed 75 mm in front of the lens. Find the image distance v, the magnification m, and characterise the image. The numbers are chosen so that u sits between f and 2f, which puts us squarely in case 3 of the sign-rule table: real, inverted, enlarged.

Configuration: f = 50 mm, u = 75 mm. Convention: real-is-positive.

Step 1. Apply 1/f = 1/u + 1/v. Rearranged: 1/v = 1/f − 1/u = 1/50 − 1/75. Common denominator 150: 1/v = 3/150 − 2/150 = 1/150. So v = 150 mm. Positive v under the real-is-positive convention means a real image, on the opposite side of the lens from the object.

Step 2. Magnification. m = −v/u = −150/75 = −2.0. Negative sign: the image is inverted relative to the object. Magnitude 2.0: the image is twice as tall (and twice as wide) as the subject. A 30 mm subject becomes a 60 mm image on the sensor.

Step 3. Sanity check against the table. u = 75 mm sits between f = 50 mm and 2f = 100 mm, so we're in case 3. Predicted: real, inverted, enlarged. The numbers v = 150 mm (yes, > 2f) and m = −2.0 (yes, < −1) match.

Step 4. What the camera does mechanically. A 50 mm lens at infinity focus has v = f = 50 mm; the sensor sits 50 mm behind the lens. To focus on a 75 mm subject, the lens has to extend forward by 100 mm to reach v = 150 mm. That's why macro lenses have long extension tubes or built-in helicoids that travel a long way: the closer the subject, the larger the image distance, and the further the lens has to be from the sensor.

Step 5. Compare with infinity focus. Same lens with u = 2 m gives 1/v = 1/50 − 1/2000 = 39/2000, so v ≈ 51.28 mm. Magnification m = −51.28/2000 ≈ −0.026. A 1.8 m person produces a 47 mm-tall image on the sensor. The behaviour at finite distance is dramatically different from the close-up case: m has shifted from −2.0 to −0.026, and v has changed by 3 mm out of 50 (versus 100 mm at the close-up distance). Macro photography is hard exactly because that v-vs-u curve is so steep near u = f.

Result. v = 150 mm, m = −2.0. Real, inverted, twice life-size. The setup is the close-up regime where the lens has to be extended far from the sensor, and small focus errors translate into large depth-of-field penalties because dv/du is large near the close-focus end of the range.

One aside on the magnifying-glass regime. Take the same f = 50 mm but place the object at u = 30 mm, inside the focal length. Then 1/v = 1/50 − 1/30 = 3/150 − 5/150 = −2/150, so v = −75 mm. Negative v means a virtual image on the same side as the object, 75 mm in front of the lens. m = −v/u = +2.5: virtual, upright, 2.5× larger. That's the simple-magnifier configuration the eye uses when you hold a hand lens up to a small object and look through it. Same equation, sign of v flipped, image type and orientation both change accordingly.

References

The thin-lens equation derives from Snell's law applied to spherical refracting surfaces under paraxial approximation. These sources provide the rigorous derivations and the extensions:

  • Hecht, E. (2017). Optics (5th ed.). Pearson. Chapters 5 and 6 cover paraxial optics, the lensmaker's equation, and the matrix methods that handle multi-element systems. The cleanest undergraduate treatment of sign conventions.
  • Born, M. & Wolf, E. (1999). Principles of Optics (7th ed.). Cambridge University Press. The authoritative reference for wave optics, aberration theory, and the link between geometric and physical optics. Heavier reading; the treatment is full-strength.
  • Pedrotti, F. L., Pedrotti, L. M., & Pedrotti, L. S. (2017). Introduction to Optics (3rd ed.). Cambridge University Press. Sections on Gaussian optics and aberrations. The cleanest worked examples in the undergraduate texts.
  • Smith, W. J. (2007). Modern Optical Engineering (4th ed.). McGraw-Hill. Practical lens design with aberration analysis, ABCD matrices, and tolerancing for production.
  • HyperPhysics (Georgia State University): hyperphysics.phy-astr.gsu.edu. Accessible derivations with interactive diagrams. Useful for first-pass cross-checks.
  • ISO 10110. Optics and photonics: Preparation of drawings for optical elements and systems. The international standard for specifying optical components on engineering drawings.

Note. This calculator implements paraxial thin-lens formulas for educational purposes. For designing real optical systems with multiple elements, aberration correction, and tolerancing, use ray-tracing software such as Zemax OpticStudio or Code V.

Limitations and Assumptions

  • Thin-lens approximation: lens thickness is assumed negligible. For thick lenses, measure distances from principal planes H and H'.
  • Paraxial rays only: results are accurate for rays close to the optical axis at small angles (θ < 5°). Large apertures or wide-angle systems require aberration analysis.
  • Monochromatic light: chromatic aberration (wavelength-dependent focusing) is not modelled. Real lenses use achromatic doublets to correct this.
  • Educational tool only: not suitable for optical-system design, manufacturing specifications, or safety-critical applications. Consult professional optical engineers for real designs.

Troubleshooting Thin Lens Calculation Errors

Real questions from students stuck on sign conventions, reciprocal arithmetic, and interpreting image properties.

What is the thin lens equation?

The thin lens equation is 1/f = 1/u + 1/v, where f is the focal length of the lens, u is the object distance (from object to lens), and v is the image distance (from lens to image). All three are reciprocals; you compute with 1/u and 1/v, never u and v directly. Sign conventions matter. In the common convention, distances measured in the direction light travels are positive. Real images and converging lenses both come out positive. Diverging lenses have f < 0. A virtual image (one that forms on the same side as the object, like a magnifying glass) also has v < 0. For a converging lens with f = 10 cm and an object at u = 30 cm: 1/v = 1/10 − 1/30 = 2/30, so v = 15 cm. Magnification m = −v/u = −0.5, meaning the image is inverted and half the size. The companion equation is m = h_image/h_object = −v/u. Positive m is upright, negative m is inverted. Magnitude gives the size ratio. The thin lens model breaks down when lens thickness exceeds about 10% of f. Large apertures (f/2 or wider) and rays hitting far from the optical axis also push the model past its accuracy. Real camera lenses correct those failures with multiple elements.

My answer came out as v = 7.5 cm but the solution says 15 cm—I'm using the same numbers, so where's the mistake?

When v comes out half what it should be, the cause is almost always working with f − u instead of 1/f − 1/u. The thin lens equation is 1/v = 1/f − 1/u, which means you work with reciprocals. If f = 10 cm and u = 30 cm, then 1/v = 1/10 − 1/30 = 3/30 − 1/30 = 2/30, so v = 30/2 = 15 cm. A common error is computing (10 − 30) = −20 then taking some reciprocal of that. Always calculate with 1/f and 1/u first.

I calculated v = −15 cm and my lab partner says that's wrong because distances can't be negative—who's right?

You're right. Negative image distance means a virtual image that forms on the same side as the object. Your lab partner is thinking of physical distances, which are always positive magnitudes, but in optics sign conventions encode whether the image is real (+) or virtual (−). A magnifying glass scenario (object closer than f) always gives v < 0. Don't 'fix' the sign—it's telling you something about the image type.

The formula says m = −v/u but I got m = +2 for a magnifying glass—shouldn't magnification be positive for enlargement?

Positive m means upright, not necessarily enlarged. For a magnifying glass, v is negative (virtual image) and u is positive, so m = −(negative)/(positive) = positive. That's correct—the image is upright. The magnitude |m| = 2 tells you it's twice as tall. If m were −2, the image would be twice as tall but inverted. Sign = orientation, magnitude = size.

I entered f = 20 cm for my diverging lens but the result makes no sense—what did I miss?

Diverging lenses have negative focal lengths. If your lens is concave (thinner in the middle), use f = −20 cm, not +20 cm. Converging lenses (convex, thicker in the middle) are f > 0. Mixing up the sign gives completely wrong image distances. Check the lens shape: curves outward at edges = diverging = f < 0.

Why does my camera need to 'focus' when I already know the focal length? Isn't f constant?

Yes, f is constant for a given lens. But 1/v = 1/f − 1/u means that when u changes (object moves closer or farther), v must change to keep the equation balanced. Focusing adjusts the lens-to-sensor distance v so the image lands exactly on the sensor. For distant objects (u → ∞), v ≈ f. For close-ups, v > f. Autofocus moves the lens to achieve the correct v.

I'm using centimeters throughout but my diopter calculation is off by a factor of 100—what happened?

Diopters require focal length in meters. D = 1/f only works when f is in meters. If f = 25 cm, convert first: f = 0.25 m, then D = 1/0.25 = 4 D. If you use f = 25 directly, you get D = 0.04, which is wrong by 100×. For all other thin lens calculations, any consistent unit works, but diopters are defined specifically with meters.

My textbook uses do and di but my professor writes u and v—are these the same thing?

Yes, just different notation. do (object distance) = u, and di (image distance) = v. Some books use so and si, or p and q. The physics is identical: 1/f = 1/u + 1/v = 1/do + 1/di. Same sign conventions apply regardless of notation. Pick one and stick with it throughout your course to avoid confusion.

The calculator says the image is at infinity—did something break or is that actually possible?

That's physically correct when u = f exactly. The thin lens equation gives 1/v = 1/f − 1/f = 0, meaning v → ∞. Rays exit the lens parallel, never converging. This is how collimators work (object at focal point produces parallel beam) and why spotlights and laser pointers place the source at f. It's a real optical configuration, not an error.

I drew the ray diagram and my image point doesn't match the calculated v—which one is wrong?

Probably the diagram, unless you were very careful with scale. Ray diagrams are qualitative checks, not precision instruments. Common drawing errors: inconsistent focal point marking, sloppy ray angles, not using a ruler. If your calculated v = 15 cm but the diagram shows ~12 cm, re-measure your f marks and redo the parallel and central rays. For homework, trust the calculation but use the diagram to verify real vs virtual and upright vs inverted.

How do I know when the thin lens equation stops being accurate? My camera lens is pretty thick.

The thin lens approximation fails when lens thickness is comparable to focal length or when rays hit far from the optical axis (large aperture). Rule of thumb: if lens thickness > 10% of f, or aperture ratio < f/2, expect noticeable error. Real camera lenses use multiple elements specifically to correct aberrations that the thin lens model ignores. For learning optics, the thin lens equation works great; for designing lenses, use ray tracing software.

Explore More Physics Calculators

Master optics and physics concepts with our comprehensive collection of calculators

Browse All Physics Tools