The biggest Markov chain in the world

Similar documents
The Eigenvector. [12] The Eigenvector

Math 18, Linear Algebra, Lecture C00, Spring 2017 Review and Practice Problems for Final Exam

2. Every linear system with the same number of equations as unknowns has a unique solution.

DIAGONALIZATION. In order to see the implications of this definition, let us consider the following example Example 1. Consider the matrix

MATH 310, REVIEW SHEET 2

Computationally, diagonal matrices are the easiest to work with. With this idea in mind, we introduce similarity:

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

Third Midterm Exam Name: Practice Problems November 11, Find a basis for the subspace spanned by the following vectors.

MAT 1302B Mathematical Methods II

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

and let s calculate the image of some vectors under the transformation T.

(b) If a multiple of one row of A is added to another row to produce B then det(b) =det(a).

Calculating determinants for larger matrices

MAT1302F Mathematical Methods II Lecture 19

Review problems for MA 54, Fall 2004.

Name Solutions Linear Algebra; Test 3. Throughout the test simplify all answers except where stated otherwise.

Section 6.4. The Gram Schmidt Process

1 Last time: least-squares problems

1. In this problem, if the statement is always true, circle T; otherwise, circle F.

Math 240 Calculus III

Question 7. Consider a linear system A x = b with 4 unknown. x = [x 1, x 2, x 3, x 4 ] T. The augmented

Math 3191 Applied Linear Algebra

Eigenvalues, Eigenvectors, and an Intro to PCA

Eigenvalues for Triangular Matrices. ENGI 7825: Linear Algebra Review Finding Eigenvalues and Diagonalization

More chapter 3...linear dependence and independence... vectors

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

Review for Exam Find all a for which the following linear system has no solutions, one solution, and infinitely many solutions.

Determinants and Scalar Multiplication

Jordan Normal Form and Singular Decomposition

MATH 1553-C MIDTERM EXAMINATION 3


Linear Algebra Final Exam Study Guide Solutions Fall 2012

MATH 23a, FALL 2002 THEORETICAL LINEAR ALGEBRA AND MULTIVARIABLE CALCULUS Solutions to Final Exam (in-class portion) January 22, 2003

Warm-up. True or false? Baby proof. 2. The system of normal equations for A x = y has solutions iff A x = y has solutions

MATH 1553 PRACTICE MIDTERM 3 (VERSION A)

MATH 310, REVIEW SHEET

Question: Given an n x n matrix A, how do we find its eigenvalues? Idea: Suppose c is an eigenvalue of A, then what is the determinant of A-cI?

Lecture 2: Eigenvalues and their Uses

Eigenvalues for Triangular Matrices. ENGI 7825: Linear Algebra Review Finding Eigenvalues and Diagonalization

33AH, WINTER 2018: STUDY GUIDE FOR FINAL EXAM

A Brief Outline of Math 355

Therefore, A and B have the same characteristic polynomial and hence, the same eigenvalues.

Notes on Eigenvalues, Singular Values and QR

Math Computation Test 1 September 26 th, 2016 Debate: Computation vs. Theory Whatever wins, it ll be Huuuge!

18.06 Problem Set 8 Solution Due Wednesday, 22 April 2009 at 4 pm in Total: 160 points.

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Examples True or false: 3. Let A be a 3 3 matrix. Then there is a pattern in A with precisely 4 inversions.

235 Final exam review questions

Linear Algebra - Part II

Don t forget to think of a matrix as a map (a.k.a. A Linear Algebra Primer)

Linear Algebra Primer

A Note on Google s PageRank

Chapter 2:Determinants. Section 2.1: Determinants by cofactor expansion

Chapter 4 & 5: Vector Spaces & Linear Transformations

Lecture 10 - Eigenvalues problem

Math Lecture 26 : The Properties of Determinants

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

4. Determinants.

MATH 235. Final ANSWERS May 5, 2015

Solutions to Final Exam

MA 265 FINAL EXAM Fall 2012

Chapter 5. Eigenvalues and Eigenvectors

Eigenvalues, Eigenvectors, and an Intro to PCA

Minimal Polynomials and Jordan Normal Forms

Math 520 Exam 2 Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

Lecture 6: Lies, Inner Product Spaces, and Symmetric Matrices

1 0 1, then use that decomposition to solve the least squares problem. 1 Ax = 2. q 1 = a 1 a 1 = 1. to find the intermediate result:

(a) If A is a 3 by 4 matrix, what does this tell us about its nullspace? Solution: dim N(A) 1, since rank(a) 3. Ax =

18.06 Problem Set 8 - Solutions Due Wednesday, 14 November 2007 at 4 pm in

Remark By definition, an eigenvector must be a nonzero vector, but eigenvalue could be zero.

Chapters 5 & 6: Theory Review: Solutions Math 308 F Spring 2015

Symmetric matrices and dot products

Matrix Operations: Determinant

LS.1 Review of Linear Algebra

EIGENVALUE PROBLEMS. Background on eigenvalues/ eigenvectors / decompositions. Perturbation analysis, condition numbers..

ft-uiowa-math2550 Assignment NOTRequiredJustHWformatOfQuizReviewForExam3part2 due 12/31/2014 at 07:10pm CST

Lecture 19: The Determinant

Linear Algebra- Final Exam Review

1. Foundations of Numerics from Advanced Mathematics. Linear Algebra

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

Recall : Eigenvalues and Eigenvectors

Eigenvalues, Eigenvectors, and an Intro to PCA

Summer Session Practice Final Exam

Math 291-2: Lecture Notes Northwestern University, Winter 2016

Math Linear Algebra Final Exam Review Sheet

Linear Algebra Primer

CS 246 Review of Linear Algebra 01/17/19

Math 416, Spring 2010 The algebra of determinants March 16, 2010 THE ALGEBRA OF DETERMINANTS. 1. Determinants

Linear Algebra (MATH ) Spring 2011 Final Exam Practice Problem Solutions

MATH 221, Spring Homework 10 Solutions

MATH Topics in Applied Mathematics Lecture 12: Evaluation of determinants. Cross product.

4.2. ORTHOGONALITY 161

Application. Stochastic Matrices and PageRank

(Practice)Exam in Linear Algebra

Spectral radius, symmetric and positive matrices

18.06SC Final Exam Solutions

Math 2030, Matrix Theory and Linear Algebra I, Fall 2011 Final Exam, December 13, 2011 FIRST NAME: LAST NAME: STUDENT ID:

MATH 1553 PRACTICE MIDTERM 3 (VERSION B)

Announcements Monday, November 26

Linear Systems. Class 27. c 2008 Ron Buckmire. TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5.4

Transcription:

The biggest Markov chain in the world Randy s web-surfing behavior: From whatever page he s viewing, he selects one of the links uniformly at random and follows it. Defines a Markov chain in which the states are web pages. Idea: Suppose this Markov chain has a stationary distribution. Find the stationary distribution probabilities for all web pages. Use each web page s probability as a measure of the page s importance. When someone searches for matrix book, which page to return? Among all pages with those terms, return the one with highest probability. Advantages: Computation of stationary distribution is independent of search terms: can be done once and subsequently used for all searches. Potentially could use power method to compute stationary distribution. Pitfalls: Maybe there are several, and how would you compute one?

Using Perron-Frobenius Theorem If can get from every state to every other state in one step, Perron-Frobenius Theorem ensures that there is only one stationary distribution... and that the Markov chain converges to it... so can use power method to estimate it. Pitfall: This isn t true for the web! Workaround: Solve the problem with a hack: In each step, with probability 0.5, Randy just teleports to a web page chosen uniformly at random.

Mix of two distributions Following random links: 2 3 4 5 2 2 A = 3 4 2 2 5 3 4 3 3 2 5 2 3 Uniform distribution: transition matrix like 2 3 4 5 A 2 = 2 3 4 5 Use a mix of the two: incidence matrix is A = 0.85 A + 0.5 A 2 To find the stationary distribution, use power method to estimate the eigenvector v corresponding to eigenvalue. Adding those matrices? Multiplying them by a vector? Need a clever trick.

Clever approach to matrix-vector multiplication A = 0.85 A + 0.5 A 2 A v = (0.85 A + 0.5 A 2 )v = 0.85 (A v) + 0.5 (A 2 v) Multiplying by A : use sparse matrix-vector multiplication you implemented in Mat Multiplying by A 2 : Use the fact that A 2 =. [ n n n ]

Estimating an eigenvalue of smallest absolute value We can (sometimes) use the power method to estimate the eigenvalue of largest absolute value. What if we want the eigenvalue of smallest absolute value? Lemma: Suppose M is an invertible endomorphic matrix. The eigenvalues of M are the reciprocals of the eigenvalues of M. Therefore a small eigenvalue of M corresponds to a large eigenvalue of M. But it s numerically a bad idea to compute M. Fortunately, we don t need to! The vector w such that w = M v is exactly the vector w that solves the equation Mx = v. def power_method(a, k): v = normalized random start vector for _ in range(k) w = M*v v = normalized(v) return v def inverse_power_method(a, k): v = normalized random start vector for _ in range(k) w = solve(m, v) v = normalized(v) return v

Computing an eigenvalue: Shifting and inverse power method You should be able to prove this: Lemma:[Shifting Lemma] Let A be an endomorphic matrix and let µ be a number. Then λ is an eigenvalue of A if and only if λ µ is an eigenvalue of A µ. Idea of shifting: Suppose you have an estimate µ of some eigenvalue λ of matrix A. You can test if estimate is perfect, i.e. if µ is an eigenvalue of A. Suppose not... If µ is close to λ then A µ has an eigenvalue that is close to zero. Idea: Use inverse power method on (A µ) to estimate smallest eigenvalue.

Computing an eigenvalue: Putting it together Idea for algorithm: Shift matrix by estimate µ: A µ Use multiple iterations of inverse power method to estimate eigenvector for smallest eigenvalue of A µ Use new estimate for new shift. Faster: Just use one iteration of inverse power method slightly better estimate use to get better shift. def inverse_iteration(a, mu): I = identity matrix v = normalized random start vector for i in range(0): M = A - mu*i w = solve(m, v) v = normalized(w) mu = v*a*v if A*v == mu*v: break return mu, v

Computing an eigenvalue: Putting it together Could repeatedly Shift matrix by estimate µ: A µ Use multiple iterations of inverse power method to estimate eigenvector for smallest eigenvalue of A µ Use new estimate for new shift. Faster: Just use one iteration of inverse power method slightly better estimate use to get better shift. def inverse_iteration(a, mu): I = identity matrix v = normalized random start vector for i in range(0): M = A - mu*i try: w = solve(m, v) except ZeroDivisionError: break v = normalized(w) mu = v*a*v test = A*v - mu*v if test*test < e-30: break return mu, v

def inverse_iteration(a, mu): I = identity matrix v = normalized random start vector for i in range(0): M = A - mu*i w = solve(m, v) v = normalized(w) mu = v*a*v if A*v == mu*v: break return mu, v def inverse_iteration(a, mu): I = identity matrix v = normalized random start vector for i in range(0): M = A - mu*i try: w = solve(m, v) except ZeroDivisionError: break v = normalized(w) mu = v*a*v test = A*v - mu*v if test*test < e-30: break return mu, v

Limitations of eigenvalue analysis We ve seen: Every endomorphic matrix does have an eigenvalue but the eigenvalue might not be a real number. Not every endomorphic matrix is diagonalizable (Therefore) not every n n matrix M has n linearly independent eigenvectors. This is usually not a big problem since most endomorphic matrics are diagonalizable, and also there are methods of analysis that can be used even when not. However, there is a class of matrices that arise often in applications for which everything is nice... 2 4 Definition: Matrix A is symmetric if A T = A. Example: 2 9 0 4 0 7 Theorem: Let A be a symmetric matrix over R. Then there is an orthogonal matrix Q and diagonal matrix Λ over R such that Q T AQ = Λ

Eigenvalues for symmetric matrices Theorem: Let A be a symmetric matrix over R. Then there is an orthogonal matrix Q and diagonal matrix Λ over R such that Q T AQ = Λ For symmetric matrices, everything is nice: QΛQ T is a diagonalization of A, so A is diagonalizable! The columns of Q are eigenvectors... Not only linearly independent but mutually orthogonal! Λ is over R, so the eigenvalues of A are real! See text for proof.

Eigenvalues for asymmetric matrices For asymmetric matrices, eigenvalues might not even be real, and diagonalization need not exist. However, a triangularization always exists called Schur decomposition Theorem: Let A be an endomorphic matrix. There is an invertible matrix U and an upper triangular matrix T, both over the complex numbers, such that A = UTU. 2 3 2 0 2 3 2 =.27.92.37.72.33.557.35.22.743 2 2.97.849 0 0 2.54 0 0 4.27.92.37.72.33.557.35.22.743 Recall that the diagonal elements of a triangular matrix are the eigenvalues. Note that an eigenvalue can occur more than once on the diagonal. We say, e.g. that 2 is an eigenvalue with multiplicity two.

Eigenvalues for asymmetric matrices For asymmetric matrices, eigenvalues might not even be real, and diagonalization need not exist. However, a triangularization always exists called Schur decomposition 2 Theorem: Let A be an endomorphic matrix. There is an invertible matrix U and an upper triangular matrix T, both over the complex numbers, such that A = UTU. 27 48 8 0 0 0 3 =.89.454.0355.445.849.284.0989.28.958 2 29 82.4 0 2 4.9 0 0.89.454.0355.445.849.284.0989.28.958 Recall that the diagonal elements of a triangular matrix are the eigenvalues. Note that an eigenvalue can occur more than once on the diagonal. We say, e.g. that 2 is an eigenvalue with multiplicity two.

Positive definite, Positive semi-definite, and Determinant Let A be an n n matrix. Linear function f (x) = Ax maps an n-dimensional cube to an n-dimensional parallelpiped. cube = {[x,..., x n ] : 0 x i for i =,..., n} The n-dimensional volume of the input cube is. The determinant of A (det A) measures the volume of the output parallelpiped. 2 Example: A = 3 turns a cube into a 2 3 4 box. 4 Volume of box is 2 3 4. Determinant of A is 24.

Square to square

Signed volume A can flip a square, in which case the determinant of A is negative.

Image of square is a parallelogram The area of parallelogram is 2, and flip occured, so determinant is -2.

Special case: diagonal matrix If A is diagonal, e.g. A = diagonal elements. [ 2 0 0 3 ], image of square is a rectangle with area = product of a 2 a

Special case: orthogonal columns in dimension two Let A = [ 2 9/2 2 9/2 ]. Then the columns of A are orthogonal, and their lengths are 2 and 3, so the area is again. a 2 a

Special case: orthogonal columns in higher dimension If A = a a n where a,..., a n are mutually orthogonal then image of hypercube is a hyperrectangle {α a + + α n a n : 0 α,..., α n } a 3 a 2 whose sides a,..., a n are mutually orthogonal, so volume is a... a n so determinant is ± a... a n. a

Non-orthogonal columns If columns of A are non-orthogonal vectors a, a 2 then image of square is a parallelogram. a 2 a

Example of non-orthogonal columns: triangular matrix Columns of [ 3 0 2 ] are a = [ 0 ] and a 2 = [ 3 2 ]. a 2 a Lengths of orthogonal projections are the absolute values of the diagonal elements. In fact, determinant is product of diagonal elements

Image of cube is parallelpiped A = 2 2 3 2

Image of a parallelpiped If input is a parallelpiped instead of hypercube, determinant of A gives (signed) ratio volume of output volume of input What is det AB? When matrices multiply, functions compose, so blow-ups in volume multiply: Key Fact: det(ab) = det(a) det(b) Since det(identity matrix) is, det(a ) = / det(a)

Determinant and triangular matrices Consider triangularization A = UTU. 27 48 8 0 0 0 3 =.89.454.0355.445.849.284.0989.28.958 2 29 82.4 0 2 4.9 0 0.89.454.0355.445.849.284.0989.28.958 Shows det A = det T Thus det A is the product of eigenvalues (taking into account multiplicities)

Measure n-dimensional volume For n n matrix, must measure n-dimensional volume. 3 2 Consider A = 5 4 0 9 Cols a,..., a 3 are linearly dependent, so is two-dimensional so volume is zero. {α a + α 2 a 2 + α 3 a 3 : 0 α, α 2, α 3 } Key Fact: If columns are linearly dependent then determinant is zero.

Multilinearity Key Fact: The determinant of n n matrix can be written as a sum of (many) terms, each a (signed) product of n entries of matrix. 2 2 matrix A: A[, ] A[22] A[, 2] A[2, ] 3 3 matrix A: A[, ]A[2, 2]A[3, 3] A[, ]A[2, 3]A[32] A[, 2]A[2, ]A[3, 3] + A[, 2]A[2, 3]A[3, ] + A[, 3]A[2, ]A[3, 2] A[, 3]A[2, 2]A[3, ] 4 4? Number of terms is n! so not a good way of computing determinants of big matrices! Better algorithms use matrix factorizations.

Uses of determinants Mathematically useful but computationally not so much. Testing a matrix for invertibility? Good in theory but our other methods are better numerically. Arises in chain rule for multivariate calculus. Can be used to find eigenvalues but in practice, other methods are better.

Area of polygon Polygon with vertices a 0, a,..., a n. Break it into triangles: triangle formed by origin with a 0 and a, with a and a 2, etc. a 0 a a2 a 3

Method fails because triangles are not disjoin and don t lie within polygon. Works if you use signed area. Area of polygon What if polygon looks like this? a 0 a a 2 a 3 a 5 a 4