The lens equation, 1/f = 1/do + 1/di, locates the image formed by a thin lens or a spherical mirror. Drag the object distance and focal length sliders below and watch the image distance, the magnification and the traced rays answer together.

The Lens Equation

One solver for 1/f = 1/do + 1/di, working for both lenses and mirrors. Move the object and watch the image distance, the magnification and the ray diagram answer together.

Image distance  1/f = 1/do + 1/di
24.00 cm
real · inverted · diminished
Magnification  m = -di/do
-0.60
image height -2.40 cm
Element
Mode
Focal length |f|15 cm
Object distance do40 cm
Object height ho4.0 cm
Sign convention
Optical power P = 1/f = 6.67 D · f = +15 cm
Tip: slide the object inwards past the focal point. The image races off to infinity, then returns on the other side as a virtual, upright, magnified one — the magnifying-glass regime.

What Is the Lens Equation Simulator?

The lens equation simulator is a free interactive physics lab that runs in your browser — nothing to install and no sign-up. Drag the object distance and focal length sliders to see image distance, magnification and image type update live. It reports image distance 1/f and magnification as you drag the sliders.

What you can change in the lens equation simulator
ControlRangeStep
Focal length magnitude5 – 60 cm1
Object distance2 – 120 cm1
Object height1 – 8 cm0.5

How to Drive the Simulator and Read Its Answer

Every control on the panel feeds one equation. The focal length slider sets the size of f — how strongly the element gathers or spreads light — while the object distance slider walks the object along the optical axis toward the glass. Nothing here is pre-baked: each nudge re-solves 1/f = 1/do + 1/di and redraws the two principal rays, so the picture and the numbers cannot drift apart.

The readouts are where the equation stops being abstract. Slide the object out to twice the focal length and the magnification settles on exactly -1.00: image and object the same size, the image now upside down. Push inward instead and the image distance climbs without limit, until at do = f the tool stops dividing altogether and reports no image — the two rays leave perfectly parallel and meet nowhere at all.

The sign convention buttons cover the part most classes gloss over. They reprint one identical physical result in two notations: real-is-positive, which keeps a real object at a positive do, and Cartesian, which renames the distances u and v and makes u negative because it measures against the direction the light travels. The magnification lands on the same number in both, which is the plainest demonstration that a convention is bookkeeping rather than physics. Flip to mirror mode and the image folds back in front of the surface, the way a concave or convex mirror behaves, instead of forming beyond the element as it does for a concave or convex lens.

The misconception worth unlearning here is that a negative image distance signals a mistake. It does not. It means the light never converged and the image is virtual — precisely what your eye receives through a magnifying glass held close to the page. Work through the derivation behind all of this in the lens equation article, or push your own figures through the lens and mirror calculator when you want one exact answer rather than a moving picture.

Frequently asked questions

What do the sliders in this simulator control?

The focal length slider sets the size of f, which is how strongly the element gathers or spreads light. The object distance slider slides the object along the optical axis, and the object height slider scales the arrow. Two pairs of buttons pick the element: converging or diverging, and lens or mirror.

Why does the image distance read "no image" when do equals f?

Because at that one position there is no image to report. With do = f the term 1/f - 1/do is exactly zero, so the image distance would be infinite, and the two rays leaving the element are parallel and never meet. The simulator refuses to divide there and freezes the diagram in that parallel state rather than printing a meaningless number.

What does the sign convention toggle change?

Only the labels and the signs, never the physics. The real-is-positive view writes the equation as 1/f = 1/do + 1/di and keeps a real object at a positive do. The Cartesian view renames the distances u and v and makes u negative, because it measures against the direction the light travels. The magnification comes out to the same number either way.

How do I read a negative magnification?

The minus sign means inverted, not smaller. The size of the number is what tells you about scale: a magnification of -0.6 is an upside-down image at 60 percent of the object's height, while -2 is upside down and twice as tall. A positive magnification means the image is the right way up, which always goes with a virtual image.

Why does mirror mode show R as text rather than as a control?

Because the radius of curvature is not an independent quantity. A spherical mirror obeys f = R / 2, so once you have set the focal length the radius is already fixed at twice it. Showing R as a live readout makes that link visible without offering a second slider that could contradict the first.

References & formula source

  • Halliday, Resnick & Walker — Fundamentals of Physics, Chapter 34 (Images), thin lenses and spherical mirrors.
  • Young & Freedman — University Physics with Modern Physics, §34.4 (Thin Lenses) and §34.2 (Reflection at a Spherical Surface).
  • Hecht — Optics, §5.2 (Lenses), the thin-lens equation and the Gaussian lens formula.
  • R. Nave — HyperPhysics, Georgia State University, "Thin Lens Equation" / "Mirror Equation".
  • Further reading: Lens — Wikipedia