# zHW: Stoichiometric Matrix

Using the list of species from HW_03, verify that the columns of the stoichiometric matrix are in the null space of the atomic matrix.

## Chemical Species

The first step is to provide a list of all chemical species partcipating in the reaction system. Use molweight to verify correct entry of this list of species.

```species = { ...
'CH3OH', ...     % Methanol
'O2', ...        % Oxygen
'CH2O', ...      % Formaldehyde
'CHOOH', ...     % Formic Acid
'CO', ...        % Carbon Monoxide
'CO2', ...       % Carbon Dioxide
'H2O'};          % Water

molweight(species);
```
```Species                    Mol. Wt.
-------                    --------
CH3OH                         32.04
O2                            32.00
CH2O                          30.03
CHOOH                         46.03
CO                            28.01
CO2                           44.01
H2O                           18.02
```

## Atomic Matrix

Element a(i,j) of the atomic matrix A is the number of atoms of element i that appear in a molecule of species j.

```atomic(species);
```
```       CH3OH       O2     CH2O    CHOOH       CO      CO2      H2O
C:        1        0        1        1        1        1        0
H:        4        0        2        2        0        0        2
O:        1        2        1        2        1        2        1
```

## Stoichiometric Matrix

Element v(j,k) of the stoichiometric matrix V is the number of molecules of species j that participate in reaction k. The stoichiometric coefficient is negative if species j is a reactant, or positive if species j is a product of the reaction.

```V = stoich(species);
disp('V = ');
disp(V);
```
```V =
-1     0     0     0
0    -1     0     0
0     0    -1     0
0     0     0    -1
3    -2     2     1
-2     2    -1     0
2     0     1     1

```

## Product of the Atomic and Stoichiometric Matrices

In principle, each matrix element b(i,k) of the product of the atomic and stoichiometric matrices, B = A*V, would the net number of atoms of atomic element j produced (if positive) or consumed (if negative) by reaction k. However, atoms are neither produced or consumed in a balanced reaction. Therefore the product A*V ought to be zero. Stated in terms of linear algebra, the columns of V are in the null space of A.

```A = atomic(species);
V = stoich(species);

disp('Product of Atomic & Stoichiometric Matrices = ');
disp(' ');
disp(A*V)
```
```Product of Atomic & Stoichiometric Matrices =

0     0     0     0
0     0     0     0
0     0     0     0

```