You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -51,8 +51,6 @@ Nonnegative matrices have several special and useful properties.
51
51
In this section we will discuss some of them --- in particular, the connection
52
52
between nonnegativity and eigenvalues.
53
53
54
-
Let $a^{k}_{ij}$ be element $(i,j)$ of $A^k$.
55
-
56
54
An $n \times m$ matrix $A$ is called **nonnegative** if every element of $A$
57
55
is nonnegative, i.e., $a_{ij} \geq 0$ for every $i,j$.
58
56
@@ -65,38 +63,56 @@ We introduced irreducible matrices in the [Markov chain lecture](mc_irreducible)
65
63
66
64
Here we generalize this concept:
67
65
68
-
An $n \times n$ matrix $A$ is called irreducible if, for each $i,j$ with $1 \leq i, j \leq n$, there exists a $k \geq 0$ such that $a^{k}_{ij} > 0$.
69
-
70
-
A matrix $A$ that is not irreducible is called reducible.
66
+
Let $a^{k}_{ij}$ be element $(i,j)$ of $A^k$.
71
67
72
-
Here are some examples to illustrate this further.
68
+
An $n \times n$ nonnegative matrix $A$ is called irreducible if $A + A^2 + A^3 + \cdots \gg 0$, where $\gg 0$ denotes every element in $A$ is nonnegative.
73
69
74
-
1. $A = \begin{bmatrix} 0.5 & 0.1 \\ 0.2 & 0.2 \end{bmatrix}$ is irreducible since $a_{ij}>0$ for all $(i,j)$.
70
+
In other words, for each $i,j$ with $1 \leq i, j \leq n$, there exists a $k \geq 0$ such that $a^{k}_{ij} > 0$.
75
71
76
-
2. $A = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$ is irreducible since $a_{12},a_{21} >0$ and $a^{2}_{11},a^{2}_{22} >0$.
72
+
Here are some examples to illustrate this further:
77
73
78
-
3. $A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$ is reducible since $A^k = A$ for all $k \geq 0$ and thus
79
-
$a^{k}_{12},a^{k}_{21} = 0$ for all $k \geq 0$.
74
+
$$
75
+
A = \begin{bmatrix} 0.5 & 0.1 \\
76
+
0.2 & 0.2
77
+
\end{bmatrix}
78
+
$$
80
79
81
-
### Primitive matrices
80
+
$A$ is irreducible since $a_{ij}>0$ for all $(i,j)$.
82
81
83
-
Let $A$ be a square nonnegative matrix and let $A^k$ be the $k^{th}$ power of $A$.
82
+
$$
83
+
B = \begin{bmatrix} 0 & 1 \\
84
+
1 & 0
85
+
\end{bmatrix}
86
+
, \quad
87
+
B^2 = \begin{bmatrix} 1 & 0 \\
88
+
0 & 1
89
+
\end{bmatrix}
90
+
$$
84
91
85
-
A matrix is called **primitive** if there exists a $k \in \mathbb{N}$ such that $A^k$ is everywhere positive.
92
+
$B$ is irreducible since $b_{12},b_{21} >0$ and $b^{2}_{11},b^{2}_{22} >0$.
86
93
87
-
It means that $A$ is called primitive if there is an integer $k \geq 0$ such that $a^{k}_{ij} > 0$ for *all* $(i,j)$.
94
+
$$
95
+
C = \begin{bmatrix} 1 & 0 \\
96
+
0 & 1
97
+
\end{bmatrix}
98
+
$$
88
99
89
-
We can see that if a matrix is primitive, then it implies the matrix is irreducible.
100
+
$C$ is reducible since $C^k = C$ for all $k \geq 0$ and thus
101
+
$c^{k}_{12},c^{k}_{21} = 0$ for all $k \geq 0$.
90
102
91
103
### Left eigenvectors
92
104
93
-
We previously discussed right (ordinary) eigenvectors $Av = \lambda v$.
105
+
Recall that we previously discussed eigenvectors in {ref}`Eigenvalues and Eigenvectors <la_eigenvalues>`.
94
106
95
-
Here we introduce left eigenvectors.
107
+
The eigenvalue $\lambda$ and its cooresponding eigenvecotr $v$ of matrix $A$ satisfy
96
108
97
-
Left eigenvectors will play important roles in what follows, including that of stochastic steady states for dynamic models under a Markov assumption.
109
+
$$
110
+
Av = \lambda v.
111
+
$$
112
+
113
+
In this section we will define $v$ as right eigenvectors since we will be introducing left eigenvectors now.
98
114
99
-
We will talk more about this later, but for now, let's define left eigenvectors.
115
+
Left eigenvectors will play important roles in what follows, including that of stochastic steady states for dynamic models under a Markov assumption.
100
116
101
117
A vector $w$ is called a left eigenvector of $A$ if $w$ is an eigenvector of $A^\top$.
102
118
@@ -109,37 +125,31 @@ A = np.array([[3, 2],
109
125
[1, 4]])
110
126
111
127
# Compute right eigenvectors and eigenvalues
112
-
λ_r, v = eig(A)
128
+
λ, v = eig(A)
113
129
114
130
# Compute left eigenvectors and eigenvalues
115
-
λ_l, w = eig(A.T)
131
+
λ, w = eig(A.T)
116
132
117
-
print("Right Eigenvalues:")
118
-
print(λ_r)
119
-
print("\nRight Eigenvectors:")
120
-
print(v)
121
-
print("\nLeft Eigenvalues:")
122
-
print(λ_l)
123
-
print("\nLeft Eigenvectors:")
124
-
print(w)
133
+
np.set_printoptions(precision=5)
134
+
135
+
print(f"The eigenvalues of A are:\n {λ}\n")
136
+
print(f"The corresponding right eigenvectors are: \n {v[:,0]} and {-v[:,1]}\n")
137
+
print(f"The corresponding left eigenvectors are: \n {w[:,0]} and {-w[:,1]}\n")
125
138
```
126
139
127
140
We can use `scipy.linalg.eig` with argument `left=True` to find left eigenvectors directly
128
141
129
142
```{code-cell} ipython3
130
143
eigenvals, ε, e = sp.linalg.eig(A, left=True)
131
144
132
-
print("Right Eigenvalues:")
133
-
print(λ_r)
134
-
print("\nRight Eigenvectors:")
135
-
print(v)
136
-
print("\nLeft Eigenvalues:")
137
-
print(λ_l)
138
-
print("\nLeft Eigenvectors:")
139
-
print(w)
145
+
print(f"The eigenvalues of A are:\n {eigenvals.real}\n")
146
+
print(f"The corresponding right eigenvectors are: \n {e[:,0]} and {-e[:,1]}\n")
147
+
print(f"The corresponding left eigenvectors are: \n {ε[:,0]} and {-ε[:,1]}\n")
140
148
```
141
149
142
-
Note that the eigenvalues for both left and right eigenvectors are the same, but the eigenvectors themselves are different.
150
+
We can find that the eigenvalues are the same while the eigenvectors themselves are different.
151
+
152
+
(Also note that we are taking the nonnegative value of the eigenvector of {ref}`dominant eigenvalue <perron-frobe>`, this is because `eig` automatically normalize the eigenvectors.)
143
153
144
154
We can then take transpose to obtain $A^\top w = \lambda w$ and obtain $w^\top A= \lambda w^\top$.
145
155
@@ -168,11 +178,7 @@ Moreover if $A$ is also irreducible then,
168
178
4. the eigenvector $v$ associated with the eigenvalue $r(A)$ is strictly positive.
169
179
5. there exists no other positive eigenvector $v$ (except scalar multiples of $v$) associated with $r(A)$.
170
180
171
-
If $A$ is primitive then,
172
-
173
-
6. the inequality $|\lambda| \leq r(A)$ is **strict** for all eigenvalues $\lambda$ of $A$ distinct from $r(A)$, and
174
-
7. with $v$ and $w$ normalized so that the inner product of $w$ and $v = 1$, we have
175
-
$ r(A)^{-m} A^m$ converges to $v w^{\top}$ when $m \rightarrow \infty$. The matrix $v w^{\top}$ is called the **Perron projection** of $A$
181
+
(More of the Perron-Frobenius theorem about primitive matrices will be introduced {ref}`below <prim_matrices>`.)
176
182
```
177
183
178
184
(This is a relatively simple version of the theorem --- for more details see
@@ -184,7 +190,7 @@ Let's build our intuition for the theorem using a simple example we have seen [b
184
190
185
191
Now let's consider examples for each case.
186
192
187
-
#### Example 1: irreducible matrix
193
+
#### Example: Irreducible matrix
188
194
189
195
Consider the following irreducible matrix $A$:
190
196
@@ -200,15 +206,62 @@ We can compute the dominant eigenvalue and the corresponding eigenvector
200
206
eig(A)
201
207
```
202
208
203
-
Now we can go through our checklist to verify the claims of the Perron-Frobenius Theorem for the irreducible matrix $A$:
209
+
Now we will can see the claims of the Perron-Frobenius Theorem holds for the irreducible matrix $A$:
204
210
205
211
1. The dominant eigenvalue is real-valued and non-negative.
206
212
2. All other eigenvalues have absolute values less than or equal to the dominant eigenvalue.
207
213
3. A non-negative and nonzero eigenvector is associated with the dominant eigenvalue.
208
214
4. As the matrix is irreducible, the eigenvector associated with the dominant eigenvalue is strictly positive.
209
215
5. There exists no other positive eigenvector associated with the dominant eigenvalue.
210
216
211
-
#### Example 2: primitive matrix
217
+
(prim_matrices)=
218
+
### Primitive matrices
219
+
220
+
We know that in real world situations it's hard for a matrix to be everywhere positive (although they have nice properties).
221
+
222
+
The primitive matrices, however, can still give us helpful properties with looser definitions.
223
+
224
+
Let $A$ be a square nonnegative matrix and let $A^k$ be the $k^{th}$ power of $A$.
225
+
226
+
A matrix is called **primitive** if there exists a $k \in \mathbb{N}$ such that $A^k$ is everywhere positive.
227
+
228
+
Recall the examples given in irreducible matrices:
229
+
230
+
$$
231
+
A = \begin{bmatrix} 0.5 & 0.1 \\
232
+
0.2 & 0.2
233
+
\end{bmatrix}
234
+
$$
235
+
236
+
$A$ here is also a primitive matrix since $A^k$ is everywhere nonnegative for $k \in \mathbb{N}$.
237
+
238
+
$$
239
+
B = \begin{bmatrix} 0 & 1 \\
240
+
1 & 0
241
+
\end{bmatrix}
242
+
, \quad
243
+
B^2 = \begin{bmatrix} 1 & 0 \\
244
+
0 & 1
245
+
\end{bmatrix}
246
+
$$
247
+
248
+
$B$ is irreducible but not premitive since there are always zeros in either principal diagonal or secondary diagonal.
249
+
250
+
We can see that if a matrix is primitive, then it implies the matrix is irreducible but not vice versa.
251
+
252
+
Now let's step back to the primitive matrices part of the Perron-Frobenius Theorem
253
+
254
+
```{prf:Theorem} Continous of Perron-Frobenius Theorem
255
+
:label: con-perron-frobenius
256
+
257
+
If $A$ is primitive then,
258
+
259
+
6. the inequality $|\lambda| \leq r(A)$ is **strict** for all eigenvalues $\lambda$ of $A$ distinct from $r(A)$, and
260
+
7. with $v$ and $w$ normalized so that the inner product of $w$ and $v = 1$, we have
261
+
$ r(A)^{-m} A^m$ converges to $v w^{\top}$ when $m \rightarrow \infty$. The matrix $v w^{\top}$ is called the **Perron projection** of $A$.
262
+
```
263
+
264
+
#### Example 1: Primitive matrix
212
265
213
266
Consider the following primitive matrix $B$:
214
267
@@ -226,7 +279,7 @@ We compute the dominant eigenvalue and the corresponding eigenvector
226
279
eig(B)
227
280
```
228
281
229
-
Now let's verify the claims of the Perron-Frobenius Theorem for the primitive matrix $B$:
282
+
Now let's give some examples to see if the claims of the Perron-Frobenius Theorem holds for the primitive matrix $B$:
230
283
231
284
1. The dominant eigenvalue is real-valued and non-negative.
232
285
2. All other eigenvalues have absolute values strictly less than the dominant eigenvalue.
@@ -327,11 +380,11 @@ These examples show how the Perron-Frobenius Theorem relates to the eigenvalues
327
380
In fact we have already seen the theorem in action before in {ref}`the markov chain lecture <mc1_ex_1>`.
328
381
329
382
(spec_markov)=
330
-
#### Example 3: Connection to Markov chains
383
+
#### Example 2: Connection to Markov chains
331
384
332
385
We are now prepared to bridge the languages spoken in the two lectures.
333
386
334
-
A primitive matrix is both irreducible (or strongly connected in the language of {ref}`graph theory<strongly_connected>`and aperiodic.
387
+
A primitive matrix is both irreducible and aperiodic.
335
388
336
389
So Perron-Frobenius Theorem explains why both Imam and Temple matrix and Hamilton matrix converge to a stationary distribution, which is the Perron projection of the two matrices
337
390
@@ -398,7 +451,7 @@ As we have seen, the largest eigenvalue for a primitive stochastic matrix is one
398
451
This can be proven using [Gershgorin Circle Theorem](https://en.wikipedia.org/wiki/Gershgorin_circle_theorem),
399
452
but it is out of the scope of this lecture.
400
453
401
-
So by the statement (6) of Perron-Frobenius Theorem, $\lambda_i<1$ for all $i<n$, and $\lambda_n=1$ when $P$ is primitive (strongly connected and aperiodic).
454
+
So by the statement (6) of Perron-Frobenius Theorem, $\lambda_i<1$ for all $i<n$, and $\lambda_n=1$ when $P$ is primitive.
402
455
403
456
404
457
Hence, after taking the Euclidean norm deviation, we obtain
0 commit comments