How is the degree of unsaturation derived?
This is the correct formula:

$$ DU = 1 + \frac{1}{2}\sum _{v=1}^{j} n_{i}(v-2),$$
where

$j$ = maximum valence of any atom in molecule
$v$ = valence of atom(s) 1 to whatever
$n_{v}$ = number of atoms with that valence

Wikipedia gives a good explanation. In simple terms the formula will give the number of double bonds in an alkene. For all alkanes the number would be 0 of course. Rings and ethynes would complicate the use of the formula. Think of using the equation on chemical formulas like $\ce{C_{x}}\ce{H_{y}}$ or $\ce{C_{x}}\ce{H_{y}}\ce{O_{z}}$.