Depth of field
From Academic Kids

In film and photography, the depth of field is the distance in front of and behind the subject which appears to be in focus. For any given lens setting, there is only one distance at which a subject is in focus, but focus falls off gradually on either side of that distance, so there is a region in which the blurring is tolerable. This region is greater behind the point of focus than it is in front, as the angle of the light rays change more rapidly; they approach being parallel with increasing distance.
Several factors determine whether the objective error in focus becomes noticeable. Subject matter, movement, the distance of the subject from the camera, and the way in which the image is displayed all have an influence. However, the most important factor is the actual degree of error in relation to the area of film exposed.
Light from a point source at the correct distance will produce the image of a point on the film. A point farther away or nearer will produce the image of a disk whose border is known as "circle of confusion." The diameter of these circles increases with distance from the point of focus and so can be used as the measure of error.
Depth_of_field_diagram.png
For a 35 mm motion picture, the image area on the camera negative is roughly 0.87 by 0.63 in (22 by 16 mm). The limit of tolerable error is usually set at 0.002 in (0.05 mm) diameter. For 16mm film, where the image area is smaller, the tolerance is stricter, .001 in (0.025 mm). Standard depth of field tables are constructed on this basis, although generally 35 mm productions set it at 0.001 in (0.025 mm).
(A table for 35 mm still photography would be somewhat different since more of the film is used for each image and the amount of enlargement is usually much less.)
Example of how the Fnumber affects depth of field. Above, from top to bottom: f/22, f/8, f/4, f/2.8. 
Depth of field can be anywhere from a fraction of an inch to virtually infinite. For instance a shot of a woman's face in closeup may have shallow depth of field (with someone just behind her visible but out of focus—common, for instance, in melodramas and horror films); a shot of rolling hills would be likely to have great depth of field, with the objects both in the foreground and in the background in focus.
Depth of field can be calculated from the focal length of the lens, the effective diameter of the lens opening and the cameratosubject distance. While it is commonly said that lenses of short focal length have greater depth of field than long lenses, this is not actually true. For a given subject and aperture, lenses of all focal lengths have exactly the same depth of field.
This is a hard concept to understand and requires some explanation. Take a photographer using a 400 mm lens to shoot a subject (for example, a bird) 10 metres away. Assuming an aperture of f/2.8, the depth of field of this shot would be 10 cm. Should the photographer now switch to a 50 mm lens, the depth of field at 10 metres is now 7.62 metres. However, once the photographer has moved to 1.25 metres from the bird, being the distance required such that the bird fills as much of the frame as it did with the 400 mm lens at 10 metres, the depth of field is exactly the same as before, 10 cm.
The important thing to understand is that for any given subject, the depth of field is only dependent on the aperture and subject distance. The common saying that short lenses have greater depth of field than long lenses has nothing to do with the physical properties of the lens but rather how lenses of each type tend to be used, long lenses are often for distant subjects, whereas wide angle lenses are often used up close.
For any given lens, the depth of field increases as the distance to the point of focus increases up to the hyperfocal distance (see below). As the point of focus moves beyond the hyperfocal distance the field extends to infinity, but the distance to the nearest point of acceptable clarity increases, so the total depth of field actually decreases.
The aperture controls the effective diameter of the lens opening. Reducing the aperture size increases the depth of field, however, it also reduces the amount of transmitted light placing a practical limit on the extent to which the aperture size may be reduced. In photography lenses almost invariably work best at medium apertures. Motion pictures make only limited use of this control. To produce a consistent image quality from shot to shot, cinematographers usually choose a single aperture setting for interiors and another for exteriors and adjust exposure through the use of camera filters or light levels. Aperture settings are adjusted more frequently in still photography, where variations in depth of field are used to give a variety of special effects. In photolithography, where extremely shallow depths of field on the order of a few micrometres are common, the proper aperture setting is critical.
Lens_aperture_side.jpg
For any given lens and aperture, the depth of field is maximized by focusing the lens at the hyperfocal distance. The hyperfocal distance is the point of focus chosen to create a depth of field from infinity to a near point that is half of the hyperfocal distance. For example if a lens is focused at infinity and the closest point of acceptable sharp focus is 10 m away (the hyperfocal distance), the depth of field will extend from 10 m to infinity. If now the lens is focused on a point 10 m away (at the hyperfocal distance), the depth of field will still extend to infinity, but the nearest point of acceptable sharp focus will be 5 m, maximizing the depth of field. If the lens is focused on a point closer than the hyperfocal distance, the depth of field will no longer extend to infinity greatly reducing the depth of field.
In photolithography depth of field is taken to the extreme, as the variations in physical distance across a semiconductor chip may be a few micrometers. Even this small variation causes some distortion in the projected image, and results in unwanted variations in the resulting pattern. To mimimize this distortion, chip makers like IBM are using chemical mechanical polishing machines to make the wafers even flatter before lithographic patterning.
Formulas
Let H be the hyperfocal distance, let S be the distance from the camera to the object, let F be the focal length, let D_{F} be the distance from the camera to the far limit of depth of field, and let D_{N} be the distance from the camera to the near limit of depth of field.
External links
 Depth of field calculator (http://www.dofmaster.com/dofjs.html)
 Demonstration that all focal lengths have identical depth of field (http://www.luminouslandscape.com/tutorials/dof2.shtml)
 Depth of Field (http://www.cambridgeincolour.com/tutorials/depthoffield.htm): illustrations and terminology for photographers
 Explanation of why "... all focal lengths have identical depth of field" (http://www.dofmaster.com/dof_imagesize.html) is true only in some circumstances.