---
title: Lenses and imaging
heading: Focal length, f-numbers and the smallest spot a lens can make
eyebrow: B8 · Lesson 14 · Lenses and imaging
xp: 40
---

::: hook
A phone camera puts a whole scene onto a sensor smaller than a fingernail, with each pixel about a micrometer across. A chip-making scanner uses lenses to print transistors a few dozen nanometers wide. Both depend on two things: geometry, which says where a lens forms its image, and diffraction (lesson 10), which says how sharp that image can be. Refraction at curved glass surfaces (lesson 13) bends every ray from one point of an object back to one point of the image.
:::

::: play
- An object 20 mm tall stands a distance $d_o$ to the left of a thin lens of focal length $f$. Three rays from its tip: one parallel to the axis, one through the lens center, one through the front focal point.
- Where the three rays cross is the image. Move the object toward the lens and watch the image grow and move away.
- Bring the object inside the focal length. The rays no longer meet on the right: the image becomes virtual, as in a magnifying glass.
:::
:::

```sim plot
view: graph
x: x = -400..400 mm
y: y = -60..60 mm
slider: d = 60..380 step 1 = 200 mm
slider: f = 20..120 step 1 = 80 mm
plot: 20 - 20*x/f*step(x) | label: parallel ray | samples: 801
plot: -20*x/d | label: center ray | color: ch2 | samples: 801
plot: step(-x)*20*(x + f)/(f - d) + step(x)*20*f/(f - d) | label: focal ray | color: ch3 | samples: 801
marker: x = -d | label: object
marker: x = f | label: focus
readout: image distance, mm = 1/(1/f - 1/d) | digits: 4
readout: magnification = -(1/(1/f - 1/d))/d | digits: 3
```

::: predict
## A camera lens with a 50 mm focal length photographs a person 2 m away. Where must the sensor sit?

- [ ] Exactly 50 mm behind the lens
- [x] A little more than 50 mm, about 51 mm
- [ ] 2 m behind the lens
- [ ] About 100 mm behind the lens

::: reveal
About 51 mm. From $\frac{1}{d_o} + \frac{1}{d_i} = \frac1f$, $d_i = \frac{1}{1/50 - 1/2000} = 51.3$ mm. For distant objects the image sits at the focal length; focusing on something closer moves the lens slightly away from the sensor, which is what the focus motor does.
:::
:::

::: nameit
## The thin lens equation

A thin lens of focal length $f$ brings light from an object at distance $d_o$ to a focus at distance $d_i$ behind it:

$$\frac{1}{d_o} + \frac{1}{d_i} = \frac{1}{f} \qquad m = -\frac{d_i}{d_o}$$

The magnification $m$ is negative for a real, upside-down image. Light from very far away focuses at $d_i = f$. With the object inside the focal length, $d_i$ comes out negative: a **virtual** image on the object's side, upright and enlarged, as in a magnifier. Diverging lenses have negative $f$. The **power** $1/f$ is measured in diopters (1/m), and thin lenses in contact add their powers.

## Where the focal length comes from

For a thin lens of index $n$ in air with surface radii $R_1$ and $R_2$ (positive when the center of curvature lies beyond the surface, to the right):

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

## Cameras

The **f-number** $N = f/D$ is the focal length over the aperture diameter. The light reaching each point of the sensor goes as $1/N^2$, so each "stop" ($N$ = 1.4, 2, 2.8, 4, ...) is a factor of $\sqrt2$ in $N$ and halves the light. The field of view across a sensor of width $w$ is $2\tan^{-1}\frac{w}{2f}$.

## The diffraction limit

Even a perfect lens focuses a point to a spot, the Airy disk, whose dark ring has diameter

$$2.44\lambda N$$

At f/2.8 in green light that's 3.8 µm, a few phone pixels; at f/16, 21 µm. Microscopes and lithography quote the **numerical aperture** NA $= n\sin\theta$ of the cone of light instead: the smallest printable feature in lithography is about $k_1\lambda/\text{NA}$, with $k_1$ around 0.3 in production. With 193 nm light and water immersion (NA 1.35) that's about 43 nm.
:::

::: example
## A 50 mm lens photographs a person 1.8 m tall standing 2 m away. Where is the image and how big is it?

::: solution
1. **Image distance.** In millimeters,
   $$\begin{aligned} d_i &= \frac{1}{1/50 - 1/2000} \\ &= 51.3\ \text{mm} \end{aligned}$$
2. **Magnification.**
   $$\begin{aligned} m &= -\frac{51.3}{2000} \\ &= -0.0256 \end{aligned}$$
3. **Image height.**
   $$1800\ \text{mm} \times 0.0256 = 46\ \text{mm}$$
   upside down. That's taller than even the 36 mm long side of a full-frame 36 × 24 mm sensor turned on end, so from 2 m the whole person won't fit in the frame.

**Answer:** the image forms 51.3 mm behind the lens, 46 mm tall and upside down.
:::
:::

::: example
## A glass lens ($n$ = 1.5) has both surfaces curved with radius 100 mm, bulging outward. What is its focal length?

::: solution
1. **Signs of the radii.** Bulging outward on both sides: $R_1 = +100$ mm and $R_2 = -100$ mm.
2. **Lensmaker's equation.** In millimeters,
   $$\begin{aligned} \frac1f &= 0.5\left(\frac{1}{100} + \frac{1}{100}\right) \\ &= 0.01 \end{aligned}$$
3. **Focal length and power.** So $f$ = 100 mm, a power of 10 diopters.

**Answer:** the focal length is 100 mm, a power of 10 diopters.
:::
:::

::: example
## Reading glasses of +2.5 diopters are held close to the eye. Where does a page 25 cm away appear?

::: solution
1. **Focal length.**
   $$\begin{aligned} f &= \frac{1}{2.5}\ \text{m} \\ &= 0.4\ \text{m} \end{aligned}$$
2. **Image distance.** From $\frac1{d_o} + \frac1{d_i} = \frac1f$:
   $$\begin{aligned} \frac{1}{d_i} &= 2.5 - 4 \\ &= -1.5\ \text{m}^{-1} \end{aligned}$$
   so $d_i = -0.67$ m.
3. **What the sign means.** The negative sign means a virtual image on the page's side of the lens, 67 cm away.
4. **Why it helps.** An eye that can no longer focus closer than about 60 cm sees the page comfortably through the lens. Optometrists work in diopters because the powers of lenses in contact simply add.

**Answer:** the page appears 67 cm away, as a virtual image on the page's side of the lens.
:::
:::

::: check
given: f = 25 | 50 | 85; d = 300 | 1000 | 5000
answer: 1/(1/f - 1/d)
unit: mm
tolerance: 0.2%

## A lens of focal length {f} mm images an object {d} mm away. Where is the image?

::: right
Right. $d_i = \frac{1}{1/f - 1/d_o}$ = {answer}.
:::

::: misses
- [1/(1/f + 1/d)] The object and image terms add up to $1/f$: subtract to find $1/d_i$.
- [any] Not yet. Solve $\frac{1}{d_o} + \frac{1}{d_i} = \frac1f$.
:::
:::

::: check
given: f = 50 | 100; d = 150 | 400
answer: -(1/(1/f - 1/d))/d
tolerance: 0.5%

## An object sits {d} mm from a lens of focal length {f} mm. What is the magnification?

::: right
Right. $-\frac{d_i}{d_o}$ = {answer}: the image is inverted.
:::

::: misses
- [(1/(1/f - 1/d))/d] A real image is upside down, so the magnification is negative.
- [-d/(1/(1/f - 1/d))] It's image distance over object distance.
- [any] Not yet. Find $d_i$, then $m = -d_i/d_o$.
:::
:::

::: check
given: n = 1.5 | 1.7; R1 = 50 | 120; R2 = 80 | 200
answer: 1/((n - 1)*(1/R1 + 1/R2))
unit: mm
tolerance: 0.5%

## A lens of index {n} bulges outward on both sides, with radii {R1} mm and {R2} mm. What is its focal length?

::: right
Right. With $R_2$ negative, $\frac1f = (n - 1)\left(\frac{1}{R_1} + \frac{1}{|R_2|}\right)$: {answer}.
:::

::: misses
- [1/((n - 1)*(1/R1 - 1/R2))] The second surface curves the other way, so its $R$ is negative.
- [any] Not yet. Use the lensmaker's equation with signs.
:::
:::

::: check
given: f = 4 | 26 | 50; N = 1.8 | 2.8 | 8
answer: f/N
unit: mm
tolerance: 0.5%

## A {f} mm lens is set to f/{N}. How wide is its aperture?

::: right
Right. $D = f/N$ = {answer}.
:::

::: misses
- [f*N] The f-number is focal length over diameter.
- [any] Not yet. $D = f/N$.
:::
:::

::: check
given: lam = 450 | 550 | 650; N = 1.8 | 4 | 11
answer: 2.44*lam/1000*N
unit: µm
tolerance: 0.5%

## How wide is the diffraction-limited spot (to the first dark ring) at f/{N} for {lam} nm light?

::: right
Right. $2.44\lambda N$ = {answer}.
:::

::: misses
- [1.22*lam/1000*N] That's the radius; the diameter is $2.44\lambda N$.
- [any] Not yet. Airy disk diameter, $2.44\lambda N$.
:::
:::

::: check
given: w = 6 | 36; f = 4 | 24 | 50
answer: 2*atan(w/(2*f))*180/pi
unit: °
tolerance: 0.5%

## A sensor {w} mm wide sits behind a {f} mm lens focused far away. What horizontal field of view does it see?

::: right
Right. $2\tan^{-1}\frac{w}{2f}$ = {answer}.
:::

::: misses
- [atan(w/(2*f))*180/pi] That's half the field; double it.
- [any] Not yet. Each half of the sensor subtends $\tan^{-1}(w/2f)$.
:::
:::

::: check
kind: parts
given: f = 50 | 100; u = 150 | 300

## An object sits {u} mm from a thin lens with focal length {f} mm.

::: part
answer: 1/(1/f - 1/u)
unit: mm
tolerance: 0.5%

### Where is the image?

::: misses
- [1/(1/f + 1/u)] $\frac1{d_i} = \frac1f - \frac1{d_o}$.
- [any] The thin lens equation.
:::
:::

::: part
answer: f/(u - f)
tolerance: 0.5%

### How large is the image relative to the object?

::: misses
- [any] $|m| = \frac{d_i}{d_o} = \frac{f}{d_o - f}$.
:::
:::
:::

::: check
kind: derivation
vars: f = 0.01..1, u = 1.5..20

## An object sits u focal lengths from a thin lens of focal length f.

::: step
answer: f*u/(u - 1)

### Where is the image?
:::

::: step
answer: 1/(u - 1)

### What is the magnification's size?
:::

::: right
Right. As the object nears the focal point (u → 1), the image runs off to infinity and grows without limit.
:::
:::

::: explain
## Why does closing down a camera's aperture make the image sharper at first, then softer again?

::: model
Real lenses have aberrations: rays through the edge of the lens focus at slightly different places than rays through the middle. Closing the aperture blocks the edge rays, so the blur from aberrations shrinks. But a smaller aperture also widens the diffraction spot, whose diameter grows in proportion to the f-number. At wide apertures aberrations dominate and stopping down helps; past some f-number, diffraction dominates and the image softens. Lenses are usually sharpest a couple of stops down from wide open.
:::
:::

::: practice

::: check
given: f = 20 | 50 | 250
answer: 1000/f
tolerance: 0.5%

## What is the power of a lens with a focal length of {f} mm, in diopters?

::: misses
- [any] $1/f$ with $f$ in meters.
:::
:::

::: check
given: N1 = 2 | 4; N2 = 5.6 | 8
answer: (N2/N1)^2
tolerance: 0.5%

## A lens is stopped down from f/{N1} to f/{N2}. By what factor does the light reaching the sensor fall?

::: misses
- [N2/N1] Light goes as $1/N^2$.
- [any] $(N_2/N_1)^2$.
:::
:::

::: check
given: lam = 193 | 248; NA = 0.93 | 1.35
answer: 0.3*lam/NA
unit: nm
tolerance: 0.5%

## A lithography scanner uses {lam} nm light with NA = {NA}. About what feature size can it print, with $k_1$ = 0.3?

::: misses
- [any] $k_1\lambda/\text{NA}$.
:::
:::
:::
