### How can balance chemical equation using matrix

Posted:

**Thu 23 June, 2011 17:43**
by **barnamah**

How can balance chemical equation using matrix in linear algebra?

I have a chemical equation `CO_2+H_2O->C_6H_12O_6+O_2`

how can I setup a matrix and balance this equation?

### Re: How can balance chemical equation using matrix

Posted:

**Thu 23 June, 2011 17:47**
by **Integr88**

to balance the equation `CO_2+H_2O->C_6H_12O_6+O_2`

let x1, x2 , x3 and x4 be the coefficients of each 4 terms that we have. 2 on the right and 2 on the left and we can write:

`x_1CO_2+x_2H_2O->x_3C_6H_12O_6+x_4O_2`

In our equation we have the C, O and H. We will have 3 rows because we have three elements: Carbon, Oxygen and Hydrogen. We will have 4 column because we have x1, x2, x3 and x4

Elements Left side = Right Side

Carbon `x_1+ 0 = 6x_3 + 0` (term 1 = 1 C, term 2 0C, term 3, 6C and term 4 0C)

Hydrogen `0 + 2x_2 = 12x_3 + 0` (term 1 = 0H, term 2 2H, term 3 12H and term 4 0H)

Oxygen `2x_1+ x_2 = 6x_3 + 2x_4` (term 1= 2O, term 2 1O, term 3 6O and term 4 2O)

Now move everything to left and make equation =0 we have:

`x_1+ 0 -6x_3 0 = 0`

`0 + 2x_2 -12x_3 + 0=0`

`2x_1+ x_2 -6x_3 - 2x_4=0`

our matrix will look like `[[1,0,-6,0,0],[0,2,-12,0,0],[2,1,-6,-2,0]]`

Now we continue and convert this to Reduced row echelon form and we have:

`[[1,0,0,-1,0],[0,1,0,-1,0],[0,0,1,-1/6,0]]`

Because we have 3 equation and 4 unknown, we use variable t. In every row we have a value but for x4 we don't have any value so we set ix4=t and we have

so our values are as follow:

`x_4=t`

`x_3-1/6x_4=0` so `x_2=1/6t`

`x_2-1x_4=0` so `x_2-t=0 ` and `x-2=t`

`x_1-x_4` and `x_4=t` so `x_1-t` and `:. x_1=t`

in neat format:

`x_4=t`

`x_3=t/6`

`x_2=t`

`x_1=t`

because we have 6 at the denominator of x3, we can set t=6 and solve:

`x_4=6`

`x_3=1`

`x_2=6`

`x_1=6`

so our balanced equation is: 6`CO_2+`6`H_2O->`1`C_6H_12O_6+`6`O_2`