The well known law of radioactive decay
#N = N_0 e^{-lambda t}#
tells us that if we know the current amount of a radioactive substance and the initial amount, we should be able to calculate the time elapsed by simply using
# t = 1/lambda ln (N_0/N)#
The amount of a radioactive substance present in a sample is easy to determine - all you have to do is measure the number of decays that are occurring per unit time, since this number, #|(dN)/(dt)|#, is given by #lambda N# (the number of decays is easy to measure, you have to count the number of decay particles being produced using a standard particle detector).
The tricky part here is knowing #N_0# - the initial amount of the radioactive substance present. This is where carbon comes in. Natural carbon comes in the form of two stable isotopes #""^12"C"# and #""^13"C"#, in addition to a radioactive isotope - #""^14"C"#. It is the latter isotope, also known as radiocarbon, that plays a central role in carbon dating.
#""^14"C"# has a relatively small half life of about 5730 years - so, nearly all of it should have depleted by now. However, the amount of #""^14"C"# in the atmosphere is maintained at a nearly constant level because it is created in the in the lower stratosphere and upper troposphere by cosmic rays. These cosmic rays give rise to neutrons, which in turn cause #""^14"N"# in the air to transmute to #""^14"C"# :
#"n" + ""^14"N" to ""^14"C"+"p"#
Once created, the radiocarbon quickly combines with atmospheric oxygen to produce carbon-dioxide. Plants absorb this radioactive carbon-dioxide, along with the more common #""^12"CO"_2# , during photosynthesis, and animals, who eat these plants, get their share of radiocarbon from them. As a result, as long as an organism is living (and as a result taking part in the carbon cycle), the amount of radiocarbon in it is maintained at a steady level, and the radioactive decay law takes over only when the organism dies. Thus, #N_0# can be estimated by doing measurements on a fresh sample of a similar organism.
Since the amount of atmospheric radiocarbon has varied over time due to several other factors, the method requires various additional correction factors which complicate the details somewhat, but this is the main idea!