Careful inspection of molecular formulas can yield useful information about molecular structure. Information from infrared and nuclear magnetic resonance spectroscopy is then easier to use to get the details of structure.
Look at the molecules and their formulas shown below:

Since halogens have a valence of one, like hydrogen, they can be counted as hydrogens for this comparison:
Oxygen, with a valence of two, has no effect on the number of hydrogens in the molecule.

We can either reason our way to the degree of unsaturation, or make use of a simple formula:
in which C, H, X, and N represent the numbers of carbons, hydrogens, halogens, and nitrogens respectively. Oxygens are ignored.
D = 5 + 1 - 9/2 - 1/2 = 1
the same value we got be reasoning it out.
Here's a table summarizing the possibilities up to D = 3:
| D | Double Bonds | Rings | Triple Bonds | Examples |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | ![]() |
| 1 | 1 | 0 | 0 | ![]() |
| 1 | 0 | 1 | 0 | |
| 2 | 2 | 0 | 0 | ![]() |
| 2 | 0 | 2 | 0 | |
| 2 | 0 | 0 | 1 | |
| 2 | 1 | 1 | 0 | |
| 3 | 3 | 0 | 0 | ![]() |
| 3 | 0 | 3 | 0 | |
| 3 | 0 | 1 | 1 | |
| 3 | 1 | 0 | 1 | |
| 3 | 1 | 2 | 0 | |
| 3 | 2 | 1 | 0 |
Information derived in this way can be combined with our prior knowledge of the structure of functional groups.
In all problems of structure determination, it is wise to extract as much information from the molecular formula as possible before proceeding to other data.
[Again,, I thank my former colleague, Professor Emeritus John Gordon, for pointing out this mode of thinking.]