Vectors and Matrices

Matrices

(Subscript[M, HC]) is our matrix that maps the  three hydrocarbons (methane (Subscript[CH, 4 ]),propane (Subscript[C, 3])(Subscript[H, 8 ]),butane (Subscript[C, 4])(Subscript[H, 10 ]), to number of hydrogens and carbons

(Subscript[M, HC]) = {
{4,1},
{8,3},
{10,4}
}

(Subscript[M, HC])//MatrixForm

Transpose[(Subscript[M, HC])]//MatrixForm

PTmatrix is our matrix of kinetic data that gives rates of change of a particular atomic species  (C or H)as a function of pressure and temperature (see lecture notes corresponding to this Mathematica notebook).

PTmatrix = {
{α,β},
{γ,δ},
{ϵ,ϕ}
};
PTmatrix//MatrixForm

MPT  = (Subscript[M, HC]).  PTmatrix

The matrix multiplication does not work because the sizes are inconsistent.

Clear[MPT]

MPT = Transpose[(Subscript[M, HC])].  PTmatrix;
MPT//MatrixForm

Matrix Inversions

MPT = Transpose[(Subscript[M, HC])].  PTmatrix;
MPTinverse =Factor[Inverse[MPT]];
MPTinverse//MatrixForm

The denominators are related to the determinant---if the determinant vanishes, then the inverse matrix is not defined.

Det[MPT]

Checking to see if the the inverse multiplied by the original matrix is the identity matrix:

MPT.MPTinverse

It is not obvious unless simplified...

Simplify[MPT.MPTinverse]//MatrixForm

Redundant Rows: Rank of a Matrix

Same example for water and water complexes: use the matrix watmat to store molecular formulas for each type of molecule in the system

watmat = {{2,4},{1,2}};
watmat//MatrixForm

The vector molvec is used to store the number of each kind of molecule

molvec = {h20,h402}

The vector atomvec is used to store the number of each atomic species that is present

atomvec = {h,o}

atomvec//MatrixForm

The vector eq is now defined and its two elements are equations that give the number of hydrogen atoms and the number of oxygen atoms:

eq[1] = (watmat.molvec)[[1]] == atomvec[[1]]

eq[2] =  (watmat.molvec)[[2]] == atomvec[[2]]

Solve[{eq[1],eq[2]},molvec]

?Eliminate

Eliminate[{eq[1],eq[2]},molvec]

MatrixRank[watmat]

NullSpace[watmat]
Length[NullSpace[watmat]]