Thin Lens Calculator Back
Optics Simulator

Thin Lens Calculator — Ray Diagram, Image Distance & Magnification

Adjust focal length and object distance to instantly see 3 principal rays move and compute image distance, magnification, and real/virtual image classification for converging and diverging lenses.

Parameters
Focal length f (mm)
mm
-500 (diverging)0+500 (converging)
Object distance do (mm)
mm
101000
Results
Image dist. di (mm)
Magnification m (×)
Image type / orientation
Ray Diagram
Image distance di vs object distance do
Image Distance vs Object Distance
Theory & Key Formulas

$$\frac{1}{f}= \frac{1}{d_o}+ \frac{1}{d_i}$$

$$m = -\frac{d_i}{d_o}$$

$d_i \gt 0$: real image (projectable)
$d_i \lt 0$: virtual image (non-projectable)
$m \lt 0$: inverted   $m \gt 0$: upright

What is a Thin Lens?

🙋
What exactly is the "thin lens equation" that this simulator is based on? It seems like magic that you can predict where an image will form.
🎓
It's not magic, it's geometry! Basically, the equation is a simple relationship between three distances: the focal length of the lens ($f$), how far the object is ($d_o$), and where the image appears ($d_i$). In practice, if you know any two, you can solve for the third. Try moving the "Focal Length" slider in the simulator—you'll instantly see the image distance change.
🙋
Wait, really? So if I put the object really close to the lens, the image goes far away? And what does a negative image distance mean?
🎓
Exactly! That's a key insight. For a converging lens (positive $f$), if you move the object inside the focal point ($d_o \lt f$), the simulator will show a negative $d_i$. That's the math telling you the image is virtual—it appears on the same side of the lens as the object and can't be projected onto a screen. A common case is a magnifying glass. Try setting the object distance to be less than the focal length and watch the rays diverge.
🙋
Okay, I see the image distance and the ray diagram. But what about the magnification number? Why is it sometimes negative?
🎓
Great question! The magnification $m$ tells you two things. Its absolute value is the size ratio (image height / object height). The sign tells you the orientation. A positive $m$ means the image is upright relative to the object. A negative $m$ means it's inverted. For instance, in a projector (real image), $m$ is negative and large. In the simulator, when you get a real image ($d_i \gt 0$), you'll always see a negative magnification for a single lens, meaning the image is upside-down.

Physical Model & Key Equations

The fundamental relationship governing image formation by a thin lens is derived from the geometry of light rays. It connects the focal length of the lens to the positions of the object and the image.

$$\frac{1}{f}= \frac{1}{d_o}+ \frac{1}{d_i}$$

$f$: Focal length of the lens. Positive for converging (convex) lenses, negative for diverging (concave) lenses.
$d_o$: Object distance (always taken as positive for real objects).
$d_i$: Image distance. Positive values indicate a real image formed on the opposite side of the lens from the object. Negative values indicate a virtual image formed on the same side as the object.

The lateral magnification describes how much larger or smaller the image is compared to the object, and whether it is inverted.

$$m = -\frac{d_i}{d_o}$$

$m$ : Lateral magnification. If $|m| \gt 1$, the image is magnified; if $|m| \lt 1$, it is diminished. The sign of $m$ indicates orientation: $m \lt 0$ means the image is inverted relative to the object; $m \gt 0$ means it is upright.

Frequently Asked Questions

For a convex lens, when the object distance is less than the focal length, the lens formula gives a negative image distance. This means a virtual image is formed, which is upright and magnified on the same side of the lens as the object. For a concave lens, a virtual image is always formed.
In the thin lens formula, the sign of the focal length indicates the type of lens. A concave lens diverges light, so its focus is at a virtual position, and it is treated as a negative focal length in calculations. This ensures that the image distance and magnification are automatically calculated with the correct signs.
A negative magnification (m < 0) means the image is inverted. This occurs when a real image is formed, typically with a convex lens when the object is beyond the focal length. If the absolute value of the magnification is greater than 1, the image is magnified; if less than 1, it is reduced.
When the rays do not intersect, it indicates that a virtual image is being formed. In a virtual image, the light does not actually converge; instead, the image appears at the point where the backward extensions of the rays meet. The simulator displays these extensions as dashed lines, and their intersection shows the position of the virtual image. This occurs with concave lenses or convex lenses when the object is within the focal length.

Real-World Applications

Digital Camera & Smartphone Lenses: The lens focuses light from a distant object onto the camera sensor (a real image). Autofocus systems physically move lens elements to adjust the effective focal length or image distance ($d_i$) to satisfy the thin lens equation for sharp focus on the sensor plane.

Magnifying Glass (Simple Microscope): When you hold a magnifying glass close to an object (with $d_o \lt f$), the lens produces a virtual, upright, and magnified image ($m \gt 0$). This is why text appears larger when viewed through the lens.

Eyeglasses & Contact Lenses: These are thin lenses designed to correct vision. For a nearsighted person, a diverging lens (negative $f$) is used to take a distant object and create a virtual image at the person's far point, which their eye can then focus on clearly.

Projectors and Overhead Projectors: These devices use a converging lens to take a small slide or LCD image (the object) and project a large, real, and inverted image ($m$ is negative and large in magnitude) onto a distant screen. The setup requires $d_o$ to be slightly greater than $f$.

Common Misconceptions and Points to Note

First, don't be misled by the term "thin lens." This is an idealized model that assumes "the lens thickness is negligible compared to the focal length." You cannot design real lenses, especially the complex lens assemblies in smartphone cameras, based on this calculation alone. Use it strictly as a "first approximation" concept.

Next, pay attention to the behavior when you set the object distance $d_o$ to a value just slightly larger than the focal length $f$. For example, with an $f=50mm$ lens and $d_o=55mm$, the formula gives a very large $d_i$ of $550mm$. In this state, the magnification is high (approximately -10x) and the image forms far away, so even a tiny error in $d_o$ (e.g., 1mm) can cause $d_i$ to fluctuate by tens of millimeters, resulting in a significant focus shift. This is precisely why focus becomes so critical in high-magnification macro photography in practical applications.

Also, while it's common to memorize that "a concave lens always forms a virtual image," there are cases where a concave lens can form a real image if you treat the object as a "virtual object" (i.e., converging light rays coming from another lens). This is an advanced concept important for designing optical systems with multiple combined lenses. While it's fine to think "always a virtual image" when working with a single concave lens in NovaSolver, it's good to keep this nuance in the back of your mind.

How to Use

  1. Set focal length (f) using the slider—typical values: 50mm for converging lens, –100mm for diverging lens
  2. Input object distance (do) measured from the lens principal plane—must exceed focal length for real images on converging lenses
  3. Click calculate or adjust sliders to generate ray diagram showing principal rays, compute image distance (di) via 1/f = 1/do + 1/di, magnification m = –di/do, and classify image as real (inverted, di positive) or virtual (erect, di negative)

Worked Example

Converging lens with f = 40mm, object at do = 120mm (3× focal length). Solving 1/40 = 1/120 + 1/di gives di = 60mm (real image, 60mm beyond lens). Magnification m = –60/120 = –0.5×, producing an inverted, half-size image. Ray diagram displays object arrow, three principal rays converging at image plane, confirming real-image formation used in camera optics and projection systems.

Practical Notes

  1. Diverging lens (negative f) always produces virtual, erect, reduced images regardless of do—used for eyepiece correction and wide-angle viewing at distances greater than focal length magnitude
  2. When do approaches focal length, magnification approaches infinity and image moves to infinity—critical threshold for magnifying glass and loupe applications requiring do slightly greater than f
  3. Verify object distance exceeds lens thickness; thin-lens model assumes negligible lens depth, valid for f/d ratios exceeding 4 in optical design