The Eigenvector. [12] The Eigenvector

Similar documents
The biggest Markov chain in the world

Chapter 5. Eigenvalues and Eigenvectors

Announcements Monday, October 29

Study Guide for Linear Algebra Exam 2

MAT 1302B Mathematical Methods II

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

Eigenvalues and Eigenvectors

Math 3191 Applied Linear Algebra

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

12. Perturbed Matrices

Markov Chains and Pandemics

CS 246 Review of Linear Algebra 01/17/19

MATH 1120 (LINEAR ALGEBRA 1), FINAL EXAM FALL 2011 SOLUTIONS TO PRACTICE VERSION

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

MAT1302F Mathematical Methods II Lecture 19

Application. Stochastic Matrices and PageRank

1 Last time: least-squares problems

Math 54 Homework 3 Solutions 9/

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

Eigenvalues and Eigenvectors

Math Final December 2006 C. Robinson

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

Summer Session Practice Final Exam

Eigenvalues, Eigenvectors, and Diagonalization

Name: Final Exam MATH 3320

spring, math 204 (mitchell) list of theorems 1 Linear Systems Linear Transformations Matrix Algebra

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

Math 2331 Linear Algebra

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

Recitation 8: Graphs and Adjacency Matrices

MATH 221, Spring Homework 10 Solutions

Properties of Linear Transformations from R n to R m

Recall : Eigenvalues and Eigenvectors

MATH 310, REVIEW SHEET 2

5.3.5 The eigenvalues are 3, 2, 3 (i.e., the diagonal entries of D) with corresponding eigenvalues. Null(A 3I) = Null( ), 0 0

4. Linear transformations as a vector space 17

Lecture 3 Eigenvalues and Eigenvectors

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

Glossary of Linear Algebra Terms. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Eigenvalues and Eigenvectors

Solving a system by back-substitution, checking consistency of a system (no rows of the form

2 Eigenvectors and Eigenvalues in abstract spaces.

Eigenvalues and eigenvectors

Announcements Wednesday, November 01

MATH SOLUTIONS TO PRACTICE MIDTERM LECTURE 1, SUMMER Given vector spaces V and W, V W is the vector space given by

Linear Algebra Exercises

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS

6.842 Randomness and Computation March 3, Lecture 8

Linear Algebra: Sample Questions for Exam 2

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

TMA Calculus 3. Lecture 21, April 3. Toke Meier Carlsen Norwegian University of Science and Technology Spring 2013

Generalized eigenspaces

Announcements Wednesday, November 01

Topic 1: Matrix diagonalization

Eigenvalues and Eigenvectors

MAC Module 12 Eigenvalues and Eigenvectors. Learning Objectives. Upon completing this module, you should be able to:

MAC Module 12 Eigenvalues and Eigenvectors

The Jordan Normal Form and its Applications

Matrices related to linear transformations

MAT2342 : Introduction to Applied Linear Algebra Mike Newman, fall Projections. introduction

Eigenvector Review. Notes. Notes. Notes. Problems pulled from archived UBC final exams

In this section again we shall assume that the matrix A is m m, real and symmetric.

EIGENVALUES AND EIGENVECTORS 3

REVIEW FOR EXAM III SIMILARITY AND DIAGONALIZATION

Linear Algebra- Final Exam Review

Chapter 4 & 5: Vector Spaces & Linear Transformations

c c c c c c c c c c a 3x3 matrix C= has a determinant determined by

Remarks on Definitions

Elementary Linear Algebra Review for Exam 3 Exam is Friday, December 11th from 1:15-3:15

Generalized Eigenvectors and Jordan Form

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

DS-GA 1002 Lecture notes 0 Fall Linear Algebra. These notes provide a review of basic concepts in linear algebra.

Diagonalization of Matrices

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

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics MATH M Test #1. July 11, 2013 Solutions

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

21 Linear State-Space Representations

Final Exam Practice Problems Answers Math 24 Winter 2012

Math 113 Homework 5. Bowei Liu, Chao Li. Fall 2013

Solutions to Final Exam

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 110 Linear Algebra Midterm 2 Review October 28, 2017

Span and Linear Independence

MATH 1553 PRACTICE FINAL EXAMINATION

MATH 2331 Linear Algebra. Section 2.1 Matrix Operations. Definition: A : m n, B : n p. Example: Compute AB, if possible.

Linear Algebra II Lecture 13

DM554 Linear and Integer Programming. Lecture 9. Diagonalization. Marco Chiarandini

Calculating determinants for larger matrices

The Leslie Matrix. The Leslie Matrix (/2)

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

Stochastic modelling of epidemic spread

IEOR 6711: Professor Whitt. Introduction to Markov Chains

Linear Algebra, Summer 2011, pt. 2

Maths for Signals and Systems Linear Algebra in Engineering

MATH 20F: LINEAR ALGEBRA LECTURE B00 (T. KEMP)

W2 ) = dim(w 1 )+ dim(w 2 ) for any two finite dimensional subspaces W 1, W 2 of V.

Differential Equations

Definition (T -invariant subspace) Example. Example

Total 100

235 Final exam review questions

Transcription:

The Eigenvector [ The Eigenvector

Two interest-bearing accounts Suppose Account yields 5% interest and Account yields 3% interest. Represent balances in the two accounts by a -vector x (t) = x (t+) = [.05 0 0.03 x (t) [ amount in Account amount in Account Let A denote the matrix. It is diagonal. To find out how, say, x (00) compares to x (0), we can use Equation repeatedly: x (00) = Ax (99) = A(Ax (98) ). = A } A {{ A} 00 times = A 00 x (0) x (0).

Two interest-bearing accounts x (00) = Ax (99) = A(Ax (98) ). = A } A {{ A} 00 times = A 00 x (0) x (0) Since A is a diagonal matrix, easy to compute powers of A:

Two interest-bearing accounts x (00) = Ax (99) = A(Ax (98) ). = A } A {{ A} 00 times = A 00 x (0) x (0) Since A is a diagonal matrix, easy to compute powers of A: [ [ [.05 0.05 0.05 0 = 0.03 0.03 0.03

Two interest-bearing accounts x (00) = Ax (99) = A(Ax (98) ). = A } A {{ A} 00 times = A 00 x (0) x (0) Since A is a diagonal matrix, easy to compute powers of A: [ [.05 0.05 0 0.03 0.03 }{{} 00 times The takeaway: [ Account balance after t years Account balance after t years = = [.05 00 0 0.03 00 [ 3.5 0 0 9. [.05t (initial Account balance).03 t (initial Account balance)

Rabbit reproduction To avoid getting into trouble, I ll pretend sex doesn t exist. Each month, each adult rabbit gives birth to one baby. A rabbit takes one month to become an adult. Rabbits never die. [ adults at time t + juveniles at time t + Time 0 Time Time Time 3 Time 4 [ a a = a a }{{} [ number of adults after t months Use x (t) = number of juveniles after t months [ Then x (t+) = Ax (t) where A =. 0 [, 0, [,, [,, [3,, [5, 3, [8, 3,... A [ adults at time t juveniles at time t

Analyzing rabbit reproduction [ x (t+) = Ax (t) where A =. 0 As in bank-account example, x (t) = A t x (0). How can this help us calculate how the entries of x (t) grow as a function of t? In the bank-account example, we were able to understand the behavior because A was a diagonal matrix. This time, A is not diagonal. However, there is a workaround: Let S = [ + 5 5. Then S AS is the diagonal matrix A t = } A A {{ A} t times = (SΛS )(SΛS ) (SΛS ) = SΛ t S [ + 5 0 0 5. Λ is a diagonal matrix easy to compute Λ t. [ [ λ λ If Λ = then Λ t t = λ λ t. Here Λ = [ + 5 5.

Interpretation using change of basis Interpretation:To make the analysis easier, we will use a[ change of basis [ Basis consists of the two columns of the matrix S, v = + 5 Let u (t) = coordinate representation of x (t) in terms of v and v., v = 5 (repvec) To go from repres. u (t) to vector x (t) itself, we multiply u (t) by S. (Move forward one month) To go from x (t) to x (t+), we multiply x (t) by A. (vecrep) To go to coord. repres., we multiply by S. Multiplying by the matrix S AS carries out the three steps above. [ [ + 5 But S AS = Λ = 0 + 5 so u (t+) = 0 5 5 0 0 so [ (+ 5 u (t) = ) t 0 u (0) 0 ( 5 ) t u (t)

Eigenvalues and eigenvectors For this topic, consider only matrices A such that row-label set = col-label set (endomorphic matrices). Definition: If λ is a scalar and v is a nonzero vector such that Av = λv, we say that λ is an eigenvalue of A, and v is a corresponding eigenvector. Any nonzero vector in the eigenspace is considered an eigenvector. However, it is often convenient to require that the eigenvector have norm one. [.05 0 Example: has eigenvalues.05 and.03, and corresponding 0.03 eigenvectors [, 0 and [0,. [ Example: has eigenvalues λ 0 = + 5 and λ = 5, and corresponding eigenvectors [ + 5, and [ 5,. Example: What does it mean when A has 0 as an eigenvalue? There is a nonzero vector v such that Av = 0v. That is, A s null space is nontrivial. Last example suggests a way to find an eigenvector corresp. to eigenvalue 0: find nonzero vector in the null space. What about other eigenvalues?

Eigenvector corresponding to an eigenvalue Suppose λ is an eigenvalue of A, with corresponding eigenvector v. Then Av = λ v. That is, Av λ v is the zero vector.the expression Av λ v can be written as (A λ )v,so (A λ )v is the zero vector. That means that v is a nonzero vector in the null space of A λ. That means that A λ is not invertible. Conversely, suppose A λ is not invertible. It is square, so it must have a nontrivial null space. Let v be a nonzero vector in the null space. Then (A λ)v = 0, so Av = λv. We have proved the following: Lemma: Let A be a square matrix. The number λ is an eigenvalue of A if and only if A λ is not invertible. If λ is in fact an eigenvalue of A then the corresponding eigenspace is the null space of A λ. Corollary If λ is an eigenvalue of A then it is an eigenvalue of A T.

Similarity Definition: Two matrices A and B are similar if there is an invertible matrix S such that S AS = B. Proposition: Similar matrices have the same eigenvalues. Proof: Suppose λ is an eigenvalue of A and v is a corresponding eigenvector. By definition, Av = λ v. Suppose S AS = B, and let w = S v. Then which shows that λ is an eigenvalue of B. Bw = S ASw = S ASS v = S Av = S λ v = λ S v = λ w

Example of similarity Example: We will see later that the eigenvalues of the matrix A = 3 9 0 9 5 0 0 5 its diagonal elements (, 9, and 5) because U is upper triangular. The matrix 9 3 5 B = 4 34 39 has the property that B = S AS where 7 8 99 S = 4 4 3 5. Therefore the eigenvalues of B are also, 9, and 5. are

Diagonalizability Definition: If A is similar to a diagonal matrix, i.e. if there is an invertible matrix S such that S AS = Λ where Λ is a diagonal matrix, we say A is diagonalizable. Equation S AS = Λ is equivalent to equation A = SΛS, which is the form used in the analysis of rabbit population. How is diagonalizability related to eigenvalues? λ Eigenvalues of a diagonal matrix Λ =... are its diagonal entries. If matrix A is similar to Λ then the eigenvalues of A are the eigenvalues of Λ Equation S AS = Λ is equivalent to AS = SΛ. Write S in terms of columns: λ A v v n = v v n... λ n λ n The argument goes both ways: if n n matrix A has n linearly independent eigenvectors then A is diagonalizable.

Diagonalizability Definition: If A is similar to a diagonal matrix, i.e. if there is an invertible matrix S such that S AS = Λ where Λ is a diagonal matrix, we say A is diagonalizable. Equation S AS = Λ is equivalent to equation A = SΛS, which is the form used in the analysis of rabbit population. How is diagonalizability related to eigenvalues? λ Eigenvalues of a diagonal matrix Λ =... are its diagonal entries. If matrix A is similar to Λ then the eigenvalues of A are the eigenvalues of Λ Equation S AS = Λ is equivalent to AS = SΛ. Write S in terms of columns: λ Av Av n = v v n... λ n λ n The argument goes both ways: if n n matrix A has n linearly independent eigenvectors then A is diagonalizable.

Diagonalizability Definition: If A is similar to a diagonal matrix, i.e. if there is an invertible matrix S such that S AS = Λ where Λ is a diagonal matrix, we say A is diagonalizable. Equation S AS = Λ is equivalent to equation A = SΛS, which is the form used in the analysis of rabbit population. How is diagonalizability related to eigenvalues? λ Eigenvalues of a diagonal matrix Λ =... are its diagonal entries. If matrix A is similar to Λ then the eigenvalues of A are the eigenvalues of Λ Equation S AS = Λ is equivalent to AS = SΛ. Write S in terms of columns: Av Av n = λ n λ v λ n v n Columns v,..., v n of S are eigenvectors. Because S is invertible, the eigenvectors are linearly independent. The argument goes both ways: if n n matrix A has n linearly independent eigenvectors then A is diagonalizable.

Diagonalizability Theorem Diagonalizability Theorem: An n n matrix A is diagonalizable iff it has n linearly independent eigenvectors. [ Example: Consider the matrix. Its null space is trivial so zero is not an 0 [ [ [ [ x x x + y eigenvalue. For any -vector, we have =. Suppose λ y 0 y y is an eigenvector. Then for some vector [x, y, λ[x, y = [x + y, y Therefore λ y = y. Therefore y = 0. Therefore every eigenvector is in Span {[, 0}. Thus the matrix does not have two linearly independent eigenvectors, so it is not diagonalizable.

Interpretation using change of basis, revisited Idea used for rabbit problem can be used more generally. Suppose A is a diagonalizable matrix. Then A = SΛS for a diagonal matrix Λ and invertible matrix S. Suppose x (0) is a vector. The equation x (t+) = A x (t) then defines x (), x (), x (3),.... Then x (t) = } A A {{ A} x (0) t times = (SΛS )(SΛS ) (SΛS ) x (0) = SΛ t S x (0) Interpretation: Let u (t) be the coordinate representation of x (t) in terms of the columns of S. Then we have the equation u (t+) = Λ u (t). Therefore λ If Λ =... then u (t) = Λ} Λ {{ Λ} u (0) λ n t times λ t = Λ t u (0) Λ t =... λ t n

Rabbit reproduction and death A disease enters the rabbit population. In each month, A δ fraction of the adult population catches it, an ɛ fraction of the juvenile population catches it, and an η fraction of the sick population die, and the rest recover. Sick rabbits don t produce babies. Equations well adults = ( δ) well adults + ( ɛ)juveniles + ( η) sick juveniles = well adults sick = δ well adults + ɛ juveniles + 0 Represent change in populations by matrix-vector equation well adults at time t + δ ɛ ( η) juveniles at time t + = 0 0 sick at time t + δ ɛ 0 (You might question fractional rabbits, deterministic infection.) Question: Does the rabbit population still grow? well adults at time t juveniles at time t sick at time t

Analyzing the rabbit population in the presence of disease well adults at time t + juveniles at time t + sick at time t + = δ ɛ ( η) 0 0 δ ɛ 0 well adults at time t juveniles at time t sick at time t Question: Does the rabbit population still grow? Depends on the values of the parameters (δ = infection rate among adults, ɛ = infection rate among juveniles, η = death rate among sick). Plug in different values for parameters and then compute eigenvalues δ = 0.5, ɛ = 0.5, η = 0.8. The largest eigenvalue is.7 (with eigenvector [0.99, 0.538, 0.534). This means that the population grows exponentially in time (roughly proportional to.7 t ). δ = 0.7, ɛ = 0.7, η = 0.8. The largest eigenvalue is 0.937. This means the population shrinks exponentially. δ = 0., ɛ = 0., η = 0.8. The largest eigenvalue is.0. Population grows exponentially.

Interpretation using change of basis, re-revisited Suppose n n matrix A is diagonalizable, so it has linearly independent eigenvectors. Suppose eigenvalues are λ λ... λ n and corresponding eigenvectors are v, v,..., v n. The eigenvectors form a basis for R n, so any vector x can be written as a linear combination: x = α v + + α n v n Left-multiply by A on both sides of the equation: Ax = A(α v ) + A(α v ) + + A(α n v n ) = α Av + α Av + + α n Av n = α λ v + α λ v + + α n λ n v n Applying the same reasoning to A(Ax), we get A x = α λ v + α λ v + + α n λ nv n More generally, for any nonnegative integer t, A t x = α λ t v + α λ t v + + α n λ t nv n If λ is bigger than the other eigenvalues then eventually λ t will be much bigger than λ t,..., λt n, so first term will dominate. For a large enough value of t, A t x will be approximately α λ t v.

Expected number of rabbits There s these issues of fractional rabbits and deterministic disease. The matrix-vector equation really describes the expected values of the various populations.

The Internet Worm of 988 Robert T. Morris, Jr. He wrote a program that exploited some known security holes in unix to spread running copies of itself through the Internet. Whenever a worm (running copy) on one computer managed to break into another computer, it would spawn a worm on the other computer. It was intended to remain undetected but eventually it took down most of the computers on the Internet. The reason is that each computer was running many independent instances of the program. He took steps to prevent this. Each worm would check whether there was another worm running on same computer. If so, worm would set a flag indicating it was supposed to die. However, with probability /7 the worm would designate itself immortal. Does the number of worms grow? If so, how fast?

Modeling the Worm Suppose Internet consists of just three computers in a triangular network. In each iteration, each worm has probability /0 of spawning a child worm on each neighboring computer. if it is a mortal worm, with probability /7 it becomes immortal, and otherwise it dies. Worm population represented by a vector x = [x, y, x, y, x 3, y 3 : for i =,, 3, x i is the expected number of mortal worms at computer i, and y i is the expected number of immortal worms at computer i. For t = 0,,,...,, let x (t) = (x (t), y (t), x (t), y (t), x (t) 3, y (t) 3 ). Any mortal worm at computer is a child of a worm at computer or computer 3. Therefore the expected number of mortal worms at computer after t + iterations is /0 times the expected number of worms at computers and 3 after t iterations. Therefore x (t+) = 0 x (t) + 0 y (t) + 0 x (t) 3 + 0 y (t) 3 With probability /7, a mortal worm at computer becomes immortal. The previously immortal worms stay immortal.therefore y (t+) = 7 x (t) + y (t)

Modeling the Worm Therefore x (t+) = 0 x (t) + 0 y (t) + 0 x (t) 3 + 0 y (t) 3 With probability /7, a mortal worm at computer becomes immortal. The previously immortal worms stay immortal.therefore y (t+) = 7 x (t) + y (t) The equations for x (t+) and y (t+) and x (t+) 3 and y (t+) 3 are similar. We therefore get x (t+) = Ax (t) where A is the matrix A = 0 0 /0 /0 /0 /0 /7 0 0 0 0 /0 /0 0 0 /0 /0 0 /7 0 0 /0 /0 /0 /0 0 0 0 0 0 0 /7

Analyzing the worm, continued where A is the matrix A = x (t+) = Ax (t) 0 0 /0 /0 /0 /0 /7 0 0 0 0 /0 /0 0 0 /0 /0 0 /7 0 0 /0 /0 /0 /0 0 0 0 0 0 0 /7 This matrix has linearly independent eigenvectors, and its largest eigenvalue is about.034. Because this is larger than, we can infer that the number of worms will grow exponentially with the number of iterations. t.034 t 00 9 00 84 500 0, 000, 000 00 00, 000, 000

Power method The most efficient methods for computing eigenvalues and eigenvectors are beyond scope of this class. However, here is a simple method to get a rough estimate of the eigenvalue of largest absolute value (and a rough estimate of a corresponding eigenvector). Assume A is diagonalizable, with eigenvalues λ λ λ n and corresponding eigenvectors v, v,..., v n. Recall A t x = α λ t v + α λ t v + + α n λ t nv n If λ > λ,..., λ n then first term will dominate others. Start with a vector x 0. Find x t = A t x 0 by repeated matrix-vector multiplication. Maybe x t is an approximate eigenvector corresponding to eigenvalue of largest absolute value. Which vector x 0 to start with? Algorithm depends on projection onto v being not too small. Random start vector should work okay.

Power method Failure modes of the power method: Initial vector might have tiny projection onto v. Not likely. First few eigenvalues might be the same. Algorithm will work anyway. First eigenvalue might not be much bigger than next. Can still get a good estimate. First few eigenvalues might be different but have same absolute value. This is a real problem! Matrix has two eigenvalues with absolute value. [ Matrix has two complex eigenvalues, 3 i and + 3 i. 4 3

Modeling population movement Dance-club dynamics: At the beginning of each song, 5% of the people standing on the side go onto the dance floor, and % of the people on the dance floor leave it. Suppose that there are a hundred people in the club. Assume nobody enters the club and nobody leaves. What happens to the number of people in each of the two locations? Represent [ state of system by x (t) x (t) [ = number of people standing on side after t songs x (t) = number of people on dance floor after t songs [ x (t+) x (t+) = [.44..5.88 [ x (t) x (t) Diagonalize: S AS = Λ where [.44. A =.5.88, S = [ 0.0959 0.97780 [ 0, Λ = 0 0.3

Analyzing dance-floor dynamics [ x (t) x (t) = ( [ SΛS ) t = SΛ t S [ = = x (0) x (0) x (0) x (0) [ [ t [. 0.84.84.98 0.3.8.8 [ [ [. t 0.84.84.98 0.3 t.8.8 [ = t (.84x (0) +.84x (0). ).98 ( ) = t x (0) + x (0) }{{} total population [.8.8 [ x (0) x (0) [ x (0) x (0) [ + (0.3) t (.8x (0) +.8x (0) ) ( + (0.3) t.8x (0) +.8x (0) ) [

Analyzing dance-floor dynamics, continued [ x (t) x (t) ( ) = x (0) + x (0) }{{} total population [.8.8 ( ) [ + (0.3) t.8x (0) +.8x (0) The numbers of people in the two locations after t songs depend on the initial numbers of people in the two locations. However, the dependency grows weaker as the number of songs increases: (0.3) t gets smaller and smaller, so the second term in the sum matters less and less. After ten songs, (0.3) t is about 0.0000. [.8 The first term in the sum is times the total number of people. This shows.8 that, as the number of songs increases, the proportion of people on the dance floor gets closer and closer to 8%.

Modeling Randy Without changing math, we switch interpretations. Instead of modeling whole dance-club population, we model one person, Randy. Randy s behavior captured in transition diagram: 0.5 0.44 S 0. S 0.88 State S represents Randy being on the side. State S represents Randy being on the dance floor. After each song, Randy follows one of the arrows from current state. Which arrow? Chosen randomly according to probabilities on the arrows (transition probabilities). For each state, labels on arrows from that state must sum to.

Where is Randy? Even if we know where Randy starts at time 0, we can t predict with certainty where he will be at time t. However, for each time t, we can calculate the probability distribution for his location. Since there are two possible[ locations (off floor, on floor), the probability distribution is given by a -vector x (t) x (t) = x (t) where x (t) + x (t) =. Probability distribution for Randy s location at time t + is related to probability distribution for Randy s location at time t: [ x (t+) x (t+) = Using earlier analysis, [ x (t) x (t) = = ( ) [ x (0) + x (0).8.8 [.8.8 [.44..5.88 [ x (t) x (t ) ( ) [ + (0.3) t.8x (0) +.8x (0) ( + (0.3) t.8x (0) +.8x (0) ) [

Where is Randy? [ x (t) x (t) = [.8.8 ( ) [ + (0.3) t.8x (0) +.8x (0) If we know Randy starts off the dance floor at time 0 then x (0) = and x (0) = 0. If we know Randy starts on the dance floor at time 0 then x (0) = 0 and x (0) =. In either case, we can plug in to equation to get exact probability distribution for time t. But after a few songs, the starting [ location doesn t matter much the probability.8 distribution gets very close to in either case..8 This is called Randy s stationary distribution. It doesn t mean Randy stays in one place we expect him to move back and forth all the time. It means that the probability distribution for his location after t steps depends less and less on t.

From Randy to spatial locality in CPU memory fetches We again switch interpretations without changing the math. CPU uses caches and prefetching to improve performance. To help computer architects, it is useful to model CPU access patterns. After accessing location x, CPU usually accesses location x +. Therefore simple model is: Probability[address requested at time t + is + address requested at time t =. However, a slightly more sophisticated model predicts much more accurately. Observation: Once consecutive addresses have been requested in timesteps t and t +, it is very likely that the address requested in timestep t + is also consecutive. Use same model as used for Randy. 0.5 0.44 S S State S = CPU is requesting nonconsecutive addresses. 0.88 State S = CPU is requesting consecutive addresses. 0.

From Randy to spatial locality in CPU memory fetches Observation: Once consecutive addresses have been requested in timesteps t and t +, it is very likely that the address requested in timestep t + is also consecutive. Use same model as used for Randy. 0.5 0.44 S S State S = CPU is requesting nonconsecutive addresses. 0.88 State S = CPU is requesting consecutive addresses. 0. Once CPU starts requesting consecutive addresses, it tends to stay in that mode for a while. This tendency is captured by the model. As with Randy, after a while the probability distribution is [0.8, 0.8. Being in the first state means the CPU is issuing the first of a run of consecutive addresses (possibly of length ) Since the system is in the first state roughly 8% of the time, the average length of such a run is /0.8. Various such calculations can be useful in designing architectures and improving performance.

Markov chains An n-state Markov chain is a system such that At each time, the system is in one of n states, say,..., n, and there is a matrix A such that, if at some time t the system is in state j then for i =,..., n, the probability that the system is in state i at time t + is A[i, j. That is, A[i, j is the probability of transitioning from j to i, the j i transition probability. A is called the transition matrix of the Markov chain. A[, + A[, + + A[n, = Probability( ) + Probability( ) + + Probability( n) = Similarly, every column s elements must sum to. Called a left stochastic matrix (common convention is to use right stochastic matrices, where every [ row s elements sum to )..44. Example: is the transition matrix for a two-state Markov chain..5.88

Big Markov chains Of course, bigger Markov chains can be useful... or fun. A text such as a Shakespeare play can give rise to a Markov chain. The Markov chain has one state for each word in the text. To compute the transition probability from word to word, see how often an occurence of word is followed immediately by word (versus being followed by some other word). Once you have constructed the transition matrix from a text, you can use it to generate random texts that resemble the original. Or, as Zarf did, you can combine two texts to form a single text, and then generate a random text from this chimera. Example from Hamlet/Alice in Wonderland: Oh, you foolish Alice! she answered herself. How can you learn lessons in the world were now but to follow him thither with modesty enough, and likelihood to lead it, as our statists do, A baseness to write this down on the trumpet, and called out First witness!... HORATIO: Most like. It harrows me with leaping in her hand, watching the setting sun, and thinking of little pebbles came rattling in at the door that led into a small passage, not much larger than a pig, my dear, said Alice (she was so much gentry and good will As to expend your time with us a story! said the Caterpillar.

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: There might not be a stationary distribution, or maybe there are several, and how would you compute one?

Stationary distributions Stationary distribution: probability distribution after t iterations gets closer and closer to stationary distribution as t increases. No stationary distribution: Let A be the transition matrix of a Markov chain. Because column sums are, S S [,,..., A = [,,...,. Several stationary distributions: /3 S S4 /3 /3 S S3 Thus is an eigenvalue of A T. Therefore is an eigenvalue of A. Can show that there is no eigenvalue with absolute value bigger than. However, could be eigenvalues of equal absolute value. 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 A = 4 Following random links: 3 4 5 3 5 3 4 3 3 5 3 Uniform distribution: transition matrix of the form 3 4 5 A = 3 4 5 Use a mix of the two: incidence matrix is A = 0.85 A + 0.5 A To find the stationary distribution, find the eigenvector v corresponding to eigenvalue. How? Use power method, which requires repeated matrix-vector multiplications.

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