> ## Documentation Index
> Fetch the complete documentation index at: https://aegean.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How Lenses Form Images

> Snell law, the lensmaker formula, conjugate points, depth of field, concave lenses, and the Galilean telescope, each as a runnable diagram.

<a href="https://colab.research.google.com/github/pantelis/eng-ai-agents/blob/main/notebooks/CV/mit-foundations/chapter-6-lenses/index.ipynb" target="_blank" rel="noopener noreferrer">
  <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" style={{ marginBottom: "1rem" }} />
</a>

*This section was written by [Kimberly Milner](https://github.com/rollingcoconut) ([pull request #44](https://github.com/pantelis/eng-ai-agents/pull/44)), with help from an AI coding agent on the code. It reproduces the ideas of Chapter 6 of [*Foundations of Computer Vision*](https://visionbook.mit.edu/lenses.html) by Antonio Torralba, Phillip Isola, and William T. Freeman. The book's own figures are not reproduced here, because the book's license covers only the work in full; links point to them instead.*

This section answers a question pinholes cannot: how do you let in more light without sacrificing sharpness? The answer starts with Snell's law. The first part derives the **lensmaker's formula**, which turns Snell's law plus a small-angle approximation into one equation,

$\frac{1}{a} + \frac{1}{b} = \frac{1}{f},$

relating object distance $a$, image distance $b$, and focal length $f$.

Each figure is a runnable construction: change a refractive index, a radius of curvature, or an object distance, and the diagram redraws from the new physics. The book's diagrams are regenerated directly. Where the book shows a photograph, either a synthetic version computed from the same physics stands in, or a link points to the book's figure.

```python theme={null}
import urllib.request
from pathlib import Path

import torch
import kornia
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon, Rectangle, Circle, FancyArrowPatch
from matplotlib.collections import LineCollection

DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

_ = torch.manual_seed(0)
```

```python theme={null}
# Locate the section's two photos regardless of the working directory; download them once if absent.
_CHAPTER_DIR = Path("notebooks/CV/mit-foundations/chapter-6-lenses")
BASE_DIR = _CHAPTER_DIR if _CHAPTER_DIR.is_dir() else Path(".")
ASSETS_DIR = BASE_DIR / "assets"
ASSET_URL = ("https://raw.githubusercontent.com/pantelis/eng-ai-agents/main/notebooks/CV/"
             "mit-foundations/chapter-6-lenses/assets")
for _name in ("dog_scene.png", "ruler_single.png"):
    if not (ASSETS_DIR / _name).exists():
        ASSETS_DIR.mkdir(parents=True, exist_ok=True)
        urllib.request.urlretrieve(f"{ASSET_URL}/{_name}", ASSETS_DIR / _name)
```

```python theme={null}
# Section 6.2, physics primitives.
# Snell's law and its paraxial small-angle form, the surface-tilt angle, the
# lensmaker's focal length and conjugate image distance, and the four-angle
# bookkeeping that the thin-lens derivation composes from them. (Book the book.)


def snells_law(n1, n2, theta1):
    """Refraction angle θ₂ at a flat interface (n₁ sin θ₁ = n₂ sin θ₂).

    Angles in radians, measured from the surface normal. Returns NaN past
    the critical angle (total internal reflection).
    """
    n1 = torch.as_tensor(n1, dtype=torch.float32)
    n2 = torch.as_tensor(n2, dtype=torch.float32)
    theta1 = torch.as_tensor(theta1, dtype=torch.float32)
    return torch.asin((n1 / n2) * torch.sin(theta1))


def paraxial_snell(n1, n2, theta1):
    """Paraxial Snell's law: n1·θ1 = n2·θ2, the small-angle form of snells_law.

    Differs from snells_law by sin(θ) ≈ θ. Used throughout §6.2's lensmaker
    derivation where the four ray angles all sit in the paraxial regime.
    Angles in radians, measured from the surface normal.
    """
    n1 = torch.as_tensor(n1, dtype=torch.float32)
    n2 = torch.as_tensor(n2, dtype=torch.float32)
    theta1 = torch.as_tensor(theta1, dtype=torch.float32)
    return (n1 / n2) * theta1


def surface_angle(c, R):
    """Tilt angle θ_S of a spherical surface at height c, radius R.

    Paraxial form: θ_S ≈ c/R. (Book §6.2, Figure 6.5.)
    """
    c = torch.as_tensor(c, dtype=torch.float32)
    R = torch.as_tensor(R, dtype=torch.float32)
    return c / R


def focal_length(n, R1, R2):
    """Focal length of a thin lens via the lensmaker's equation.

    1/f = (n-1) * (1/R1 + 1/R2).  (Book §6.2, Eq. derived from Table 6.1.)
    Sign convention: both R1 and R2 are positive magnitudes. A biconvex lens
    has R1 > 0 and R2 > 0. (Book §6.2, note this differs from Hecht 2016,
    which uses signed radii.)
    """
    n = torch.as_tensor(n, dtype=torch.float32)
    R1 = torch.as_tensor(R1, dtype=torch.float32)
    R2 = torch.as_tensor(R2, dtype=torch.float32)
    return 1.0 / ((n - 1.0) * (1.0 / R1 + 1.0 / R2))


def image_distance(a, f):
    """Image distance b from object distance a and focal length f.

    1/a + 1/b = 1/f  =>  b = a*f / (a - f).  (Book §6.2.)
    Returns inf when a == f (object at the focal point → image at infinity).
    """
    a = torch.as_tensor(a, dtype=torch.float32)
    f = torch.as_tensor(f, dtype=torch.float32)
    return a * f / (a - f)


def lensmaker_angle_bookkeeping(n, R1, R2, c, theta1_deg):
    """Compute the four paraxial ray angles and two surface tilts through a thin lens.

    Applies paraxial Snell's law at each surface using the helpers defined
    above. Returns (theta1_axis, theta2_axis, theta4_axis, thetaS1, thetaS2),
    all in radians measured from the optical axis (rays) or from horizontal
    (surface tilts). (Book §6.2, Table 6.1.)
    """
    theta1_axis = torch.deg2rad(theta1_deg)

    # Surface tilts at the ray's hit height (both radii now positive magnitudes
    # per the book's convention).
    thetaS1 = surface_angle(c, R1)
    thetaS2 = surface_angle(c, R2)

    # Refract entering the glass at the front surface.
    theta1_normal = theta1_axis + thetaS1
    theta2_normal = paraxial_snell(1.0, n, theta1_normal)
    theta2_axis = theta2_normal - thetaS1

    # Refract exiting the glass at the back surface.
    theta3_normal = thetaS2 - theta2_axis
    theta4_normal = paraxial_snell(n, 1.0, theta3_normal)
    theta4_axis = thetaS2 - theta4_normal

    return theta1_axis, theta2_axis, theta4_axis, thetaS1, thetaS2


# Sanity checks, one per function.
# Snell's law: 30° in air → ≈19.47° in glass (n=1.5).
print(f"{torch.rad2deg(snells_law(1.0, 1.5, torch.deg2rad(torch.tensor(30.0)))).item():.2f}°")
# Paraxial Snell: 5° in air → ≈3.33° in glass (n=1.5), close to exact 3.33°.
print(f"{torch.rad2deg(paraxial_snell(1.0, 1.5, torch.deg2rad(torch.tensor(5.0)))).item():.2f}°")
# Surface tilt: radius 50 mm, ray hit at height 5 mm → about 0.1 rad ≈ 5.73°.
print(f"{torch.rad2deg(surface_angle(5.0, 50.0)).item():.2f}°")
# Biconvex lens, n=1.5, R1=R2=50 mm → f = 50 mm. Object at 200 mm → b ≈ 67 mm.
f = focal_length(1.5, 50.0, 50.0)
b = image_distance(200.0, f)
print(f"f = {f.item():.2f} mm, b(a=200) = {b.item():.2f} mm")
```

```output theme={null}
19.47°
3.33°
5.73°
f = 50.00 mm, b(a=200) = 66.67 mm
```

## Introduction

A pinhole camera works: light from a scene passes through a small opening and forms an image on a sensor on the other side. But pinholes force a trade-off. Shrink the aperture and each scene point maps to a tight spot: the image is sharp, but so little light gets through that the image is dim. Open the aperture and more light arrives, but each scene point now spreads across many sensor pixels: the image is bright but blurry. There's no single pinhole size that's both sharp and bright.

A lens breaks the trade-off. It gathers the wide cone of light a large aperture admits and *refocuses* it back to a single point on the sensor: bright like the wide pinhole, sharp like the narrow one. The rest of this section is the geometry of how a lens does that.

**Figure 6.1: Brightness/sharpness trade-offs in image formation.** Three setups, same scene at the top, same sensor at the bottom. **(a) Small pinhole:** sharp image, very dim: little light reaches the sensor. **(b) Large pinhole:** bright image, very blurry: each scene point spreads to a wide disk at the sensor. **(c) Lens:** bright AND sharp: the lens collects a wide cone of light from each scene point and refocuses it to one sensor point. The book's version is [Figure 6.1](https://visionbook.mit.edu/lenses.html#fig-pinholes); it demonstrates the same tradeoff with photographs in [Figure 6.2](https://visionbook.mit.edu/lenses.html#fig-pinholeSize).

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_7_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=d20e4b5af6da21281a8f6f3c64fccf53" alt="Output from cell 7" width="597" height="428" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_7_output_1.png" />

The next section derives the geometry behind panel (c): how exactly does a lens refocus a wide cone of light from each scene point back to a single sensor point? The answer is Snell's law applied twice (once at each glass surface), with a small-angle approximation that linearizes the algebra. That's the **lensmaker's formula**, which the next part builds.

## The lensmaker's formula

A lens refracts light at each of its two surfaces. The lensmaker's formula compresses that two-refraction process into one equation,

$\frac{1}{a} + \frac{1}{b} = \frac{1}{f},$

relating object distance $a$, image distance $b$, and focal length $f$. It follows from applying Snell's law twice with the small-angle approximation $\sin\theta \approx \theta$: the *paraxial* regime where the algebra stays linear.

For small angles in radians, $\sin\theta \approx \theta$, and Snell's law at a glass-air interface ($n_1 = 1$, $n_2 = n$) becomes the linear $\theta_1 = n\theta_2$. The book uses this paraxial form throughout the rest of the section.

**Figure 6.3(a): Snell's law at a flat interface.** A ray crosses from a medium with refractive index $n_1$ into a denser medium with $n_2 > n_1$ and bends toward the normal. The angles $\theta_1, \theta_2$ are measured from the normal, and $n_1 \sin\theta_1 = n_2 \sin\theta_2$ relates them. The book's panel (b), a photograph of a straw refracting in a glass of water, is the same physics in the physical world; that photo is not reproduced here. (Book Figure 6.3.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_8_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=baacdcbe90b16002b8d034e1917f247a" alt="Output from cell 8" width="445" height="445" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_8_output_1.png" />

**Figure 6.4(a): Thin-lens geometry.** A point on the optical axis at distance $a$ from the lens emits rays in many directions. Those rays pass through the lens at various heights up to $c$ and converge to a single image point at distance $b$ on the other side. The angle the upper extreme ray makes with the optical axis is $\theta_1$ on the object side and $\theta_4$ on the image side. The lensmaker's formula derived in this section is the statement that for a thin lens, this convergence happens at the same $b$ for every ray emitted from the same object point. (Book Figure 6.4(a).)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_9_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=4d5bdf9e7c0872d900f8f1fe7b320e83" alt="Output from cell 9" width="874" height="360" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_9_output_1.png" />

The figure depicts an idealization: rays appear to bend at a single point (the center of the lens) rather than refracting twice (at each glass surface). This is the *thin-lens approximation*, which assumes the lens's physical thickness is small enough to ignore. Panel (b), drawn next, distorts the geometry to expose the actual two-surface bending that the thin-lens approximation glosses over.

**Figure 6.4(b): The labeled thin-lens geometry.** Panel (b) follows a single ray through the same thin lens as panel (a), with the geometry deliberately distorted, two surfaces pulled apart, angles enlarged, so every label stays legible. The ray refracts at the front surface, crosses the glass, refracts again at the back, and meets the axis at the image point, turning through the four angles $\theta_1, \theta_2, \theta_3, \theta_4$. At each surface, the local tilt $\theta_S$ is set by the height $c$ at which the ray crosses (brackets $C_1 \approx C_2 \approx C$ because the lens is thin, $d \approx 0$). The object distance $a$, image distance $b$, and negligible thickness $d \approx 0$ are marked below the axis. The paraxial Snell's law at each surface gives the two relations the derivation sums:

$n\,\theta_2 = \theta_1 + \theta_S, \qquad n\,\theta_3 = \theta_4 + \theta_S.$

(Book Figure 6.4(b) and Table 6.1.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_10_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=29177cf821d580ee6291a99dad38baf5" alt="Output from cell 10" width="1260" height="581" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_10_output_1.png" />

**From the diagram to the lensmaker's formula.** The book's Table 6.1 sums the four small-angle Snell relations along the ray's path. Substituting the axis angles $\theta_1 \approx c/a$ and $\theta_4 \approx c/b$, and the surface tilts $\theta_{S_1} \approx c/R_1$ and $\theta_{S_2} \approx c/R_2$, gives

$\frac{1}{a} + \frac{1}{b} = (n-1)\left(\frac{1}{R_1} + \frac{1}{R_2}\right).$

The height $c$ cancels on both sides: every ray from the same object point lands at the same image distance $b$, regardless of where it crosses the lens. Defining

$\frac{1}{f} = (n-1)\left(\frac{1}{R_1} + \frac{1}{R_2}\right)$

gives the lensmaker's formula in the target form:

$\frac{1}{a} + \frac{1}{b} = \frac{1}{f}.$

(Book Figure 6.4(b) and Table 6.1.)

### From flat interface to curved surface

The angles in the lensmaker derivation are measured from each lens surface's *normal*, but the lens's surfaces aren't flat: they're spherical. Two things change with curvature. The normal at the point where a ray strikes the surface is no longer parallel to the optical axis, and the tilt of that normal depends on how far above the axis the ray hits. The next figure pins down that dependence: how the surface's tilt angle $\theta_S$ relates to the radius of curvature $R$ and the hit height $c$.

**Figure 6.5: Relation between $R$ and $\theta_S$.** A spherical surface of radius $R$ is drawn as a full circle centered on the optical axis. A ray meets the surface at height $c$ above the axis. The slanted radius from the center to that hit point makes an angle $\theta_S$ with the horizontal axis-radius: and the same angle reappears at the surface, between the vertical reference direction and the surface normal. In the small triangle formed by the slanted radius, the horizontal axis-radius, and the vertical leg of height $c$, basic trigonometry gives $\sin\theta_S = c/R$. In the paraxial regime, this simplifies to

$\theta_S \approx \frac{c}{R},$

which is exactly what the `surface_angle` helper above returns, and what the lensmaker derivation in Figure 6.4(b) used at each surface. (Book Figure 6.5.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_11_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=e5b3a8277b64b795c939df5add824f0e" alt="Output from cell 11" width="547" height="547" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_11_output_1.png" />

With $\theta_S \approx c/R$ established, the surface-tilt relation above can drop $c$ on both sides: completing the cancellation that lets one image distance $b$ serve every ray from the same object point.

### Off-axis points

The derivation so far placed the object on the optical axis. Off-axis points need only a small extension: rotating the whole construction through a small angle $\theta_R$ adds $\theta_R$ to $\theta_S$ at each surface in Table 6.1, leaving the algebra unchanged. The lensmaker's formula still holds, and the image lands at the conjugate distance $b$ on the far side, at height $P_2 = -b\,P_1 / a$: inverted, below the axis.

In the paraxial, thin-lens limit, this promotes the focusing property from points on an axis to whole planes: every point on the object plane at distance $a$ focuses to a corresponding point on the image plane at distance $b$, both perpendicular to the optical axis.

**Figure 6.6: Off-axis points and the equivalent lens rotation.** The off-axis object point $P_1$ sits at height $P_1$ above the optical axis, at distance $a$ from the lens; $P_0$ marks the on-axis reference. Two rays trace the image: a parallel ray refracts through the focal point at distance $f$, and a ray through the lens center proceeds undeviated. They meet at the image point on the image plane at distance $b$. The angle $\theta_R$ marks the small rotation that makes the off-axis case equivalent to the on-axis derivation. (Book Figure 6.6.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_12_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=19cbfbd1400e5850d0c76f007830829d" alt="Output from cell 12" width="1131" height="360" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_12_output_1.png" />

With Figure 6.6, the derivation is complete: the lensmaker's formula

$\frac{1}{a} + \frac{1}{b} = \frac{1}{f}, \qquad \frac{1}{f} = (n-1)\left(\frac{1}{R_1} + \frac{1}{R_2}\right),$

describes how a thin lens maps every point on an object plane at distance $a$ to a corresponding point on the image plane at distance $b$. The book's [Figure 6.7](https://visionbook.mit.edu/lenses.html#fig-greenLaser), a photograph of a laser pointer swept across a lens with every ray converging to the same spot on the wall, demonstrates the same focusing property physically.

The next section takes the lensmaker's formula and puts it to work: straight-through rays at the lens center, conjugate-point ray tracing, depth of field, concave lenses, and a Galilean telescope built from two of them.

## Imaging with lenses

With the lensmaker's formula in hand, the rest of the chapter puts it to work: predicting where images form, how sharp they are, what changes with a concave lens, and how two lenses combine into a telescope. The starting observation is a small one, but it's what lets the whole apparatus mimic a pinhole camera.

At the very center of a thin lens, the front and back surfaces are parallel. A ray crossing that region refracts at the first surface, then refracts back through the same angle at the second surface: emerging parallel to the way it entered, displaced laterally by a small amount that depends on the lens's thickness. In the *thin*-lens limit, the two surfaces collapse to a single plane: the displacement vanishes and the ray passes straight through. Every direction through the center is undeviated, which means the lens behaves, for those center rays, exactly like a pinhole: and a thin lens therefore images the world in *perspective projection*, just as a pinhole does.

**Figure 6.8: Rays through the center of a thin lens.** **(a)** A physical lens of non-zero thickness: the ray refracts at both surfaces and exits parallel to the incoming direction, with a small lateral displacement. **(b)** The same ray under the thin-lens approximation: the two surfaces collapse to a single plane, the displacement vanishes, and the ray passes straight through. **(c)** Because *every* direction through the center is undeviated, a fan of rays through the lens center behaves identically to a fan of rays through a pinhole. (Book Figure 6.8.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_13_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=a559eced81a6c56a7281aaf40b5c46e1" alt="Output from cell 13" width="1317" height="586" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_13_output_1.png" />

With this observation in place, four properties now characterize how rays travel through a thin lens:

1. **Focusing**: every ray from a point at distance $a$ reconverges at the conjugate distance $b$, with $\frac{1}{a} + \frac{1}{b} = \frac{1}{f}$.
2. **Parallel rays**: the limit $a \to \infty$: parallel rays converge at the focal point, distance $f$ behind the lens.
3. **Center rays**: any ray through the lens center proceeds in a straight line, as panel (c) above shows.
4. **Magnification**: combining the first and third, a plane at distance $a$ images with scale $b/a$: exactly as a pinhole at the lens center would project it.

Two points on opposite sides of the lens at distances $a$ and $b$ that satisfy the lensmaker's formula are called **conjugate points**: light from one focuses to the other, and vice versa. The next figure traces conjugate-point pairs for several object distances, showing how the image distance moves as the object slides toward or away from the lens.

The four ray-tracing rules above pin down the *image distance* for any object distance through $\frac{1}{a} + \frac{1}{b} = \frac{1}{f}$. The two endpoints of the formula are limits: object at infinity, image at $f$; object at $f$, image at infinity: and everything in between trades smoothly between them. The next figure traces five cases on the same lens, holding the focal length fixed and moving the object closer step by step.

**Figure 6.9: Conjugate points for a convex thin lens.** All five panels show the same lens with focal points marked at $\pm f$ from the lens (cyan dots). **(a)** Parallel rays from infinity converge at the right-side focal point: the limiting case $a \to \infty$, $b = f$. **(b)** Object at $a = 3f$ images at $b = 1.5f$. **(c)** Object at $a = 2f$ images symmetrically at $b = 2f$: the unit-magnification case. **(d)** Object at $a = 1.5f$ images at $b = 3f$: as the object moves inward, the image moves outward. **(e)** Object at the left focal point ($a = f$) produces parallel rays on exit: the other limiting case, $b \to \infty$. (Book Figure 6.9.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_14_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=fbe56bd248f2ad7fd284e0f90e7615e1" alt="Output from cell 14" width="1556" height="475" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_14_output_1.png" />

Set the lens up inside a camera. The sensor sits at a fixed distance $b$ behind the lens; the object lives somewhere out in the world at distance $a$. If $a$ and $b$ happen to satisfy the lensmaker's formula, the object is in *focus*: every ray from a surface point converges to a single point on the sensor, and the image is sharp.

But $a$ varies with what the camera is pointed at, and $b$ is fixed by the camera's geometry. When $a$ doesn't quite match the conjugate of $b$, rays from a single object point don't converge at the sensor: they hit it as a small *circle of confusion*. How small can that circle get before the image looks blurry, and how much of the scene stays acceptably sharp at once? That's the **depth of field**, and it's what comes next.

### Depth of field

When the lens lives inside a camera, the sensor sits at a fixed distance behind it, so only one object distance is in sharp focus: the one whose conjugate is the sensor itself. That object distance defines an *object plane* (the *focal plane* in the book's terminology) where everything images sharply. Objects in front of or behind that plane image past or before the sensor, hitting it as a small disk: a *circle of confusion*. A photograph still looks sharp as long as that circle is small enough that the eye can't tell, and the range of object distances over which it stays acceptable is the *depth of field*.

**Figure 6.10: Circle of confusion and depth of field.** Three object positions, one fixed sensor plane. The top row shows an object on the in-focus plane: every ray converges to a single point on the sensor for a sharp image. The middle row shows an object closer than the in-focus plane: its image forms past the sensor, hitting the sensor as a circle of confusion. The bottom row shows an object further than the in-focus plane: its image forms before the sensor, again hitting as a circle of confusion. The bracket on the left marks the depth of field. (Book Figure 6.10.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_15_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=5abf672e0076e77a18b08c1ad6736cfa" alt="Output from cell 15" width="667" height="579" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_15_output_1.png" />

The depth of field is set by the lens's focal length, the maximum circle-of-confusion size that still looks sharp, and the camera's *f-number* $N = f / A$, where $A$ is the aperture diameter. The next figure lays out the variables.

The geometry that turns the circle of confusion into a depth-of-field range is two pairs of similar triangles: one for the near limit, one for the far.

**Figure 6.11: Variables for the depth-of-field calculation.** Two scenes, same focal length, same focused object distance $U$, same circle of confusion $C$ at the sensor: only the aperture differs. The *f-number* $N = f/A$ relates aperture diameter $A$ to focal length: smaller $N$ means a wider aperture. **(Top, $N^a$)** Wider aperture, narrower depth of field: the range $D_1^a$ to $D_2^a$ around $U$ is short. **(Bottom, $N^b$)** Narrower aperture, wider depth of field: same $C$ at the sensor, but a much larger range $D_1^b$ to $D_2^b$ around $U$. (Book Figure 6.11.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_16_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=11ccecd8c9ac2d1c67d1cfaba5e93185" alt="Output from cell 16" width="1046" height="699" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_16_output_1.png" />

The two similar-triangle pairs in Figure 6.11 yield expressions for $D_1$ and $D_2$ that, when solved and summed, give the exact depth of field:

$D = \frac{2 N C U^2 f^2}{f^4 - N^2 C^2 U^2}.$

For the practical regime $C \ll f/N$, the second term in the denominator drops out and the formula collapses to a clean proportionality:

$D \approx \frac{2 N C U^2}{f^2}.$

Depth of field is *linear* in $N$. Doubling $N$ doubles the in-focus range: but the light hitting the sensor falls as $1/N^2$, so the same scene needs four times the exposure. The next figure shows the trade-off on a real (synthetic) ruler.

**Figure 6.12: Photographic depth of field as a function of aperture.** One sharp photograph of a ruler, blurred at each pixel by an amount proportional to its depth offset from the focal plane and scaled by $1/N$: recreating the book's [Figure 6.12](https://visionbook.mit.edu/lenses.html#fig-rulers) photographic demonstration. **(a) $f/2$:** narrow sharp band, blurred ends. **(b) $f/4$:** doubled DOF. **(c) $f/8$:** nearly the whole ruler sharp. (Book Figure 6.12. Recreated by applying a Gaussian blur with $\sigma \propto 1/N$; the $f/2$ reference blur is calibrated visually.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_17_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=7eebd49953ed785811cc6fda2a545e4d" alt="Output from cell 17" width="1056" height="549" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_17_output_1.png" />

The photographic trade-off, wider aperture, more light but shallower DOF, is what the formula $D \approx 2NCU^2/f^2$ makes quantitative. The next part turns the lens curvature inside out and asks what changes with a *concave* lens.

### Concave lenses

The lens designed above was *convex*: both surfaces bowing outward, focal length positive. Reverse the curvature on both surfaces and you get a *concave* lens, with both surfaces bowing inward. In the lensmaker's formula

$\frac{1}{f} = (n-1)\left(\frac{1}{R_1} + \frac{1}{R_2}\right),$

a concave surface contributes the same magnitude with the opposite sign, so $f$ comes out *negative*. The same paraxial geometry that focuses rays to a real point past a convex lens now bends them *away* from the axis at a concave lens: but the back-projection of those diverging rays still meets at a single point, on the *source side* of the lens. That point is the lens's *virtual* focal point.

**Figure 6.13: Convex and concave thin-lens behavior.** **(a)** A convex lens with focal length $+f$: parallel rays from the left converge to a *real* focal point at distance $f$ past the lens. **(b)** A concave lens with focal length $-f$: parallel rays diverge after the lens, but their back-projections (dotted) meet at a *virtual* focal point at distance $f$ on the source side. **(c)** Same concave lens with a tilted parallel bundle: the virtual focal point shifts off-axis (cyan), just as the focal point in a convex lens shifts to image off-axis sources: the lensmaker's formula handles both cases with one sign change. (Book Figure 6.13.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_18_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=89d4353e472c1d409eb93839cba9c27b" alt="Output from cell 18" width="993" height="319" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_18_output_1.png" />

A concave lens alone can't form a real image: it diverges every bundle it sees. But paired with a convex lens, that diverging behavior becomes useful: if the concave lens sits at the convex lens's focal point, the two together turn a converging bundle back into parallel rays: at a *different* angle than they entered. That angular amplification is the principle behind the Galilean telescope, which comes next.

### Lenses in a telescope

A convex lens and a concave lens together form a *Galilean telescope*, named after the one Galileo built in 1609. The construction is simple: place a convex lens (lens 1, focal length $f_1$, long) with a concave lens (lens 2, focal length $f_2$, shorter) such that they share a common focal point: lens 1 is distance $f_1$ to the left of that shared point, lens 2 is distance $f_2$ to the same side. The lenses sit $f_1 - f_2$ apart. In that configuration, parallel rays entering lens 1 converge toward the shared focal point, and lens 2, intercepting them before they reach it, refracts them back into a parallel bundle. The output bundle is parallel like the input, but compressed into a smaller cross-section.

What makes it a *telescope* is what happens when the input direction tilts.

**Figure 6.14: Galilean telescope geometry.**

**(a) Parallel input, parallel output.** Three parallel rays enter lens 1 from the left, converge toward the shared focal point, and are intercepted by lens 2 before reaching it: refracting back into a parallel bundle on the right. The output rays are parallel like the input, but closer together, compressed into the smaller exit aperture.

**(b) Tilted input, angular magnification.** When the input bundle tilts at angle $\delta_i$ from the optical axis, the chief ray through lens 1's center reaches the shared focal point at height $d = f_1 \delta_i$ above the axis (small-angle approximation, property 3 above). The same point $d$ is at distance $f_2$ from lens 2, which refracts the bundle into a parallel output at angle $\delta_o = d / f_2$ from the axis. The two similar triangles share the height $d$ but have different base lengths $f_1$ and $f_2$, giving the magnification $M = \delta_o / \delta_i = f_1 / f_2$. (Book Figure 6.14.)

<img src="https://mintcdn.com/aegeanaiinc/leRhZGPh3YAmV0oH/aiml-common/lectures/sensor-models/cameras/lenses/images/cell_19_output_1.png?fit=max&auto=format&n=leRhZGPh3YAmV0oH&q=85&s=d0faf5b22606bc37d1583ce141247c4b" alt="Output from cell 19" width="1211" height="900" data-path="aiml-common/lectures/sensor-models/cameras/lenses/images/cell_19_output_1.png" />

With $f_1 > f_2$ the telescope magnifies. Galileo built his at $M \approx 30$ by pairing a long convex objective with a short concave eyepiece; the book's [Figure 6.15](https://visionbook.mit.edu/lenses.html#fig-homemade) and [Figure 6.16](https://visionbook.mit.edu/lenses.html#fig-moon) show a cardboard recreation ($M \approx 27$ from $f_1 = 500$ mm, $f_2 = 18$ mm) and the moon through it, alongside Galileo's own lunar drawings.

With this, the imaging part is complete. This section has worked from Snell's law through the lensmaker's formula and used it for imaging, depth of field, concave lenses, and the telescope.

***

<Callout icon="pen-to-square" iconType="regular">
  [Edit this page on GitHub](https://github.com/aegean-ai/eaia/edit/main/src/aiml-common/lectures/sensor-models/cameras/lenses/index.mdx) or [file an issue](https://github.com/aegean-ai/eaia/issues/new/choose).
</Callout>
