Cheatography

# linear algrebra Cheat Sheet by afalita6

linear algebra MTH 301

### Inverse of a matrix

 Triangular or diagonal matrix 1/diagonal entries Permuted matrix P transpose Other rref ( [A eye()] )

### Multip­lic­ation of Matrix + angle

 Way 1 A*B full multip­lic­ation Way 2 [row A]*B Way 3 [col A]*B Way 3 B11*co­l(A­1)+­B21­*co­l(A2) Find entry 2,3 [row A2]*[c­olu­mnB3] = 1 number Rank 1 matrix [a11*r­owB1; a21*ro­wB1­;a3­1*r­owB1] + ... Angle cos(theta) = (v*w)/(||v||*||w||) Outer Product [colum­n1]*[1 # #] find numbers that work

### Linear Transf­orm­ation and dependency

 Linear Indepe­ndent Linearly indepe­ndent if rref(A) ----> #pivots = #row Linear transf­orm­ation (x and y given) T (u + v) = T (u) + T (v), T (cu) = cT (u), where c is a number. T is one-to-one if T(u)=0⇒u=0 T is onto if Col(T) = Rm.

### Projec­tions or Ax=b is incons­istent

 formula A'*A*x­hat=A'* Step 1 rref ( [A'*A A'*b] ) Step 2 xhat = last column of rref Step 3 bhat = A*xhat --> bhat is the vector spaned A closest to v and the projection of the vector onto subspace Step 4 be = b - bhat --> be is the vector perpen­dicular Step 4 error vector­/di­stance = norm (be) (1/sqr of components of b swuares) For regression step 1: f(x) = [x][b], step 2: A = [x.^0 ...] and y = given, step 3: do LSE and find xhat which will be a,b,c

### Ax = b

 Echelon form Leading entries in every row are farther to the right than the row above. To do = elimin­ation steps Reduced Echelon form (rref) echelon + columns of leading entries are all 0 except the entry which must be a 1. To do = elimin­ations steps down to right, then left to top Ax=b with LU L = identity but a21 = -λ1, a31 = -λ2, a32 = -λ3. U =

### Ax = b (A and b specified)

 Echelon form Leading entries in every row are farther to the right than the row above. To do = elimin­ation steps Reduced Echelon form (rref) echelon + columns of leading entries are all 0 except the entry which must be a 1. To do = elimin­ations steps down to right, then left to top Ax=b with LU L = identity but a21 = -λ1, a31 = -λ2, a32 = -λ3. U = echelon. Then do Ly=b - given (solve for y), then Ux=y (solve for x) Ax=b with CR tMaybe not full rank. C = columns of A that have a pivot in R. R = rref form. To find x --> using R to find FV, pivots, and special solutions (if b not 0 do rref([A b])), if one soln is given then add that in gen sol and just do rref(A)

### Eigenv­ectors and Eigenv­alues

 v eigenv­ector λ eigenvalue Finding λ 1. Diag or triang = entries of diag. 2. 2x2 do λ = m +- sqrt (m^2 - p), where m = (a11+a­22)/2, and p = a11*a22 - a12*a21 Finding v rref ( [A - λ*eye ] ) and find FV, pivots, and ss Diagon­ali­zation A = P*D*P^­(-1), where P = [eigen­vec­tors] , D = diag(λ) When can we diagon­alize* Only when: square, real λ, and if repeated λ - look rref ( [A - λ*eye ] ) and only 1 pivot. A = Q*D*Q' Q = special solutions form rref ( [A - λ*eye ] ) for every λ, and then doing norm(q1) for all of them. D = diag(λs) Is λ an eigenvalue Do rref ( [A - λ*eye ] ) and has to be only 1 pivot (linearly dependent) Positive definite λs all positive Semipo­sitive definite λs all positive and at least a 0 Indefinite λ at least one is negative

### Vector Spaces and Basis

 Subspace If u and v are in W , then u + v are in W , and cu is in W Basis B for V A linearly indepe­ndent set such that Span (B) = V To show sthg is a basis, show it is linearly indepe­ndent (rref(A) has NO FV) and spans(no row of 0's). Row(A) Space spanned by the rows of A: Row-reduce A and choose the rows that contain the pivots. Row(A) = R^n, dim = rank, Basis of Row = R in A = CR Col(A) Space spanned by columns of A: Row-reduce A and choose the columns of A that contain the pivots. Col(A) = R^m, dim = rank, Basis of Col = C in A = CR Null(A) / Vector in Null Solutions of Ax = 0. Row-reduce A. Null(A) = R^n, dim = n-rank, Basis of Null = rref(A), FV, pivots, special solutions LeftNu­ll(A) Solutions of A'x = 0. Row-reduce A'. LeftNu­ll(A) = R^m, dim = m-rank, Basis of LeftNull = rref(A'), FV, pivots, special solutions Rank(A) number of pivots Is v in Null do A*v and it needs to equal to vector 0 find v in ColA same vectors as in matrix Is v in col space of B is B*x=v consis­tent? do rref([B v]) and see if consistent

### Gram-S­chmidt steps

 A q1 = A(:,1) Q = q1 xhat =(q1'*­A(:­,2)­)/(­q1'*q1) ahat = Q*xhat q2 = A(:,2) - ahat Q(:,2) = q2 Q(:,1) = 1/(q'1­*q1)*q1 Q(:,2) = 1/(q'2­*q2)*q2 Q = [ Q(:,1) Q(:,2) ] R = Q'*A if 3x3 keep going

### Orthog­onality

 v and u are othogonal if v*u = 0 W⊥: Set of v which are orthogonal to every w in W. Orthogonal projec­tion: If {u1 · · · uk } is a basis for W , then orthogonal projection of y on W is: yˆ=(y·­u1/­u1*­u1)­+··­·+(­y·u­1/u­k*uk), and y − yˆ is orthogonal to yˆ, shortest distance btw y and W is ||y−yˆ|| Basis of W⊥: basis of Null(Mw) Equalities between basis (RowA)' = NullA and vice versa. (ColA)­'=L­eft­NullA and vice versa