GitHub

@@ -11,9 +11,9 @@ kernelspec:

1111

name: python3

1212

---

131314-

# Spectral Theory

14+

# The Perron-Frobenius Theorem

151516-

```{index} single: Spectral Theory

16+

```{index} single: The Perron-Frobenius Theorem

1717

```

18181919

```{contents} Contents

@@ -51,8 +51,6 @@ Nonnegative matrices have several special and useful properties.

5151

In this section we will discuss some of them --- in particular, the connection

5252

between nonnegativity and eigenvalues.

535354-

Let $a^{k}_{ij}$ be element $(i,j)$ of $A^k$.

55-5654

An $n \times m$ matrix $A$ is called **nonnegative** if every element of $A$

5755

is nonnegative, i.e., $a_{ij} \geq 0$ for every $i,j$.

5856

@@ -65,38 +63,56 @@ We introduced irreducible matrices in the [Markov chain lecture](mc_irreducible)

65636664

Here we generalize this concept:

676568-

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$.

716772-

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.

736974-

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$.

757176-

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:

777378-

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+

$$

807981-

### Primitive matrices

80+

$A$ is irreducible since $a_{ij}>0$ for all $(i,j)$.

828183-

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+

$$

849185-

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$.

869387-

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+

$$

889989-

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$.

9010291103

### Left eigenvectors

9210493-

We previously discussed right (ordinary) eigenvectors $Av = \lambda v$.

105+

Recall that we previously discussed eigenvectors in {ref}`Eigenvalues and Eigenvectors <la_eigenvalues>`.

9410695-

Here we introduce left eigenvectors.

107+

The eigenvalue $\lambda$ and its cooresponding eigenvecotr $v$ of matrix $A$ satisfy

9610897-

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.

9811499-

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.

100116101117

A vector $w$ is called a left eigenvector of $A$ if $w$ is an eigenvector of $A^\top$.

102118

@@ -109,37 +125,31 @@ A = np.array([[3, 2],

109125

[1, 4]])

110126111127

# Compute right eigenvectors and eigenvalues

112-

λ_r, v = eig(A)

128+

λ, v = eig(A)

113129114130

# Compute left eigenvectors and eigenvalues

115-

λ_l, w = eig(A.T)

131+

λ, w = eig(A.T)

116132117-

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")

125138

```

126139127140

We can use `scipy.linalg.eig` with argument `left=True` to find left eigenvectors directly

128141129142

```{code-cell} ipython3

130143

eigenvals, ε, e = sp.linalg.eig(A, left=True)

131144132-

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")

140148

```

141149142-

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.)

143153144154

We can then take transpose to obtain $A^\top w = \lambda w$ and obtain $w^\top A= \lambda w^\top$.

145155

@@ -168,11 +178,7 @@ Moreover if $A$ is also irreducible then,

168178

4. the eigenvector $v$ associated with the eigenvalue $r(A)$ is strictly positive.

169179

5. there exists no other positive eigenvector $v$ (except scalar multiples of $v$) associated with $r(A)$.

170180171-

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>`.)

176182

```

177183178184

(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

184190185191

Now let's consider examples for each case.

186192187-

#### Example 1: irreducible matrix

193+

#### Example: Irreducible matrix

188194189195

Consider the following irreducible matrix $A$:

190196

@@ -200,15 +206,62 @@ We can compute the dominant eigenvalue and the corresponding eigenvector

200206

eig(A)

201207

```

202208203-

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$:

204210205211

1. The dominant eigenvalue is real-valued and non-negative.

206212

2. All other eigenvalues have absolute values less than or equal to the dominant eigenvalue.

207213

3. A non-negative and nonzero eigenvector is associated with the dominant eigenvalue.

208214

4. As the matrix is irreducible, the eigenvector associated with the dominant eigenvalue is strictly positive.

209215

5. There exists no other positive eigenvector associated with the dominant eigenvalue.

210216211-

#### 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

212265213266

Consider the following primitive matrix $B$:

214267

@@ -226,7 +279,7 @@ We compute the dominant eigenvalue and the corresponding eigenvector

226279

eig(B)

227280

```

228281229-

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$:

230283231284

1. The dominant eigenvalue is real-valued and non-negative.

232285

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

327380

In fact we have already seen the theorem in action before in {ref}`the markov chain lecture <mc1_ex_1>`.

328381329382

(spec_markov)=

330-

#### Example 3: Connection to Markov chains

383+

#### Example 2: Connection to Markov chains

331384332385

We are now prepared to bridge the languages spoken in the two lectures.

333386334-

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.

335388336389

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

337390

@@ -398,7 +451,7 @@ As we have seen, the largest eigenvalue for a primitive stochastic matrix is one

398451

This can be proven using [Gershgorin Circle Theorem](https://en.wikipedia.org/wiki/Gershgorin_circle_theorem),

399452

but it is out of the scope of this lecture.

400453401-

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.

402455403456404457

Hence, after taking the Euclidean norm deviation, we obtain

Read the original on github.com ↗