Lens and Mirror Ray Diagram Simulator
Equations in this simulation
| f | Focal length f (size, cm) | positive for a converging lens and a concave mirror, negative for a diverging lens and a convex mirror | |
|---|---|---|---|
| o | Object distance o (cm) | from the object to the lens or mirror | |
| i | image distance | positive for a real image (behind a lens, in front of a mirror), negative for a virtual one on the other side |
With the current values:
| h | Object height h (cm) | the arrow standing on the axis | |
|---|---|---|---|
| h′ | image height | negative means the image is upside down | |
| m | magnification | above 1 in size means enlarged; negative means inverted |
With the current values:
| P | optical power | in diopters, with f in meters; opticians quote lenses this way, + for reading glasses and − for short sight |
|---|
With the current values:
| R | radius of curvature of a mirror | the center of curvature C is twice as far as the focal point; for a thin lens with both faces curved the same, R = 2(n − 1)f = f when the glass has n = 1.5 |
|---|
With the current values:
How to use the lens and mirror simulator
- Pick a converging or diverging lens, or a concave or convex mirror, and set its focal length. The red arrow is the object; the blue arrow is its image, drawn faint when it is virtual.
- Move the object with the object distance slider, or tick Move the object back and forth, and watch the three principal rays: one parallel to the axis, one through the center of the lens (or the vertex of the mirror) and one through the focal point. Where they cross is the image; where only their dashed extensions meet, the image is virtual.
- Read the image distance, magnification and image height under the picture, and the thin lens equation worked through with your numbers in the equations. The chart plots the image distance against the object distance, with the jump at the focal point.
Frequently asked questions
What is the thin lens equation?
1/f = 1/o + 1/i, where f is the focal length, o the object distance and i the image distance. The same equation works for mirrors. With the real-is-positive convention used here, f is positive for a converging lens and a concave mirror, and a negative i means a virtual image. The magnification is m = −i/o.
When is an image real and when is it virtual?
A real image forms where the light rays actually meet, so it can be caught on a screen; with a converging lens or concave mirror it appears whenever the object is beyond the focal point, and it is upside down. A virtual image is where the rays only seem to come from, like the image in a magnifying glass or a flat mirror: it is upright and cannot be projected. Diverging lenses and convex mirrors only ever make virtual, smaller images.
What happens when the object is at the focal point?
The rays leave the lens parallel, so they never meet and no image forms: 1/i = 1/f − 1/f = 0, so i is infinite. Just inside the focal point you get a large virtual image (a magnifying glass); just outside, a large real image far away (a projector).
What is a diopter?
The unit of optical power, P = 1/f with f in meters. A lens of focal length 25 cm is 4 diopters. Glasses prescriptions are written this way: plus for converging lenses that help long sight and reading, minus for diverging lenses that correct short sight.
It says WebGL is turned off.
The 3D view needs WebGL, which every current browser has. It can be switched off by hardware acceleration being disabled in the browser settings, or by a very old graphics driver. Turn hardware acceleration on, or try another browser.
Is anything uploaded?
No. The simulation is drawn by your own browser with WebGL; nothing is sent anywhere, and it keeps working offline once the page has loaded.