Some Linear Algebra
Notes
- Reference:
- 2.3.8 in the Book.
- This looks like a good reference.
- I am also using wikipedia
- Plus a Linear Algebra, about 40 years ago
- Plus ...
- A matrix is a rectangular array of numbers.
- $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$
- I know them first for solving systems of linear equations
- But we will use them for transformations in the plane.
- Matricies are identified as n by m
- where n is the number of tows an m is the number of columns
- Frequently written nxm
- The matrix above is a 2x2
- $\begin{bmatrix} a & b & c \\ d & e & f \end{bmatrix}$
- Is a 2x3
- $\begin{bmatrix} a & b \\ c & d \\ e & f \end{bmatrix}$
- Is a 3x2
- A matrix that is nxn is a square matrix.
- We will mostly be dealing with 3x3 and 4x4 matricies.
- $A = \begin{bmatrix} a & b \\ c & d \\ e & f \end{bmatrix}$
- A 1xn and nx1 matrix is called a vector
- $\begin{bmatrix} a & b \end{bmatrix}$
- $\begin{bmatrix} a \\ b \end{bmatrix}$
- We will be somewhat flexiable with vectors, moving between representations.
- Matricies variables are frequently upper case letters (A,B,...)
- In Graphics
- Vectors frequently represent points in space (1x2 or 1x3)
- A matrix is frequently an operation on that vector.
- Operations a matrix
- Addition and subtraction
- Both must be c1 x c2
- Just do pairwise operation
- $A = \begin{bmatrix} a & b & c \\ d & e & f \end{bmatrix}$
- $B = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}$
- $A + B = \begin{bmatrix} a + 1 & b + 2 & c + 3 \\ d + 4 & e + 5 & f + 6 \end{bmatrix}$
- $A - B = \begin{bmatrix} a - 1 & b - 2 & c - 3 \\ d - 4 & e - 5 & f - 6 \end{bmatrix}$
- Scalar multiplication
- For some constant $s$
- $sA = \begin{bmatrix} sa & sb & sc \\ sd & se & sf \end{bmatrix}$
- Harder but VERY important matrix matrix multiplication
- To multiply A x B,
- A must be n x c1, and B must be c1 x n
- You can multiply a 4x2 by a 2x3 to get a 4x3
- $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ 7 & 8 \end{bmatrix}$
- $B = \begin{bmatrix} a & b & c \\ d & e & f \end{bmatrix}$
- $A x B = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ 7 & 8 \end{bmatrix} X \begin{bmatrix} a & b & c \\ d & e & f \end{bmatrix}$
- For $C = A x B: c_{i,j} = a_{i,1}b_{1,j} + a{i,2}b{2,j} + ... + a_{i,n}+b_{j,m} $
- $c_{i,j} = \Sigma_{k=1}^n a_{i,k}b_{k,j}$
- $A x B = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ 7 & 8 \end{bmatrix} X \begin{bmatrix} a & b & c \\ d & e & f \end{bmatrix} = \begin{bmatrix} a1+d2 & b1+e2 & c1+f2 \\ a3 + d4 & b3 + e4 & c3 + f4 \\ a5 + d6 & b5 + e6 & c5 + f6 \\ a7 + d8 & b7 + e8 & c7 + f8 \\ \end{bmatrix}$
- Cheater
Point your left finger to the first matrix, move across the row While your left finger is still poiting at a row Point your right finger to the second matrix, move down the column While your right finger is still pointing at a column in the second matrix Sum the rsults of left finger x right finger for the next entry Move your right finger over one colum repeat Move your left finger down a row.
- IMPORTANT AxB ≠ BXA
- $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$
- $B = \begin{bmatrix} A & B \\ C & D \end{bmatrix}$
- $ AxB = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} x \begin{bmatrix} A & B \\ C & D \end{bmatrix} = \begin{bmatrix} A1 + C2 & B1 + D2 \\ A3 + C4 & B3 + D4 \end{bmatrix}$
- $ BxA = \begin{bmatrix} A & B \\ C & D \end{bmatrix} x \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} = \begin{bmatrix} A1 + B3 & A2 + B4 \\ C1 + D3 & C2 + D4 \end{bmatrix}$
- Note these are not the same.
- Addition and subtraction
- Matrix vector multiplication
- We will be doing 3x3 x 3x1 and 4x4 x 4x1 vector multiplcation
- These will all prodice a 3x1 and a 4x1 result.
- $A = \begin{bmatrix} A & B & C \\ D & E & F \\ G & H & I \end{bmatrix}$
- $p = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}$
- $Ap = \begin{bmatrix}A & B & C \\D & E & F \\G & H & I \end{bmatrix} \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} = \begin{bmatrix} A1 + B2 + C3 & D1 + E2 + F3 & G1 + H2 + I3 \end{bmatrix}$
- We care about
- $I = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$
- $I = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0& 0 \\ 0 & 0 & 1& 0 \\ 0 & 0 & 0& 1 \end{bmatrix}$
- If multiplication is possible Ip = p