.      Back to the class
Application of linear systems to chemistry
An atom is an object that appears in the periodic table of elements. A molecule is some finite combination of atoms written adjacently. A chemical equation is a representation of what happens when molecules come in contact with each other. A balanced chemical equation is a chemical equation that also shows how many of what molecules react and how many of what molecules result. For example, the following is a chemical equation that is not balanced: $$H_2 + O_2 \longrightarrow H_2O$$ because on the left you have a hydrogen molecule and an oxygen molecule consisting of, in total, $2$ hydrogen atoms and $2$ oxygen atoms respectively but on the right we see one water molecule conssiting of, in total, $2$ hydrogen atoms and $1$ oxygen atoms. So on the left we have $2$ hydrogens, $2$ oxygens and on the right $2$ hydrogens and $1$ oxygen. Because the number of atoms of each type on each side are different, we say the chemical equation is not balanced. To write this reaction balanced we would write $$2H_2 + O_2 \longrightarrow 2H_2O$$ because now the total number of atoms on each side of each type are equal.

We will write molecules as vectors in the following way: we will assign rows to atoms and to each molecule we write the number and each type of atoms it has. For example in the above reaction, the atoms are only $H$ and $O$. The molecules are $H_2, O_2,$ and $H_2O$. We will use the first row of vectors for $H$ atoms and the second row of vectors for $O$ atoms. In this case we can express each molecule as a vector in the following way: $$H_2 = \left[ \begin{array}{ll} 2 \\ 0 \end{array} \right], O_2 = \left[ \begin{array}{ll} 0 \\ 2 \end{array}\right], H_2O = \left[ \begin{array}{ll} 2 \\ 1 \end{array}\right].$$ We would write the balanced chemical equation from above as the vector equation $$2H_2 + O_2 - 2H_2O=0.$$ Example: The chemical reaction for the (combustion) reaction of octane and oxygen yielding water and carbon dioxide is $$CH_3(CH_2)_6CH_3+O_2 \longrightarrow H_2O + CO_2,$$ where $(CH_2)_6$ denotes $6$ copies of $CH_2$. This equation is not balanced because on the left side, in total, there are 8 $C$ atoms, 18 $H$ atoms, and 2 $O$ atoms while on the right there are, in total, 1 $C$ atom, 2 $H$ atoms, and 3 $O$ atoms. To balance this equation we will take vectors $\vec{v}_1,\ldots,\vec{v}_4$ where each vector corresponds to the molecules that appear in the reaction. We will use the first row of each vector for $C$ atoms, the second for $H$ atoms, the third for $O$ atoms. With this interpretation, we have the following four vectors: $$\vec{v}_1 = CH_3(CH_2)_6 CH_3 = \left[ \begin{array}{ll} 8 \\ 18 \\ 0 \end{array} \right],$$ $$\vec{v}_2 = O_2 = \left[ \begin{array}{ll} 0 \\ 0 \\ 2 \end{array}\right],$$ $$\vec{v}_3 = H_2O = \left[ \begin{array}{ll} 0 \\ 2 \\ 1 \end{array}\right],$$ $$\vec{v}_4 = CO_2 = \left[ \begin{array}{ll} 1 \\ 0 \\ 2 \end{array}\right].$$ To balance the equation is to find weights $x_1,x_2,x_3,x_4$ such that $$x_1 \vec{v}_1 + x_2 \vec{v}_2 + x_3 \vec{v_3} + x_4 \vec{v_4}=\vec{0}.$$ (note: the values for $x_3$ and $x_4$ should end up negative because we are "subtracting" everything to the left side of the octane reaction equation -- if you write "$-x_3$" instead of "$x_3$",that is also ok -- all that happens is that $x_3$ will be positive in such a case)

If we substitute the values of $\vec{v}_1,\ldots,\vec{v}_4$ into the vector equation we get $$x_1 \left[ \begin{array}{ll} 8 \\ 18 \\ 0 \end{array} \right] + x_2 \left[ \begin{array}{ll} 0 \\ 0 \\ 2 \end{array}\right] + x_3 \left[ \begin{array}{ll} 0 \\ 2 \\ 1 \end{array}\right] + x_4 \left[ \begin{array}{ll} 1 \\ 0 \\ 2 \end{array}\right] = \left[ \begin{array}{ll} 0 \\ 0 \\ 0 \\ \end{array} \right].$$ Therefore we see that we need to solve the homogeneous system $$(*) \hspace{35pt} \left[ \begin{array}{llll} 8 & 0 & 0 & 1 \\ 18 & 0 & 2 & 0 \\ 0 & 2 & 1 & 2 \end{array} \right] \left[ \begin{array}{ll} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array} \right] = \left[ \begin{array}{ll} 0 \\ 0 \\ 0. \end{array} \right]$$ After row operations (I pulled it off in 5 or 6 steps), we can find the matrix that the coefficient matrix is equivalent to: $$\left[ \begin{array}{llll} 8 & 0 & 0 & 1 \\ 18 & 0 & 2 & 0 \\ 0 & 2 & 1 & 2 \end{array} \right] \sim \left[ \begin{array}{llll} 1 & 0 & 0 & \dfrac{1}{8} \\ 0 & 1 & 0 & \dfrac{25}{16} \\ 0 & 0 & 1 & -\dfrac{9}{8} \end{array} \right]$$ Hence the homogeneous equation $(*)$ becomes $$\left[ \begin{array}{llll} 1 & 0 & 0 & \dfrac{1}{8} \\ 0 & 1 & 0 & \dfrac{25}{16} \\ 0 & 0 & 1 & -\dfrac{9}{8} \end{array} \right] \left[ \begin{array}{ll} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array} \right] = \vec{0}.$$ If we interpret this equation as a system we get $$\left\{ \begin{array}{ll} x_1+\dfrac{1}{8}x_4 = 0 \\ x_2 + \dfrac{25}{16}x_4 =0 \\ x_3 - \dfrac{9}{8} x_4 = 0 \end{array} \right.$$ or equivalently $$\left\{ \begin{array}{ll} x_1=-\dfrac{1}{8}x_4 \\ x_2 =-\dfrac{25}{16}x_4 \\ x_3= \dfrac{9}{8} x_4 \end{array} \right.$$ Hence the system $(*)$ has solution $$\vec{x} = \left[ \begin{array}{ll} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array} \right] = x_4\left[ \begin{array}{ll} -\dfrac{1}{8} \\ -\dfrac{25}{16} \\ \dfrac{9}{8} \\ 1. \end{array} \right]$$ Recall we said that $x_3$ and $x_4$ should be negative. Also it is convention to have only integer coefficients in balanced equations. So we will choose $x_4=-16$ which yields $$\vec{x} = \left[ \begin{array}{ll} 2 \\ 25 \\ -18 \\ -16 \end{array} \right].$$ This means that we should balance the equation by writing $$2\vec{v}_1 + 25 \vec{v}_2 - 18 \vec{v}_3 - 16 \vec{v}_4=0$$ or equivalently $$2\vec{v}_1+25\vec{v}_2 = 18\vec{v}_3 + 16\vec{v}_4,$$ which when interpreted as a chemical equation in the way we defined yields $$2 CH_3(CH_2)_6 CH_3 + 25 O_2 \longrightarrow 18 H_2O + 16 CO_2,$$ which is a balanced chemical equation because on the left-hand-side there are in total 16 $C$ atoms, 36 $H$ atoms, and 50 $O$ atoms on the left and on the right-hand-side the same.