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.
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.

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.
| Control | Range | Step |
|---|---|---|
| Focal length magnitude | 5 – 60 cm | 1 |
| Object distance | 2 – 120 cm | 1 |
| Object height | 1 – 8 cm | 0.5 |
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.
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.
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.
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.
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.
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.