For example, I have this equation:
$$\mathrm{KMnO_4 + HCl = KCl + MnCl_2 + H_2O + Cl_2}$$
Then I get this:
$$a \cdot \mathrm{KMnO_4} + b \cdot \mathrm{HCl} = c \cdot \mathrm{KCl} + d \cdot \mathrm{MnCl_2} + e \cdot \mathrm{H_2O} + f \cdot \mathrm{Cl_2}$$
$$ \begin{align} \mathrm{K}&: &a &= c \\ \mathrm{Mn}&: &a &= d \\ \mathrm{O}&: &4a &= e \\ \mathrm{H}&: &b &= 2e \\ \mathrm{Cl}&: &b &= c + 2d + 2f \end{align} $$
$$ \begin{bmatrix} a&b&c&d&e&|&f\\ 1&0&-1&0&0&|&0\\ 1&0&0&-1&0&|&0\\ 4&0&0&0&-1&|&0\\ 0&1&0&0&-2&|&0\\ 0&1&-1&-2&0&|&2 \end{bmatrix} $$
How would I get the values of $a, b, c, d, e,$ and $f$ from here?
Side note: I'm following this.
Well... Reading the equations in the order they were given and using a as a parameter, one gets successively c = a, d = a, e = 4a, b = 2e = 8a, and 2f = b - c - 2d = 8a - a - 2a = 5a.
This is solved by a = c = d = 2, e = 8, b = 16 and f = 5, thus, the balanced equation is $$\text{2 KMnO$^4$ + 16 HCl $\to$ 2 KCl + 2 MnCl$^2$ + 8 H$^2$O + 5 Cl$^2$}$$