A Linear Algebra Perspective on High School Chemistry

Date: 2023-12-08 ๏ฝœ Author: Jason Eveleth

Table of Contents

Recently, I was on a ski trip and the topic of chemistry came up, and I realized that high school stoichiometry seemed like a algorithm I should recognize.

In stoichiometry, you're given an equation like this:

x1C6H12O6+x2O2=x3H2O+x4CO2.x_1C_6H_{12}O_6 + x_2O_2 = x_3H_2O + x_4CO_2.

We're trying to determine what the coefficients need to be for the equation to be balanced. From what I remember from high school, you just think really hard until you figure out what they need to be, and that's how you determine the coefficients.

Taking a more systematic approach, we can move everything over to the other side, giving

x1C6H12O6+x2O2โˆ’x3H2Oโˆ’x4CO2=0x_1C_6H_{12}O_6 + x_2O_2 - x_3H_2O - x_4CO_2 = 0

We can consider the balance for each element as an equation, and our coefficients as unknowns

C6x1+0x2โˆ’0x3โˆ’1x4=0H12x1+0x2โˆ’2x3โˆ’0x4=0O6x1+2x2โˆ’1x3โˆ’2x4=0 \begin{align*} C & &6x_1 + 0x_2 - 0x_3 - 1x_4 = 0\\ H & &12x_1 + 0x_2 - 2x_3 - 0x_4 = 0\\ O & &6x_1 + 2x_2 - 1x_3 - 2x_4 = 0\\ \end{align*}

Now it's just a problem of Gaussian elimination. This is a homogeneous linear system:

[600โˆ’1120โˆ’2062โˆ’1โˆ’2][x1x2x3x4]=[000]. \begin{bmatrix} 6 & 0 & 0 & -1\\ 12 & 0 & -2 & 0\\ 6 & 2 & -1 & -2\\ \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4\\ \end{bmatrix} = \begin{bmatrix} 0\\0\\0\\ \end{bmatrix}.

This is so exciting, because now you can use your favorite linear solver on this equation to determine the balance for the original chemical reaction.

ยฉ Jason Eveleth 2023 ยท Powered by Franklin.jl ยท Last modified: December 31, 2024 Page Source