The thin lens equation
Every converging lens, diverging lens, concave mirror and convex mirror in this simulation obeys the same relationship between object distance, image distance and focal length. Once you know any two of the three, the equation gives you the third exactly, without drawing a single ray:
1/d_o + 1/d_i = 1/f
d_o = object distance from the lens or mirror
d_i = image distance (positive = real image, negative = virtual image)
f = focal length (positive = converging lens / concave mirror
negative = diverging lens / convex mirror)
magnification: m = −d_i / d_o
|m| > 1 → image is enlarged m > 0 → image is upright
|m| < 1 → image is reduced m < 0 → image is inverted
Three rays that never fail
Instead of solving equations, optics students are taught to find an image with a ruler by drawing three specific rays from the tip of the object, each of which obeys a rule simple enough to draw by hand. The parallel ray travels parallel to the optical axis until it hits the lens or mirror, then bends through the focal point. The focal ray does the reverse: it passes through the near focal point on its way in, then emerges parallel to the axis. The chief (centre) ray passes straight through the centre of a thin lens undeviated, or reflects off the centre of a mirror at an equal angle. Any two of these three rays are already enough — where they cross (or where their backward extensions appear to cross) is exactly where the image forms, and the third ray is only there to confirm the answer.
Real images versus virtual images
A real image forms wherever rays of light actually converge and physically cross — a real image can be projected onto a screen, captured on a camera sensor, or focused onto your retina, because light energy genuinely passes through that point in space. A virtual image forms wherever rays only appear to diverge from when you trace them backward in a straight line; no light ever actually reaches that point, so a virtual image can never be projected onto a screen, only viewed directly by an eye or relayed through another lens. A converging lens with the object beyond its focal length produces a real image; the same lens with the object closer than the focal length produces a magnified virtual image — the working principle of a magnifying glass.
Converging vs diverging, concave vs convex
A converging (convex) lens and a concave mirror both have a positive focal length and can form either real or virtual images depending on where the object sits relative to the focal point — beyond it, a real, inverted image; inside it, a magnified, upright virtual image. A diverging (concave) lens and a convex mirror have a negative focal length and, no matter where the object is placed, always spread rays apart rather than gathering them, producing only reduced, upright, virtual images — exactly why a car's passenger-side convex mirror always shows a smaller, upright view labelled "objects are closer than they appear," and why a peephole lens always shows the whole hallway shrunk down.
Frequently asked questions
Why are only three principal rays enough to locate an image?
Any two rays from a single object point that both obey the mirror or lens equations will intersect (or appear to diverge from) exactly the same image point, because every real ray from that object point converges there. The three principal rays are chosen because their paths are trivial to draw geometrically, but you only ever need two of them — the third is a convenient check.
What is the practical difference between a real and a virtual image?
A real image forms where light rays actually converge and cross, so it can be projected onto a screen or captured on a sensor — think of a camera or a film projector. A virtual image forms where rays only appear to diverge from when traced backward; the light never actually passes through that point, so it cannot be projected onto a screen, only viewed by an eye or another lens, as with a magnifying glass or a flat mirror.
Why does a concave mirror sometimes give an upright image and sometimes an inverted one?
It depends entirely on where the object sits relative to the mirror's focal point. Place the object beyond the focal point and the mirror forms a real, inverted image. Move the object closer than the focal point and the reflected rays diverge instead of converging, producing a magnified, upright, virtual image — the same physics behind a shaving or makeup mirror.
Try it live
Everything above runs in your browser — open Mirrors & Lenses and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Mirrors & Lenses simulation