Real object: $u < 0$; Real image: $v > 0$
Drag sliders to adjust focal length, object distance, and height. Watch 3 principal rays update in real time and see whether a real or virtual image forms.
The fundamental relationship between object distance, image distance, and focal length is given by the Gaussian Lens Formula. This equation governs the ray tracing you see in the simulator.
$$\frac{1}{v}- \frac{1}{u}= \frac{1}{f}$$Where:
$u$ = Object distance (always negative by sign convention for real objects on the left).
$v$ = Image distance (positive for real images on the right, negative for virtual images on the left).
$f$ = Focal length (positive for convex/converging lenses, negative for concave/diverging lenses).
The magnification m tells you if the image is enlarged or reduced, and upright or inverted. It's derived from the ratio of image height to object height.
$$m = \frac{h_i}{h_o}= \frac{v}{u}$$Where:
$h_i$ = Image height.
$h_o$ = Object height.
A negative magnification indicates an inverted image (common for real images from convex lenses), while a positive value indicates an upright image (common for virtual images).
Digital Camera & Smartphone Lenses: These use complex assemblies of convex lenses to focus light onto a sensor. Engineers use ray tracing simulations to minimize distortions and aberrations, ensuring sharp photos. Adjusting the focal length in the simulator mimics zooming in and out.
Eyeglasses & Contact Lenses: Concave lenses are used to correct nearsightedness (myopia) by diverging light before it enters the eye. The simulator shows how a concave lens creates a virtual image closer to the viewer, which is what the nearsighted eye needs to focus properly.
Magnifying Glasses & Microscopes: A simple convex lens acts as a magnifier when the object is placed within its focal length (u < f). This produces a large, upright virtual image. In the simulator, slide the object very close to a convex lens to see this effect, which is the first stage of a compound microscope.
Projectors & Overhead Projectors: These devices use convex lenses to form a real, inverted, and enlarged image of a slide or LCD panel on a distant screen. The relationship shown in the simulator—where moving the object (slide) changes the image distance and size—is critical for focusing a projector correctly.
First, you might think that "changing the focal length changes the image position and size 'proportionally'," but this is incorrect. Looking at the thin lens formula, the relationship between $u$, $v$, and $f$ involves the subtraction of reciprocals. For example, with a focal length $f=10$ cm and an object distance $u=-20$ cm, the image distance $v$ is 20 cm. If you double $f$ to 20 cm here, $v$ becomes infinity (parallel light). You can see it's not a simple proportional relationship. Try moving the sliders significantly in the simulator to experience this nonlinear change firsthand.
Next, while it's true that "a concave lens always forms only a virtual image," you need to pay attention to how that virtual image appears. The virtual image from a concave lens forms on the same side as the object, is always upright and diminished. You might tend to think, "If I move the object farther away, will it appear larger?" However, no matter how far you move the object, the size of the virtual image will never exceed the object's height. It's always $|m| < 1$. This is one reason why a concave lens cannot be used as a magnifying lens.
Finally, don't forget that the simulator deals with an "ideal thin lens". In practice, lenses have thickness and exhibit aberrations (chromatic aberration, spherical aberration, etc.). Even if you see perfect imaging in this tool, with a real single lens, light rays often don't converge to a single point. For instance, smartphone camera lenses are composed of multiple cemented elements precisely to cancel out these aberrations. Consider the simulator as a first step for understanding the "ideal system."