Balancing chemical equations using linear algebraic methods I know there are already plenty of questions on this site regarding this topic but I am having difficulty with a particular chemical equation.
I am trying to balance the following:
$$
{ C }_{ 2 }{ H }_{ 2 }{ Cl }_{ 4 }\quad +\quad { C }a{ { (OH }) }_{ 2 }\quad \xrightarrow [  ]{  } \quad { C }_{ 2 }{ H }{ Cl }_{ 3 }\quad +\quad Ca{ Cl }_{ 2 }\quad +\quad { H }_{ 2 }{ O }
$$
The system of linear equations produces the following augmented matrix:
$$
\begin{pmatrix} 2 & 0 & -2 & 0 & 0 & 0 \\ 2 & 2 & -1 & 0 & -2 & 0 \\ 4 & 0 & -3 & -2 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 \\ 0 & 2 & 0 & 0 & -1 & 0 \end{pmatrix}
$$
With the rows in the following order:
Carbon
Hydrogen
Chlorine
Calcium
Oxygen
In row echelon form this reduces to:
$$
\begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 \end{pmatrix}
$$
Which would indicate that:
x1 = 0; x2 = 0; x3 = 0; x4 = 0; x5 = 0
which is obviously not correct. What have I done wrong?
 A: Let the balanced equation to be $$a\,{ C }_{ 2 }{ H }_{ 2 }{ Cl }_{ 4 }\quad +\quad b\,{ C }a{ { (OH }) }_{ 2 }\quad \xrightarrow [  ]{  } \quad c \,{ C }_{ 2 }{ H }{ Cl }_{ 3 }\quad +\quad d\,Ca{ Cl }_{ 2 }\quad +\quad e\ { H }_{ 2 }{ O }$$ parform the balance for each atom (in the order $C, H, Cl, Ca, O$). We then have $$2a=2c$$ $$2a+2b=c+2e$$ $$4a=3c+2d$$ $$b=d$$ $$2b=e$$ But one of the parameters must be fixed (say $a=1$). So, eliminating  terms : $c=1$, $b=d=\frac e 2$, $d=\frac 12$, $e=1$ which make $a=c=1$, $b=d=\frac 12$, $e=1$. To get rid of the fractions, multiply all coefficients by $2$.
A: The 4th row of your matrix is missing a minus sign, i.e.
$$
\begin{pmatrix} 2 & 0 & -2 & 0 & 0 & 0 \\ 2 & 2 & -1 & 0 & -2 & 0 \\ 4 & 0 & -3 & -2 & 0 & 0 \\ 0 & 1 & 0 & -1 & 0 & 0 \\ 0 & 2 & 0 & 0 & -1 & 0 \end{pmatrix}
$$
$$ $$
But instead of forming an augmented matrix, you should drop that last column of zeroes, use the next-to-last column as a $b$-vector (equivalent to setting $x_5=1$), and solve for the remaining four coefficients from the linear system 
$$
A\,x = b
$$ 
where 
$$ \eqalign{
A &= \begin{pmatrix} 2 & 0 & -2 & 0 \\ 2 & 2 & -1 & 0 \\ 4 & 0 & -3 & -2 \\ 0 & 1 & 0 & -1 \\ 0 & 2 & 0 & 0 \end{pmatrix} \cr\cr
b &= \begin{pmatrix} 0 \\ 2 \\ 0 \\ 0 \\ 1 \end{pmatrix} \cr
}$$
This is an overdetermined system which can be solved as
$$ \eqalign{
 x &= (A^TA)^{-1}A^T\,b \cr
   &= A^+\,b \cr 
}$$
Finally, you can multiply the x-vector by a scalar factor to round any fractional components to whole integers.
