# index of hydrogen deficiency

I don't really get the concept of index of hydrogen deficiency (IHD). Can someone please use an example to explain what $\mathrm{H_{reference}}$ and $\mathrm{H_{molecule}}$ are? I know the formula:

$$\mathrm{IHD} = \frac{\mathrm{H_{reference}} - \mathrm{H_{molecule}}}{2}$$

$$IHD = \frac{2C + 2 - H - X + N}{2}$$
Where $C$, $H$, $X$, and $N$ represent the number of carbon, hydrogen, halogen, and nitrogen atoms, respectively. The logic of the IHD is that any simple acyclic alkane has a formula of $\ce{C_{n}H_{2n + 2}}$, meaning that given $n$ carbons, a simple acyclic alkane will have $2n + 2$ hydrogens. Every increment in the IHD represents either a degree of unsaturation due to $\pi$-bonds, or the presence of a ring. In your formula, $H_{reference}$ should be twice the number of carbons in your molecule, plus two. $H_{molecule}$, on the other hand, is the actual number of hydrogens in the molecule.
For example, if your molecule has the formula $\ce{C6H8}$, $H_{reference} = 2(6) + 2 = 14$ and $H_{molecule} = 8$. The IHD is then $\frac{14 - 8}{2} = 3$, suggesting that the total number of $\pi$-bonds plus rings in the molecule is three. Note that this isn't sufficient to determine the actual structure of the molecule, but it's helpful when combined with spectroscopy data (that is, it could have one ring and two $\pi$-bonds, or just three $\pi$-bonds, or some other combination).