The lens aperture is an important part of the exposure system. It performs two functions; the primary function is to regulate the amount of light that can be transmitted through the lens. A secondary function is controlling Depth-of-Field (DoF). To understand how the aperture works, it is useful to see how a lens is constructed, as shown below in this simplified lens:
The aperture in modern lenses is "adjustable", and can be controlled in several ways; from the camera by the photographer manually adjusting it, from the camera's automatic exposure system, and with some lenses, an adjustable ring on the lens itself.
While apertures are continuously adjustable, certain values along this variable have been designated as standard values. Aperture values have a numbering system, called f. The standard values have a mathematical relationship to each other. Each value, called a "stop" is either a doubling or halving of light output, and is based on the Inverse Square Law. These stops are more commonly called f-stops.
If there is a 1-stop difference from one value to another, it constitutes a doubling or halving of light. A 2-stop difference is twice doubled or twice halved (4 times the difference). Another unit of measurement is sometimes used, called the Exposure Value, or EV. 1 EV and 1-stop are equivalent.
When an aperture is adjusted so that it has the smallest opening, it is at it's minimum, or said to be "stopped down". Conversely, when the aperture is opened up to it's maximum opening, it is "Wide Open". Oddly enough the number assigned to each aperture value is inversely proportional to the opening, so that when the aperture is at it's minimum, it's number is at the maximum. For example, a lens with a variable f/2.8 to f/22 aperture; if it is at f/2.8, it is at it's maximum - wide open state, and if at f/22 it is at it's minimum opening. This has been the source of much confusion, but there is a reason this is so.
The true focal length measurement is from the sensor (focal plane) to the optical center of the lens - not the end of the lens.
The aperture value is actually a ratio of the lens focal length vs. the aperture diameter. Consider a lens focal length of 100mm. If the aperture value is f/4.0, that means there is a ratio of 1:4.0, and the aperture's diameter would be 25mm (100mm / 4). As the aperture gets smaller, the ratio of the aperture ratio increases. That is the reason for larger aperture openings having a lower number than smaller openings.
The F-Stop scale shown below is more-or-less standardized for lens aperture values. It is known as a 1/3 f-stop scale, as each number increments by 1/3rd EV. Standard 1-stop units are shown in Red. For example, there is a 1-stop (or 1 EV) difference between f/2.0 and f/2.8, and a 1/3rd stop (0.3 EV) difference between f/2.0 and f/2.2.
Understanding aperture and how the values increase and decrease is an essential pre-requisite to knowing how to use your camera's manual exposure mode.
Diffraction is an undesirable characteristic of the aperture. Any aperture smaller than f/11 usually results in diffraction, which is the softening (blurring) of the photograph. For most lenses, f/8 is the ideal aperture for maximum depth-of-field and maximum sharpness. Generally try to avoid smaller apertures than f/11 for normal photography.
An exception is macro (close up) photography. As your camera is extremely close to your subject in macro, the depth-of-field is often wafer-thin, only a few millimeters. For macro use, lenses can go as high as f/64, and are often required to obtain a depth-of-field wide enough for the entire subject to be focus. Although diffraction occurs at these tiny apertures, it is minor in contrast to the depth-of-field.
Zoom lenses, especially consumer grade lenses, have "variable" apertures. Do not confuse this with an "adjustable" aperture as described above. Due to optical characteristics, when you vary the zoom (focal length) on a consumer grade zoom lenses, the minimum apreture will change.
For example, consider a 100~200mm lens having an aperture of f/2 at 100mm. That means the opening of the aperture would be 50mm (100mm / 2). However, if you zoom out to 200mm, and the aperture is not changed, something happens. The aperure is still 50mm, but now the focal length is 200mm, and since 200mm /50mm = 4, the aperture is now f/4.
Such a lens would have a numbering scheme as follows:
This means that at 100mm, the aperture is f/2. But at 200mm, the aperture is f/4. So the aperture (and more importantly, it's light gathering capability) is reduced by 50% at the 200mm focal length, even though the actual aperture diameter (50mm) has not changed.
So how is this possible? It is a function of physics. The longer the focal length is, the less light is transmitted. You can do an experiment yourself to confirm this. Find a long cardboard tube, the kind used for gift wrap. Cut a 2ft section and a 1f section of the tube. Then look through the end of each tube. You will find that the longer tube will appear darker inside the tube than the shorter tube - even though the diameter of the tube has not changed. This same thing is happening with consumer-grade lenses.
Pro lenses. By using sophisticated mechanics, a zoom lens can be made to increase it's optical diameter as the zoom length is increased. this requires a highly machined lens body and complex optics. Professional lenses are manufactured this way, and for those lenses, the aperture is constant. For instance, the popular 70-200mm f/2.8 is a professional grade lens, and the aperture diameter actually increases as the lens is zoomed in, which results in the f number being constant.
This is one reason why professional grade lenses are so costly, as this capability carries a price tag. In contrast, consumer grade lenses are more simple in design, and their apertures vary with the zoom length.
In conclusion, it should be noted that we have been discussing the maximum aperture (largest opening). In all cases, the lens is typically adjustable to a smaller aperture. So a lens advertised with an aperture of f/3.5~4.5 can stop down to f/22 or so regardless if it is zoomed in or zoomed out.