Originally posted by Chemicalsuperfreak
Consider a straight chain hydrocarbon. Each carbon has two hydrogens, except for the ones at the end, which each have an additional hydrogen. So the number of H is 2n+2, where n is the number of carbon atoms, follow? You can than arrange it in anyway you want and it will still work. Halogen atoms will take up the place of a hydrogen atom. So bromopropane has three carbons, and one bromine, so it would have 8 hydrogens just given the carbons but it really has only seven, due to the bromine, so you subract the number of halogens (-X). Oxygen won't affect it at all, it just spaces out the molecule, it's kind of like a filler. Nitrogen is kind of like oxygen, except it's got one more bond for a hydrogen (or something else as the case may be), so you add a hydrogen for every nitrogen. So your final equation is 2n+2-X+N for how many hydrogens you should have. This, minus actual number of hydrogens you actually have, divided by two (each pi bond takes the place of two hydrogens, or the ring forming bond takes the place of those two protons at the end of the chain) gives the degree of unsaturation.