Real images form where light rays converge after refraction/reflection—they can be projected on a screen and appear in optical calculations with positive image distance. Virtual images form where rays appear to diverge—they cannot be projected and have negative image distance, appearing erect and enlarged as in magnifying glasses.
From your work with ray diagrams, you know that when a lens or mirror redirects light, rays from a single object point fan out, interact with the optical surface, and then either converge toward a new point or diverge away from one. That outcome — convergence or divergence — is precisely what distinguishes a real image from a virtual image. A real image forms where the refracted or reflected rays actually cross. You can hold a piece of paper at that location and see the image projected onto it, because real light is physically arriving there.
A virtual image forms where no actual rays meet. Instead, the rays leaving the optical surface are diverging, but if you trace them backward (extend them as straight lines in the direction they appear to come from), they converge at a point behind the lens or mirror. Your eye follows those diverging rays backward automatically — that is how vision works — and interprets them as originating from a source at the apparent convergence point. A magnifying glass held close to an object places the object inside the focal length, producing a virtual image that appears larger and on the same side as the object. You see it clearly, but you cannot project it onto a screen.
The distinction shows up cleanly in the sign convention you use with the lens and mirror equations. In the standard convention, positive image distance means the image forms on the outgoing-light side of the lens (or in front of a mirror) — that is a real image. Negative image distance means the image is on the incoming-light side — virtual. Real images are always inverted (the magnification is negative); virtual images formed by a single converging element (or any convex mirror) are always upright (positive magnification). This correspondence between sign and character is not arbitrary — it is built directly into the geometry of ray convergence and divergence.
Knowing whether an image is real or virtual matters practically, not just mathematically. Camera sensors and film can only capture real images, because they require light to physically strike the recording surface. Projectors cast real images onto screens. The virtual image in your bathroom mirror is visible to your eyes but cannot be captured by a camera placed at the mirror — the camera must be pointed at you (the object), not at the mirror. Keeping this distinction sharp prevents confusion whenever a problem asks about image location, orientation, or whether an image can be observed from a particular vantage point.