Optics simulator: trace rays through lenses and mirrors
An optics simulator traces light rays through lenses, mirrors and glass so you can see where they bend, where they meet and what image they make, without an optics bench. Our optics simulator, the Ray Optics Simulator, works as a lens simulator and much more: put convex and concave lenses, plane and curved mirrors, prisms and glass blocks on the bench, aim an object, a point source or a beam at them, and it draws every ray using the law of reflection and Snell's law. It gives the image distance and magnification from the lens equation, and the angles of incidence and refraction at glass.
Ray Optics Simulator
Trace light rays through lenses, mirrors and prisms
How to use the optics simulator
- Open the Ray Optics Simulator. It opens on a convex lens with an object in front of it.
- Under Scenes, load a set-up: convex lens, magnifying glass, concave lens, concave mirror, parallel beam to a focus, prism spectrum, glass block, total internal reflection or periscope.
- Under Parts, add a convex or concave lens, a plane, concave or convex mirror, a prism or a glass block, and set each one's focal length (up to ±60 cm), size, refractive index, apex angle or the angle it is turned to.
- Under Light, choose an Object (an arrow), a Point source or a Beam, and set the number of rays. Turn on White light to split it into colours, and Normals and angles to see the normal at each surface.
- Read the image readings for a lens or mirror (u, v, f, magnification and what kind of image it is), or the angles for glass (incidence, refraction, critical angle, deviation and how many times the ray was totally reflected).
The lens and mirror equation
The simulator uses the real-is-positive convention, the same as most US textbooks write as 1/do + 1/di = 1/f. A converging (convex) lens or concave mirror has a positive f, a diverging one a negative f. A positive v is a real image that can be caught on a screen; a negative v is virtual. A negative magnification means the image is upside down.
Worked examples you can check in the simulator
Example 1: a convex lens forming a real image
The opening scene has an object 26 cm from a convex lens with f = 12 cm.
The readout says Real, inverted, diminished: the rays really cross 22.29 cm behind the lens, and the image is 0.857 times the height of the object, upside down. This is how a camera or your eye forms an image.
Example 2: moving the object
Drag the object closer. The table shows what a 12 cm convex lens does as it comes in:
| Object distance u | Image distance v | Magnification | Image |
|---|---|---|---|
| 36 cm | 18 cm | −0.5 | Real, inverted, diminished |
| 24 cm (2f) | 24 cm | −1 | Real, inverted, same size |
| 18 cm | 36 cm | −2 | Real, inverted, magnified |
| 12 cm (f) | Infinity | None | Rays leave parallel |
| 8 cm (inside f, f = 14) | −18.67 cm | 2.33 | Virtual, upright, magnified |
The last row is the Magnifying glass scene: with the object inside the focal length, the rays spread out after the lens, and you see an upright, magnified, virtual image where they appear to come from.
Example 3: a concave lens
Load Concave lens: f = −12 cm, object at 26 cm. Then 1/v = −1/12 − 1/26, so v = −8.21 cm and m = 0.316. A diverging lens always gives a virtual, upright, diminished image, on the same side as the object.
Example 4: a concave mirror
Load Concave mirror: f = 12 cm, object 28 cm in front. v = 28 × 12 ÷ (28 − 12) = 21 cm and m = −0.75: a real, inverted, diminished image in front of the mirror, where the reflected rays cross.
Example 5: refraction in a glass block
Load Glass block (n = 1.5) and turn on normals. The ray meets the block at 28° to the normal. By Snell's law, n₁ sin θ₁ = n₂ sin θ₂, so sin θ₂ = sin 28° ÷ 1.5 and θ₂ = 18.24°: it bends towards the normal going in. It leaves at 28° again, parallel to where it started but shifted sideways. The Snell's law guide covers the formula.
Example 6: total internal reflection
Load Total internal reflection. Inside a 90° glass prism, the ray hits the long face at 45°. The critical angle for n = 1.5 is sin⁻¹(1 ÷ 1.5) = 41.8°, and 45° is bigger, so no light gets out: it is totally reflected, and the readout counts 1 total reflection. Prisms like this turn light round in binoculars and periscopes.
Try a refraction question, then press Mark to check your answer in the Light and Energy course.
Calculate the angle of refraction for a random pair of materials and angle.
Press Mark to have your answer marked in the Light & Energy course.
What the simulator doesn't do
- Thick lenses and aberrations. Lenses and curved mirrors are ideal thin ones that bring rays exactly to a focus.
- Lens systems in one reading. You can place several parts and the rays pass through them all, but the image readings are for the first lens or mirror the light meets. For two lenses, use the first image as the object for the second, by hand.
- Wave optics. No diffraction, interference or polarisation (polarization in the US). Light here travels as rays.
- Focal length from curvature. You set f directly; it doesn't use the lensmaker's equation.
Common mistakes
- Sign of f. Diverging lenses and convex mirrors have a negative focal length.
- Reading a negative v as an error. It means the image is virtual.
- Measuring angles from the surface. Angles of incidence and refraction are measured from the normal.
- Thinking total internal reflection needs a mirror. It happens at a glass-air boundary when light inside the glass hits it beyond the critical angle.
Common questions
What is an optics simulator?
Can I use it as a lens simulator?
What is the lens equation?
When is the image from a convex lens virtual?
What is the critical angle of glass?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Ray Optics Simulator
Trace light rays through lenses, mirrors and prisms
Open the tool - Learn it
Light & Energy
Waves, photons and the electromagnetic spectrum explained
Start the course - Test it
High School Physics
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper