Link to this document's Jupyter Notebook

In order to successfully complete this assignment you need to participate both individually and in groups during class. If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asynchronously, turn in your assignment using D2L no later than 11:59pm on the day of class. See links at the end of this document for access to the class timeline for your section.


In order to successfully complete this assignment you need to participate both individually and in groups during class. If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asyncronously, turn in your assignment using D2L no later than 11:59pm on the day of class. See links at the end of this document for access to the class timeline for your section.

In-Class Assignment: Diagonalization

Classig equation for diagonalizing a matrix. Will be discussed in class

Image from: https://en.wikipedia.org/wiki/Diagonalizable_matrix

Agenda for today's class (80 minutes)

  1. (20 minutes) Quiz 3 Review
  2. (20 minutes) Pre-class Assignment Review
  3. (20 minutes) Diagonalization
  4. (20 minutes) The Power of a Matrix

1. Quiz 3 Review

Time is set aside to ask questions about homework.


2. Pre-class Assignment Review


3. Diagonalization

Reminder: The eigenvalues of triangular (upper and lower) and diagonal matrices are easy:

Diagonalization

Definition: A square matrix $A$ is said to be diagonalizable if there exist a matrix $C$ such that $D=C^{-1}AC$ is a diagonal matrix.

Definition: $B$ is a similar matrix of $A$ if we can find $C$ such that $B=C^{-1}AC$.

Given an $n\times n$ matrix $A$, can we find another $n \times n$ invertable matrix $C$ such that when $D=C^{-1}AC$ is diagonal, i.e., $A$ is diagonalizable?

A simple example

Consider the following: $$ A = \begin{bmatrix}7& -10\\3& -4\end{bmatrix},\quad C = \begin{bmatrix}2& 5\\1& 3\end{bmatrix}$$

Do this: Find the similar matrix $D = C^{-1}AC$ of $A$.

Do this: Find the eigenvalues and eigenvectors of $A$. Set variables e1 and vec1 to be the smallest eigenvalue and it's associated eigenvector and e2, vec2 to represent the largest.

Theorem: Similar matrices have the same eigenvalues.

Proof: Assume $B=C^{-1}AC$ is a similar matrix of $A$, and $\lambda$ is an eigenvalue of $A$ with corresponding eigenvector $x$. That is, $$Ax=\lambda x$$ Then we have $$B(C^{-1}x) = C^{-1}AC(C^{-1}x) = C^{-1}Ax = C^{-1}(\lambda x)= \lambda (C^{-1}x).$$ That is $C^{-1}x$ is an eigenvector of $B$ with eigenvalue $\lambda$.

A second example

Do this: Consider $$ A = \begin{bmatrix}-4& -6\\3& 5\end{bmatrix}.$$ Find a matrix $C$ such that $C^{-1}AC$ is diagonal. (Hint, use the function diagonalize in sympy.)

The third example

Do this: Consider $$ A = \begin{bmatrix}5& -3\\3& -1\end{bmatrix}.$$ Can we find a matrix $C$ such that $C^{-1}AC$ is diagonal? (Hint: find eigenvalues and eigenvectors using sympy)

Dimensions of eigenspaces and diagonalization

Definition: The set of all eigenvectors of a $n\times n$ matrix corresponding to a eigenvalue $\lambda$, together with the zero vector, is a subspace of $R^n$. This subspace spaces is called eigenspace.

The dimension of an eigenspace of a matrix is less than or equal to the multiplicity of the corresponding eigenvalue as a root of the characteristic equation.

A matrix is diagonalizable if and only if the dimension of every eigenspace is equal to the multiplicity of the corresponding eigenvalue as a root of the characteristic equation.

The fourth example

Do this: Consider $$ A = \begin{bmatrix}2& -1\\1& 2\end{bmatrix}.$$ Can we find a matrix $C$ such that $C^{-1}AC$ is diagonal?


4. The Power of a Matrix

Graph Random Walk

$$W=\frac{1}{2}(I + AD^{-1})$$ $$p_{t+1}=Wp_{t}$$ $$p_{t}=W^{t}p_{0}$$ $$p_{t}=\left( \frac{1}{2}(I+AD^{-1}) \right)^t p_{0}$$

DO THIS: Using matrix algebra, show that $\frac{1}{2}(I + AD^{-1})$ is similar to $I-\frac{1}{2}N$, where $N=D^{-\frac{1}{2}}(D-A)D^{-\frac{1}{2}}$ is the normalized graph Laplacian.

Your answer goes here (follow along after attempting)

Random Walk on Barbell Graph

To generate the barbell graph, run the following cell.

Do this: Generate the lazy random walk matrix, $W$, for the above graph.

Do this: Compute the eigenvalues and eigenvectors of $W$. Make a diagonal matrix $J$ with the eigenvalues on the diagonal. Name the matrix of eigenvectors $V$ (each column is an eigenvector).

Now we make sure we constructed $V$ and $A$ correctly by double checking that $W = VJV^{-1}$

Do this: Let your $p_{0}=[1,0,0,\ldots,0]$. Compute $p_{t}$ for $t=1,2,\ldots,100$, and plot $||v_{1}-p_{t}||_{1}$ versus $t$, where $v_{1}$ is the eigenvector associated with the largest eigenvalue $\lambda_{1}=1$ and whose sum equals 1. (Note: $||\cdot||_{1}$ may be computed using np.linalg.norm(v_1-p_t, 1).)

Compare to Complete Graph

If you complete the above, do the same for a complete graph on the same number of nodes.

Question: What do you notice about the graph that is different from that above?

Put your answer to the above question here.


Congratulations, we're done!

If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asynchronously, turn in your assignment using D2L.

Course Resources:

Written by Dr. Dirk Colbry, Michigan State University Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.