Lens Equation

A converging lens is characterized by collecting parallel light rays in a focal point F. As a consequence, light emitted from a point in an object plane (parallel to the lens, at a finite distance) is collected in a single point in a corresponding image plane (also parallel to the lens). For a thin converging lens where its thickness along the optical axis (drawn as a horizontal blue line) is small compared to its focal length, the situation looks as shown in fig. 1.

lens equation

Fig. 1.

The thin lens equation.

The lens equation describes the relation between focal length f of the lens, object distance g (between object and lens) and image distance h (between lens and image sensor or film) when the image of the object appears sharp. It can be derived as follows.

By similar triangles along the purple ray passing through F left of the lens, we have

G / (g - f) = H / f (L1)

Likewise, by similar triangles along the purple ray through F right of the lens, we get

G / f = H / (h - f) (L2)

Solving both equations for G / H results in

(g - f) / f = f / (h - f) (L3)

After some simple algebraic transformations, the equation looks like this

g h = f h + f g (L4)

After division by f g h, we get the well-known form

1 / f = 1 / g + 1 / h (L5)

This equation is known as the lens equation or thin lens formula.

Focusing distance

When the lens is focused, it is actually moved back or forth such that the lens equation is satisfied, i.e. the distances g and h are adjusted. However, the focusing distance d which you can read and set on your lens measures the full distance between object and image plane, i.e.

d = g + h (L6)

To calculate g and h for a given distance d, we solve equation (L6) for h and substitute it into the lens equation (L5)

1 / f = 1 / g + 1 / (d - g) (L7)

With some algebra, we end up with a quadratic equation

g² - g d + f d = 0 (L8)

This equation has (at most) two different real solutions, given by

g = d / 2 ± sqrt (d² / 4 - f d) (L9)

where sqrt denotes the square root. With equation (L6), we also get

h = d / 2 ± sqrt (d² / 4 - f d) (L10)

For simplicity, we define the root term as

r = sqrt (d² / 4 - f d) (L11)

If we add r in equation (L9), we must subtract it in equation (L10), and vice versa. In practice, the vast majority of lenses are constructed such that the distance g between object and lens can be much larger than the distance h between lens and image sensor. Otherwise, you could not focus at infinity (I am only aware of one such lens, the dedicated macro lens Canon MP-E 65mm). Thus, we set

g = d / 2 + r (L12)
h = d / 2 - r (L13)

These equations are surprisingly powerful to calculate e.g. the magnification or depth of field of a lens.