Linear Algebra Math

Here are some of the definitions and examples used in Linear Algebra and specifically the linear algebra calculators available.

Let A, B, and C represent n x n matrices.

Example of a 3 x 3 Matrix:

1  2  3
1  1  2
0  1  2

The equation for multiplying two matrices is : (elementwise)

[<b>AB</b>]<sub>ij</sub> = <b>SIGMA</b> [<b>A</b>]<sub>ik</sub>[<b>B</b>]<sub>kj</sub>

Where the SIGMA summation goes from k=1...n

A example element from our 3x3 Case. To get the first element in our solution matrix c11

c<sub>11</sub> = (a<sub>11</sub> * b<sub>11</sub>) + (a<sub>12</sub> * b<sub>21</sub>) + (a<sub>13</sub> * b<sub>31</sub>)

Where aij and bij are from matrices A, B respectively.

For example:

A = a b c d e f g h i AT = a d g b e h c f i

det(<b>A</b>) = <b>SIGMA</b> (±)a<sub>1j<sub>1</sub></sub> a<sub>2j<sub>2</sub></sub>. . .a<sub>nj<sub>n</sub></sub>

Where SIGMA is our summation over all permutations j1 j2 ... jn of the set S={1, 2, ..., n }.

The sign is + or - according to whether the permutation is even or odd.

Example: In our 3x3 case it is a little easier, and boils down to :

det(<b>A</b>) = aei + cdh + bfg - ceg - bdi - afh

Where are matrix first row is a b c , 2nd row d e f, and 3rd row, g h i

Calculation Technique: For the n x n the calculation of the determinant, by definition, is based upon a factorial number of calculations with respect to the size of the matrix. ie. a 3x3 matrix would have 6 calculations (3!) to make, whereas a 20x20 matrix would have 2.43 x 10^18 calculations (20!).

So instead of brute forcing the calculations, I first do some operations on the matrix, which converts it to a upper triangular matrix, and then calculate the determinant by multiplying down the diagonal, since everything below is 0, this will give the determinant.

The cofactor of an element _a_ij from matrix A is :

<i>a</i><sub>ij</sub> = (-1)<sup>i + j</sup> * det (<b>A'</b>), where <b>A'</b> is the matrix obtained from "omitting" the ith and jth rows, of matrix <b>A</b>.

Calculation Technique: The inverse was obtained using the Theorem:

<b>A</b>adj(<b>A</b>) = det(<b>A</b>)I<sub>n</sub>

Which when manipulated gives you:

<b>A</b><sup>-1</sup> = (1 / det(<b>A</b>)) * adj(<b>A</b>)