Matrix operations and inverses

Posted by Big Data Memo on July 21, 2016

Matrix Multiplication

There are 5 common multiply mmethods

1 just the define

`A = matrix([
                  [      ],
                  [      ]
                  [a31 a32 a33]])`
`B = matrix([
                  [ , b12, ],
                  [ , b22, ],
                  [ , b32, ]])
                  `
`C = A * B = matrix([
                        [          ],
                        [          ],
                        [ , c32, ]])
                        `

that is, c32 = a31b12 + a32b22 + a33*b32 = ∑a{3k}b{k2}; The entry in row i and column j of AB is (row i of A) · (column j of B).

2 column vector

`A = matrix([
                [1,1],
                [2,-1]
                ])
B = matrix([
                [2, 2]
                [3, 4]
                ])
C*1 = 2 * [1, 2].T + 3 [1,-1].T
C*2 = 2 * [1, 2].T + 4 [1, -1].T
`

A is column vector, and B is coefficient matrix(x, y).

3 row vector

`A = matrix([
                [1,1],
                [2,-1]
                ])
B = matrix([
                [2, 2]
                [3, 4]
                ])
R1* = 1 * [2, 2] + 1 [3,4]
R2* = 2 * [2, 2] + (-1)[3,4]
`

Just like method 2, B is row vector, and A is coefficient matrix(x, y).

4 the define apply

`A = matrix([
                [1,1],
                [2,-1]
                ])
B = matrix([
                [2, 2]
                [3, 4]
                ])
C1 = [1, 2].T * [2, 2] = [[2, 2], [4, 4]]
C2 = [1, -1].T * [3,4] = [[3, 4], [-3, -4]]
C = C1 + C2 = [[5,6],[1,0]]
`

As you can see, C = C1R1 + C2R2.

5 Block Multiplication

The Laws for Matrix Operations

Here are three addition laws:

> A+B=B+A (commutative law)

> c(A + B) = cA + cB (distributive law)

> A + (B + C) = (A + B) + C ( associative law). *** Three more laws hold for multiplication, but AB = BA is not one of them

> AB ^= BA (the commutative "law" is usually broken

> C(A + B) = CA + CB (distributive law from the left

> (A + B)C = AC + BC (distributive law from the right)

> A(BC) = (AB)C (associative law for ABC) (parentheses not needed).

Inverse

(AB)-1 = B-1A-1

There’s no inverse if some combination of the columns gives nothing.

Ax=0

  A   = 0

Calculating A-I by Gauss-Jordan Elimination

pivot

E-121E-131E-132 = L

LU

fuck sup sub is out of order!!!