I was going to start a sequence in physics this semester, but in the end I decided to switch to one in chemistry. There were a few motivating factors, but chief among them was the dread of having to sit through deriving Newton’s laws and equations again for the seemingly billionth time.

Also, there was the professor’s hat.

It was a hat that said “I’m certain about my status as an out-of-the-box thinker! So certain, in fact, that I must trumpet it like an over-caffienated swan!” Don’t get me wrong, everyone has a right to their own sartorial style and if I were taking a class called “Wacky Hats for the Urban Gentleman 231″, this hat would have been a normal, perhaps even a little understated choice. On a physics or math professor, though, such a thing is a robot-arm-waving, “DANGER! DANGER!” situation.

Anyway, one of the things I’ve run into in chemistry is balancing chemical equations. This is fairly simple stuff, but the text implies that the best way to solve balancing problems is to just use a hodge-podge of intuition and trial and error. The first one I did, I heard Steve Brule saying “Just use linear algebra, dummy!”.

So, here’s how to do it:

Take a reaction like the following with iron(III) hydroxide reacting with sulfuric acid to form iron(III) sulfate and water:

From this reaction, you can form an augmented matrix with one row for each element and one column for each participating compound (see below). In each individual entry of the matrix, we put the number of atoms of that element found in that compound.

Here’s the matrix for the example reaction above:

The entry in position (3,2) (value: 2) has the number of atoms of element 3 (H) in compound 2 ().

Pick one of the compounds from the right hand side of the equation (it doesn’t matter which) and put that one in the augmented column. It’s usually easiest to just use the last compound in the reaction. When you put any other compounds from the right hand side in, make sure to change the sign of that entry to ensure that we won’t get any negative results.

Putting this matrix in reduced row echelon form yields:

The last column of the RREF gives us a vector containing the coefficients of the chemical reaction:

First off, note that the last entry in the column does not mean that the last coefficient is 0. Instead since that row is all zeros, it’s a free variable and we can *choose* it to be 1 since that is the simplest and makes physical sense.

The second thing we see is that the rest of the coefficients are all fractions. This is clearly no good for chemical compounds since it doesn’t make physical sense to talk about one-sixth of a water molecule. However, this is easily remedied by multiplying the entire vector by the greatest denominator among them.

In this case, we multiply by 6:

From left to right, these are the coefficients of the balanced chemical reaction:

It may seem like quite a bit of work, especially if you’re unfamiliar with linear algebra, but this process always produces the correct answer and would seem to be quite useful for balancing large and/or strange reactions.