```    |_____ s _____|______ d ______|
|             |               |
|             |               |
------------------\ - - - - - - - |-----
|             |\              |  ^
|             |f\             |  |
====*================>=============  a
|             | /             |  |
|             |/              |  v
------------------/ - - - - - - - |-----
subject        lens            film
```
Given a camera, where s is the distance from the subject to the lens, and d is the distance from the lens to the film and f is the focal length of the lens, the question of 'is the subject in focus?' can be determined with a simple equation known as the thin-lens equation.
``` 1     1     1
--- + --- = ---
s     d     f

|_____ s _____|______ d ______|
|             |               |
|             |               |
.........          |-----
|     .....   |     .....     |  ^
|.....        |          .....|  |
=|==*==|===========================  a
|.....        |          .....|  |
|     .....   |     .....     |  v
.........          |-----
subject        lens            film
```
Depth of field relates to how much is in focus in front of and behind the object.
```    |_____ s _____|______ d ______|
|             |               |
|             |               |
|        ...,,,,,,..          |-----
|  .....,,,,  |   ,,,,....  ,,|  ^ ---
..... ,,,,      |       ,,,,.,.... |  ^
=|==*==|======================*==== *a  c
..... ,,,,      |       ,,,,.,.... |  v
|  ....,,,,   |   ,,,,....  ,,|  v ---
Dr|Df     ...,,,,,,,..          |-----
subject        lens            film
```
The distance Dr and Df are the depth of field in the front and behind the subject. This is function of two more variables: a the diameter of the lens opening, and c the circle of confusion. The circle of confusion for 35mm film is typically considered to be 0.033mm (though some prefer this to be 0.026mm).

With some math applied to the equation above we get:

```   1               1           1
-------- + ---------------- = ---
s - Df     d (1 + c/(a-c))    f

1               1           1
-------- + ---------------- = ---
s + Dr     d (1 + c/(a-c))    f
```
Solving for Df and Dr we get:
```       s c ( s - f )
Df = ----------------
f a + c (s - f)

s c ( s - f )
Dr = ----------------
f a - c (s - f)
```
To change a from a diameter to the more familiar (to photographers) f-stop number A, a = f/A. Thus we get:
```       s c ( s - f )
Df = ------------------
2
f  + c A (s - f)

s c ( s - f )
Dr = ----------------
2
f  - c A (s - f)
```

Ok, so thats a lot of math - what does it mean to someone who has a camera in the hand and taking a picture?

Lets say you have a 50mm lens with a maximum aperture of f/1.8 (its a \$60 lens in most cases). You are taking a picture of a person and you want the entire head to be in focus (about half a foot on either side). At f/1.8 with the standard circle of confusion of 0.033mm, you would have to be about 8 feet away from the subject. Using f/16 with the same circle of confusion you would only need to be slightly less than 3 feet away, and at f/32, pretty much everything is in focus at 2 feet away to infinity.

Looking at this, at 8 feet away with a lens that covers about 45 degrees, there is a large amount of other stuff in the photograph. tan(22.5) * 8ft = 3.3ft thus, with a head only being about half a foot wide, the person's head takes up about 1/10th the width of the photograph. This is not likely to be the intended result.

Compare taking this with a very nice portrait lens (I'm looking at the Nikon 135mm f/2 that has a few bells and whistles on it and sells for about \$800) with a picture angle of 18 degrees, to get that same 1 foot of total depth of field, you would have to be about 20 feet away. However, at this distance, the lens is only photographing an area 4 feet wide - of which a person's head takes up roughly 1/6th of the photograph.

Some other comparisons:

• Given the same focal length and subject distance, depth of field can be increased by closing the aperture.
• Given the same focal length and f/stop, depth of field increases as the subject distance approaches infinity.
• Given the same subject distance and f/stop, the longer the focal length, the less depth of field (a wide angle lens will have more of a depth of field than a telephoto lens)

http://www.dof.pcraft.com/