Question: I am photographing a scene with white and black elements in it. Starting at the f/22 stop, I widen the aperture one stop and decrease the exposure time by a factor of 2, take a picture, and keep doing this for all the f-stops on the lens. My expectation is that raw counts should stay the same inside a white region or a black region since **halving the exposure time compensates for widening the aperture**. But when I select a white region and average its pixel raw counts for each image, there is **variability between the images** (the standard deviation of the raw counts is ~5% of the mean). Same thing if I select and average a black region. I am not knowingly changing anything else (illumination, camera position), and the camera is a scientific CMOS. What could be causing this variation: noise, or something more systematic?

Answer: 
The short answer is yes... they cancel. But there are some nuances.

Each time the diameter of a circle increases (or decreases) by a factor equal to the square root of 2 (approximately 1.4) the area of that circle is exactly doubled (or halved if decreased). The f-stop numbers are all based on powers of the square root of 2 (e.g. f/1 = √2^0; f/1.4 = √2^1; f/2 = √2^2; f/2.8 = √2^3; etc.)

Shutter exposures are more intuitive. 1/500th sec is obviously half as long as 1/250th sec, etc.

The nuances:

Cameras do a bit of rounding. E.g. if you have a 100mm lens it's probably not *precisely* 100mm (but it's probably not far off) and as you refocus, the lens may do a bit of focus breathing (for a good lens that stays with 5% of the stated focal length ... but some lenses have rather strong focus-breathing issues ... e.g. 30%. When this happens, it means the f-stop isn't strictly accurate.

F-stops aren't strictly accurate as it is. But they are "close enough" that the margin of error wont impact the exposure in a noticeable way. 

There are other issues. When you shoot heavily stopped down (e.g. f/22), all light comes from a very small area near the center of the lens axis and is distributed across the sensor more evenly. When you shoot wide-open, light comes from a wide range of angles. Areas of the sensor near the center can collect light from many angles, but areas of the sensor near an edge or corner are more limited on the number of paths light can take through the lens to reach that particular spot. This results in vignetting. So while you can take two photos using "equivalent exposures" (trading a stop of aperture for a stop of shutter duration), changes in vignetting patterns can cause pixels to have a different amount of collected light depending on the pixel you choose to inspect.
I think it wasn't mentioned: with increase in exposure time comes increase in thermal Dark Shot noise. You can read more [here](https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=10773), for example

[![enter image description here](https://i.stack.imgur.com/AFRfb.gif)](https://i.stack.imgur.com/AFRfb.gif)