What is an image?
Every point on an object scatters light in all directions. An optical element — a mirror or lens — takes the cone of rays leaving one object point and redirects them so they either actually meet again at a point, or only appear to come from a point. Where they truly meet, you have a real image: you can catch it on a screen, as a projector or a camera sensor does. Where they only seem to come from, you have a virtual image: your eye traces the diverging rays backward, but no light is really there — a plane mirror's image behind the glass is the classic case.
Curved mirrors and focal length
A flat mirror just gives a same-size virtual image. Curve it and it gains power. A concave (spherical mirror) mirror caves inward like the inside of a spoon; parallel rays (say from a distant object) all converge to a single focal point. The distance from mirror to that point is the focal length f. A convex mirror bulges outward and spreads parallel rays apart, so they only appear to come from a focal point behind it — that is why shop-security and passenger-side mirrors give a wide, shrunken view.
Thin lenses: converging and diverging
A thin lens does the same job by refraction instead of reflection. A converging (convex) lens is fat in the middle; it bends parallel rays inward to a real focal point on the far side — this is the magnifying glass that can burn paper. A diverging (concave) lens is thin in the middle and spreads rays apart, giving a virtual focal point. We idealize these as thin lenses: we pretend all the bending happens at one central plane and ignore the glass thickness. We also assume paraxial rays — rays close to the axis and nearly parallel to it — so that the simple equations hold.
Ray diagrams: drawing the image
You can locate any image by drawing just three principal rays from the top of the object; where they cross is the top of the image. For a converging lens: (1) a ray parallel to the axis refracts through the far focal point; (2) a ray through the centre of the lens passes straight through undeviated; (3) a ray through the near focal point emerges parallel to the axis. Any two of these are enough — the third is a check. This is the ray diagram, and it works for every mirror and lens once you know where the focal points are.
The thin-lens equation and magnification
Drawing is intuitive; algebra is precise. Let d_o be the object distance from the lens, d_i the image distance, and f the focal length. The thin-lens equation ties them together. The sign convention carries the meaning: f>0 for a converging lens, f<0 for diverging; d_i>0 for a real image on the far side, d_i<0 for a virtual image on the near side.
The thin-lens (and mirror) equation. The same form governs a concave mirror; only the sign conventions differ slightly.
Magnification. |m| > 1 enlarges, |m| < 1 shrinks; a negative m means the image is inverted, a positive m means upright.
The same two equations, with the same sign rules, describe your eyeglasses (correcting where the image lands on your retina), a projector, a microscope and a telescope. What changes is only f and where you place the object — the physics is one page.