MechSimulator

Ray Optics Simulator & Trainer

Mirrors & Lenses — Simulate · Explore · Practice · Quiz

Mode
📖 User Guide
Optic
Type

Adjust the sliders and press Trace Rays to see how the image forms.

u −30 cm
v cm
f −15 cm
m
Image
Mirror : 1/f = 1/v + 1/u
Object Distance30 cm
Image Distance
Focal Length15 cm
Magnification
Image Nature
Orientation
Object dist (u)
30 cm
Object height (h)
10 cm
Focal length (f)
15 cm
Presets

User Guide

1 Overview

The Ray Optics Simulator & Trainer lets you explore how light interacts with mirrors and lenses. Choose between concave and convex optics, set object position and focal length, then trace rays to see where the image forms — its position, size, and orientation.

Four modes: Simulate (interactive ray tracing), Explore (educational cards), Practice (unlimited problems), and Quiz (5-question assessment).

2 Setting Up the Rig Ray Optics simulator interface preview

Select an optic type (Mirror or Lens) and a sub-type (Concave or Convex). Adjust the sliders for object distance, height, and focal length. Press Trace Rays to see the animated ray diagram. You can also drag the object arrow directly on the canvas.

3 Running the Test

Three principal rays animate from the object through the optic, forming the image. The formula panel shows the live calculation. Readout badges display u, v, f, magnification, and image nature. Drag the object arrow to explore different positions in real time.

Right-click the canvas to save as image, copy the current reading, or reset.

4 Background Theory

Five educational categories: Basics (light and reflection), Mirrors (concave/convex behaviour), Lenses (convex/concave behaviour), Formulas (mirror/lens equations with worked examples), and Applications (telescopes, cameras, corrective lenses).

5 Practice Problems

Practice: Solve unlimited ray optics problems — predict image distance, nature, magnification, or identify the optic type from given properties. Instant feedback with explanations.

Quiz: 5 randomly selected questions. Scored with a star rating (3 stars = perfect). Review each answer after completion.

6 Key Concepts

Mirror equation: 1/f = 1/v + 1/u (Cartesian sign convention)

Lens equation: 1/f = 1/v − 1/u

Magnification: m = v/u = image height / object height

Sign convention: Distances towards incident light are negative, away are positive. Object distance u is always negative.

7 Tips & Best Practices
  • Try placing the object at F, at 2F, and beyond 2F to see how the image changes.
  • Switch between concave and convex to compare real vs virtual images.
  • Use Explore mode to understand the sign convention before attempting Practice.
  • Audio click plays on drag start; success/error tones play in Practice and Quiz.

Understanding Ray Optics: Mirrors and Lenses

Ray optics simulator showing a converging convex lens with parallel incoming rays from the left being refracted through the lens and converging at the focal point on the right, plus an object arrow positioned to the left of the lens with its image formed on the opposite side
Default convex lens preset. Object on the left, real inverted image on the right. Drag the object to see how the image distance and magnification change.
Ray optics simulator showing a convex lens with all three principal rays traced from the object through the lens, converging to form a clear real image at the appropriate distance
Convex lens with three principal rays traced: parallel, chief, and focal-point rays meeting at the image.
Ray optics simulator showing a concave (diverging) lens with parallel rays bending outward as they pass through, with the virtual image formed by extending the diverged rays backward to the same side as the object
Concave (diverging) lens. Virtual image on the same side as the object, always smaller, upright.

What Is Ray Optics?

Ray optics (geometric optics) is the branch of physics that describes light propagation in terms of rays. When light strikes a mirror it reflects; when it passes through a lens it refracts. By tracing just three principal rays from any point on an object, we can predict exactly where the image will form, how large it will be, and whether it is real or virtual.

Concave vs Convex: Mirrors and Lenses

A concave mirror converges parallel light to a real focal point, producing real inverted images when the object is beyond the focal length. A convex mirror always diverges light, producing virtual, erect, diminished images — which is why convex mirrors are used as rear-view mirrors. Similarly, a convex lens converges light and can form both real and virtual images, while a concave lens always diverges light, forming virtual images used to correct myopia.

The Mirror and Lens Equations

Using the Cartesian sign convention, the mirror equation is 1/f = 1/v + 1/u, and the thin lens equation is 1/f = 1/v − 1/u. Here u is the object distance (always negative), v is the image distance, and f is the focal length. The magnification m = v/u tells us the size ratio and orientation of the image.

A Worked Lens Equation Example — Camera Focus

A camera lens with focal length 50 mm photographs an object 2 m away. Where does the image form, and what is the magnification?

StepWorkingResult
Convert to consistent unitsf = 50 mm = 0.050 m, u = −2 m
Apply thin lens equation1/v = 1/f + 1/u = 1/0.050 + 1/(−2)1/v = 20 − 0.5 = 19.5
Image distancev = 1/19.5v = 51.3 mm
Magnificationm = v/u = 51.3/(−2000)m = −0.0256
Image size of a 0.5 m object0.0256 × 50012.8 mm (inverted)

Note that v (51.3 mm) is only slightly larger than f (50 mm). For distant objects (u much larger than f), the image always forms close to the focal plane — which is why every camera sensor is positioned approximately at the focal length behind the lens. Refocusing for closer objects simply means moving the sensor a fraction of a millimetre further from the lens. Modern autofocus systems do this in milliseconds.

The Sign Convention — Where Most Students Get Lost

Sign conventions in optics are notoriously confusing because different textbooks use different ones. The simulator uses the most common Cartesian convention: distances measured from the lens centre; rightward positive; upward positive; converging lens has positive f; diverging lens has negative f. Real images have positive v (formed on the side opposite the object); virtual images have negative v (formed on the same side as the object).

With this convention: convex lens with object beyond f gives a positive v (real image, inverted, opposite side). Concave lens always gives negative v (virtual image, upright, same side). Object inside f of a convex lens (used as a magnifying glass) gives negative v (virtual image, upright, magnified, same side). The simulator marks these with colour and explicit labels so the geometry stays clear.

Real Engineering Optics — Where Ray Tracing Lives

References

Explore Related Simulators

Continue your physics exploration with our Beam Bending Simulator for structural mechanics, Litmus Test Virtual Lab for chemistry fundamentals, Spring Design Calculator for elastic mechanical systems, or the Stress-Strain Curve Simulator for material behaviour.