This article is from the Photographic Lenses Tutorial, by David Jacobson with contributions by others.
We define more symbols
D diameter of the entrance pupil, i.e. diameter of the aperture as seen from the front of the lens N f-number (or f-stop) D = f/N, as in f/5.6 Ne effective f-number, based on geometric factors, but not absorption
Light from an object point spreads out in a cone whose base is the entrance pupil. (The lens elements in front of the diaphragm form a virtual image of the physical aperture. This virtual image is called the entrance pupil.)
Analogous to the entrance pupil is the exit pupil, which is the virtual image of the aperture as seen though the rear elments.
Let us define Ne, the effective f-number, as
Ne = 1/(2 sin(thetaX))
where thetaX is the angle from the axis to the edge of the eXit pupil as viewed from the film plane. It can be shown that for any lens free of coma the following also holds
Ne = M/(2 sin(thetaE)).
We will ignore the issue of coma throughout the rest of this document.
The first equation deals with rays converging to the image point, and is the basis for depth of field calculations. The second equation deals with light captured by the aperture, and is the basis for exposure calculations.
This section will explain the connection between Ne and light striking the film, relate this to N, and show to compute Ne for macro situations.
If an object radiated or reflected light uniformly in all directions, it is clear that the amount of light captured by the aperture would be proportional to the solid angle subtended by the aperture from the object point. In optical theory, however, it is common assume that the light follows Lambert's law, which says that the light intensity falls off with cos(theta), where theta is the angle off the normal. With this assumption it can be shown that the light entering the aperture from a point near the axis is proportional to sin^2(thetaE), which is proportional to the aperture area for small thetaE.
If the magnification is M, the light from a tiny object patch of unit area gets spread out over an area M^2 on the film, and so the relative intensity on the film is inversely proportional to M^2. Thus the relative intensity on the film, RI, is given by
RI = sin^2(thetaE)/M^2 = 1/(4 Ne^2)
with the second equality by the defintion of Ne. (Of course the true intensity depends on the subject illumination, etc.)
For So very large with respect to f, M is approximately f/So and sin(thetaE) is approximately (D/2)/So. Substituting these into the above formula get that RI = ((D/2)/f)^2 = 1/(4N^2), and thus for So >> f,
Ne = D/f = N.
For closer subjects, we need a more detailed analysis. We will take D = f/N as determining D,
Let us go back to the original approximate formula for the relative intensity on the film, and substitute more carefully
RI = sin^2(thetaE)/M^2 = ((D/2)^2/((D/2)^2+(So-zE)^2))/M^2
where zE is the distance the entrance pupil is in front of the front principal point.
However, zE is not convenient to measure. It is more convenient to use "pupil magnification". The pupil magnification is the ratio of exit pupil diameter to the entrance pupil diameter.
p pupil magnification (exit_pupil_diameter/entrance_pupil_diameter)
For all symmetrical lenses and most normal lenses the aperture appears the same from front and rear, so p~=1. Wide angle lenses frequently have p>1. It can be shown that zE = f*(1-1/p), and substituting this into the above equation, carrying out some algebraic manipulations, and solving with RI = 1/(4 Ne^2) yields
Ne = Sqrt((M/2)^2 + (N*(1+M/p))^2).
If we further assume thetaE is small enough that sin(thetaE) ~= tan(thetaE), the (M/2)^2 term drops out and we get
Ne = N*(1+M/p).
This is the standard equation, and will be used throughout the rest of this document. The essence of the approximation is the distinction between the axial distance to plane of the entrance pupil and the distance along the hypotnuse to the edge of the entrance pupil, which is the really correct form. Clearly in typical photographic sitations that distinction is insignificant.
An alternative, but less fundamental, derivation is based on the relative illumination varying with the inverse square of the distance from the exit pupil to the film. This distance is just f*(1+M) - zX, where zX is the distance the exit pupil is behind the rear principal point. It can be shown that zX = -f*(p-1), so Ne/N = (f*(1+M)+f*(p-1))/(f+f*(p-1)) = 1+M/p, and hence Ne = N*(1+M/p).
It is convenient to think of the correction in terms of f-stops (powers of two). The correction in powers of two (stops) is 2*Log2(1+M/p) = 6.64386 Log10(1+M/p). Note that for most normal lenses p=1, so the M/p can be replaced by just M in the above equations.