During complete combustion, the hydrocarbon reacts with oxygen (O2) to from carbon dioxide (CO2) and water (H2O). For the combustion of one molecule of octane, 8 molecules of CO2 and 9 molecules of H2O must be formed to account for all the atoms of carbon and hydrogen in the octane. This requires 25 atoms of oxygen, or 12.5 molecules of O2:
C8H18+12.5*O2=9*H2O+8*CO2
Multiply both sides by 2 to obtain whole number coefficients:
2*C8H18+25*O2=18*H2O+16*CO2
The coefficient of carbon dioxide in the balanced equation is 16.