Real and virtual images through the thin lens equation
How object position decides whether a lens makes a real inverted image or a virtual upright one, and what the signs mean.
One equation, a strict sign convention
The thin lens equation, 1/f = 1/do + 1/di, is deceptively simple, and its power comes from a consistent sign convention. Real objects in front of the lens take positive object distances, and converging lenses take positive focal lengths. A positive image distance then means a real image on the far side of the lens, while a negative one means a virtual image on the near side. Keeping those signs straight is what lets a single formula describe cameras, projectors, magnifiers and eyeglasses alike.
What magnification actually reports
The magnification m = -di/do carries two pieces of information at once. Its size compares image height to object height, so a magnitude of 2 doubles the height and 0.5 halves it. Its sign reports orientation: negative for an inverted image and positive for an upright one. The minus sign in the formula is what ties a real, far-side image to an inverted, negative magnification, matching what a camera sensor records.
Object position sets the image type
For a converging lens, where you place the object relative to the focal point changes everything. Beyond the focal length you get a real, inverted image that a screen can catch, shrinking as the object recedes. Exactly at the focal point the image runs off to infinity. Inside the focal length the lens acts as a magnifier, producing an enlarged, upright, virtual image, which is the second example this tool computes. Sliding the object through these zones is the classic way to understand lens behaviour.
Diverging lenses
A diverging lens has a negative focal length and behaves more predictably: no matter where the object sits, it forms a reduced, upright, virtual image on the same side as the object. That is why a peephole or a nearsighted person's glasses shrink the view. Entering a negative focal length here reproduces this, returning a negative image distance and a positive magnification below one. The equation and its signs handle converging and diverging lenses with no special cases.