Optics
Lens Optics
Curved transparent objects bending light to focus it — eyes, cameras, telescopes
Lenses are curved transparent objects that bend (refract) light to converge or diverge it. Convex lenses (thicker in middle) focus parallel light at the focal point. Concave lenses (thinner in middle) spread light. Combinations of lenses correct vision, capture photographs, and reveal distant or microscopic worlds. Governed by the lensmaker's equation and the thin-lens equation.
- Thin-lens equation1/f = 1/d_o + 1/d_i
- Lensmaker's equation1/f = (n − 1) · (1/R₁ − 1/R₂)
- Focal length fDistance to focal point (m or cm)
- MagnificationM = -d_i / d_o (negative = inverted)
- Convex lensf > 0, converging
- Concave lensf < 0, diverging
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
Types of lenses
| Type | Shape | Behavior | Focal length |
|---|---|---|---|
| Biconvex | Both surfaces curve outward | Converging | f > 0 |
| Plano-convex | Flat + convex | Converging | f > 0 |
| Meniscus convex | Curved both directions, net convex | Converging | f > 0 |
| Biconcave | Both surfaces curve inward | Diverging | f < 0 |
| Plano-concave | Flat + concave | Diverging | f < 0 |
| Meniscus concave | Net concave | Diverging | f < 0 |
Thin-lens equation
1/f = 1/d_o + 1/d_i
Sign convention:
- f > 0 for converging (convex), f < 0 for diverging (concave).
- d_o > 0 always (object on left side).
- d_i > 0 for real image (right side, on opposite side); d_i < 0 for virtual image (same side as object).
Image formation rules
| Object position (convex lens) | Image position | Image type |
|---|---|---|
| d_o = ∞ (parallel light) | d_i = f | Point at focal plane |
| d_o > 2f | f < d_i < 2f | Real, inverted, smaller |
| d_o = 2f | d_i = 2f | Real, inverted, same size |
| f < d_o < 2f | d_i > 2f | Real, inverted, magnified |
| d_o = f | d_i = ∞ (parallel) | No image |
| d_o < f | d_i < 0 (same side as object) | Virtual, upright, magnified (e.g., magnifying glass) |
Lensmaker's equation
Given the lens material and surface curvatures:
1/f = (n − 1) · (1/R₁ − 1/R₂)
where n is refractive index of lens, R₁ is radius of front surface, R₂ of back surface (with signs depending on which way the curves face).
Magnification
M = -d_i / d_o = h_i / h_o
Negative M = inverted; positive = upright. |M| > 1 = magnified; < 1 = reduced.
JavaScript — lens calculations
// Thin lens equation: solve for unknown
function imageDistance(focal, objectDistance) {
// 1/f = 1/d_o + 1/d_i
// 1/d_i = 1/f - 1/d_o
return 1 / (1/focal - 1/objectDistance);
}
function objectDistance(focal, imageDistance) {
return 1 / (1/focal - 1/imageDistance);
}
// Magnification
function magnification(d_object, d_image) {
return -d_image / d_object;
}
// Convex lens, f = 10 cm, object at 30 cm
const d_o = 30;
const f = 10;
const d_i = imageDistance(f, d_o);
const M = magnification(d_o, d_i);
console.log(`f=10cm, d_o=30cm: d_i=${d_i.toFixed(1)} cm, M=${M.toFixed(2)}`);
// d_i = 15 cm, M = -0.5 (inverted, half size)
// Magnifying glass: object inside focal length
console.log(`f=10cm, d_o=5cm: d_i=${imageDistance(10, 5).toFixed(1)} cm, M=${magnification(5, imageDistance(10, 5)).toFixed(2)}`);
// d_i = -10 cm (virtual), M = +2 (upright, 2× magnification)
// Lensmaker's equation
function lensFocalLength(n, R1, R2) {
// R values: positive if center of curvature on right side
// For biconvex: R1 > 0, R2 < 0
return 1 / ((n - 1) * (1/R1 - 1/R2));
}
// Biconvex lens, R1 = 20 cm, R2 = -20 cm, n = 1.5
console.log(`Biconvex 20cm: f = ${lensFocalLength(1.5, 20, -20).toFixed(1)} cm`); // 20
// Two thin lenses in contact (combined focal length)
function combinedFocal(f1, f2) {
// 1/F = 1/f1 + 1/f2
return 1 / (1/f1 + 1/f2);
}
console.log(`f1=20, f2=20 in contact: F = ${combinedFocal(20, 20)}`); // 10
console.log(`f1=20, f2=-20 (cancel): F = ${combinedFocal(20, -20)}`); // ∞ (no net focusing)
// Camera field of view
function fieldOfView(focalLength_mm, sensorSize_mm) {
// FOV = 2 · atan(sensor/(2·f))
return 2 * Math.atan(sensorSize_mm / (2 * focalLength_mm)) * 180 / Math.PI;
}
// Full-frame (36mm wide) camera with various lenses
console.log(`24mm wide-angle: ${fieldOfView(24, 36).toFixed(1)}°`); // ~73°
console.log(`50mm normal: ${fieldOfView(50, 36).toFixed(1)}°`); // ~40°
console.log(`200mm telephoto: ${fieldOfView(200, 36).toFixed(1)}°`); // ~10°
// Diopter (used for eyeglasses)
function diopter(focalLength_meters) {
return 1 / focalLength_meters;
}
console.log(`+2 diopter glasses: f = ${1/2} m = ${1/2 * 100} cm`); // 50 cm
console.log(`-3 diopter (myopia): f = ${1/-3 * 100} cm`); // -33 cm
// Telescope angular magnification
function telescopeMag(f_objective, f_eyepiece) {
return f_objective / f_eyepiece;
}
console.log(`f_obj=1000mm, f_ep=10mm: M = ${telescopeMag(1000, 10)}×`); // 100×
Where lenses matter
- Vision correction. Eyeglasses, contact lenses for myopia, hyperopia, presbyopia, astigmatism.
- Photography. All cameras use lens systems — varied focal lengths for different effects.
- Astronomy. Refracting telescopes (older), mostly used for binoculars and small telescopes.
- Microscopy. Compound microscopes use multiple lenses to achieve high magnification.
- Lasers. Beam shaping, focusing, mode coupling all use lenses.
- Smartphones. Multi-element compact lenses fit in mm-thick devices.
- Projectors. Light from source through condenser → image plane → projection lens → screen.
Common mistakes
- Wrong sign convention. d_i > 0 for real images; < 0 for virtual. f > 0 for convex; < 0 for concave. Get these straight.
- Confusing focal length with image distance. Focal length is a property of the lens (fixed). Image distance depends on object distance.
- Treating thin lens as if it works for thick lenses. Real lenses have thickness; the thin-lens formula is approximate. For thick lenses, need to account for principal planes.
- Ignoring chromatic aberration. Different wavelengths focus at different distances; corrections needed for high-quality optics.
- Forgetting magnification sign. Negative M means inverted image. For upright (positive M), image is virtual or by combining lenses.
- Confusing converging and diverging lenses. Converging — focuses parallel light to point (convex). Diverging — spreads light (concave). Different signs of f.
Frequently asked questions
How do lenses bend light?
Through refraction at the curved surfaces. When light enters glass (slower medium), it bends toward the normal; exiting bends away. The shape of the lens (convex or concave) plus the angle of incidence determines net bending. Curved surfaces focus parallel rays to a point or spread them — based on geometry.
What's the thin-lens equation?
1/f = 1/d_o + 1/d_i, where f is focal length, d_o is object distance, d_i is image distance. For a fixed lens, this gives the image position for any object distance. Image can be real (light actually converges) or virtual (appears to come from); upright or inverted; same size or magnified.
Why are eyeglasses needed for myopia and hyperopia?
Myopia (nearsighted) — eye's lens is too strong (focal point in front of retina). Concave eyeglasses (negative focal length) spread incoming light; the eye then focuses it onto retina. Hyperopia (farsighted) — eye's lens too weak. Convex glasses (positive focal length) converge light first; eye focuses to retina.
How does a camera adjust focus?
Camera lens has multiple elements; one or more move along the optical axis. Closer object → image distance increases (need lens farther from sensor). Auto-focus uses sensor-feedback to detect sharpest contrast. Cinema lenses sometimes have continuous focus pulling for cinematic effect.
What's the difference between focal length and field of view?
Focal length f sets magnification and field of view. Long focal length (telephoto, e.g., 200 mm) — high magnification, narrow field of view. Short focal length (wide-angle, e.g., 24 mm) — low magnification, wide field. For a given sensor size, FOV ∝ 1/f.
What's a chromatic aberration?
Different colors of light have slightly different refractive indices in glass. So they focus at slightly different distances → blurry, color-fringed images. Corrected by combining lenses of different glass types ("achromat" — combines crown + flint glass) or apochromatic designs.
How do telescopes use lenses?
Refracting telescope — large objective lens collects light, focuses to image. Eyepiece magnifies the image. Magnification = f_objective / f_eyepiece. Limitations: chromatic aberration, weight (large lenses), maximum diameter (sag from gravity). Reflectors (mirrors) avoid these but have own issues.