Skip to content

Commit 35cdb8e

Browse files
authored
Merge pull request #256 from QuantEcon/update_eigen
Update `EigenII`
2 parents f08466e + 2ec0ca3 commit 35cdb8e

File tree

2 files changed

+229
-175
lines changed

2 files changed

+229
-175
lines changed

lectures/eigen_I.md

+113-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ At the same time, these concepts are extremely useful for
3535
* machine learning
3636
* and many other fields of science.
3737

38-
In this lecture we explain the basics of eigenvalues and eigenvectors.
38+
In this lecture we explain the basics of eigenvalues and eigenvectors and introduce the Neumann Series Lemma.
3939

4040
We assume in this lecture that students are familiar with matrices
4141
and understand {doc}`the basics of matrix algebra<linear_equations>`.
@@ -791,7 +791,6 @@ When solving $Av = \lambda v$,
791791

792792
We will see some examples below.
793793

794-
795794
### Some mathematical details
796795

797796
We note some mathematical details for more advanced readers.
@@ -813,8 +812,6 @@ in $\lambda$ of degree $n$.
813812
This in turn implies the existence of $n$ solutions in the complex
814813
plane, although some might be repeated.
815814

816-
817-
818815
### Facts
819816

820817
Some nice facts about the eigenvalues of a square matrix $A$ are as follows:
@@ -857,6 +854,118 @@ The eigenvectors and eigenvalues of a map $A$ determine how a vector $v$ is tran
857854

858855
This is discussed further later.
859856

857+
858+
(la_neumann)=
859+
## The Neumann Series Lemma
860+
861+
```{index} single: Neumann's Lemma
862+
```
863+
864+
In this section we present a famous result about series of matrices that has
865+
many applications in economics.
866+
867+
### Scalar series
868+
869+
Here's a fundamental result about series that you surely know:
870+
871+
If $a$ is a number and $|a| < 1$, then
872+
873+
```{math}
874+
:label: gp_sum
875+
876+
\sum_{k=0}^{\infty} a^k =\frac{1}{1-a} = (1 - a)^{-1}
877+
878+
```
879+
880+
For a one-dimensional linear equation $x = ax + b$ where x is unknown we can thus conclude that the solution $x^{*}$ is given by:
881+
882+
$$
883+
x^{*} = \frac{b}{1-a} = \sum_{k=0}^{\infty} a^k b
884+
$$
885+
886+
### Matrix series
887+
888+
A generalization of this idea exists in the matrix setting.
889+
890+
Consider the system of equations $x = Ax + b$ where $A$ is an $n \times n$
891+
square matrix and $x$ and $b$ are both column vectors in $\mathbb{R}^n$.
892+
893+
Using matrix algebra we can conclude that the solution to this system of equations will be given by:
894+
895+
```{math}
896+
:label: neumann_eqn
897+
898+
x^{*} = (I-A)^{-1}b
899+
900+
```
901+
902+
What guarantees the existence of a unique vector $x^{*}$ that satisfies
903+
{eq}`neumann_eqn`?
904+
905+
The following is a fundamental result in functional analysis that generalizes
906+
{eq}`gp_sum` to a multivariate case.
907+
908+
(neumann_series_lemma)=
909+
```{prf:Theorem} Neumann Series Lemma
910+
:label: neumann_series_lemma
911+
912+
Let $A$ be a square matrix and let $A^k$ be the $k$-th power of $A$.
913+
914+
Let $r(A)$ be the **spectral radius** of $A$, defined as $\max_i |\lambda_i|$, where
915+
916+
* $\{\lambda_i\}_i$ is the set of eigenvalues of $A$ and
917+
* $|\lambda_i|$ is the modulus of the complex number $\lambda_i$
918+
919+
Neumann's Theorem states the following: If $r(A) < 1$, then $I - A$ is invertible, and
920+
921+
$$
922+
(I - A)^{-1} = \sum_{k=0}^{\infty} A^k
923+
$$
924+
```
925+
926+
We can see the Neumann Series Lemma in action in the following example.
927+
928+
```{code-cell} ipython3
929+
A = np.array([[0.4, 0.1],
930+
[0.7, 0.2]])
931+
932+
evals, evecs = eig(A) # finding eigenvalues and eigenvectors
933+
934+
r = max(abs(λ) for λ in evals) # compute spectral radius
935+
print(r)
936+
```
937+
938+
The spectral radius $r(A)$ obtained is less than 1.
939+
940+
Thus, we can apply the Neumann Series Lemma to find $(I-A)^{-1}$.
941+
942+
```{code-cell} ipython3
943+
I = np.identity(2) #2 x 2 identity matrix
944+
B = I - A
945+
```
946+
947+
```{code-cell} ipython3
948+
B_inverse = np.linalg.inv(B) #direct inverse method
949+
```
950+
951+
```{code-cell} ipython3
952+
A_sum = np.zeros((2,2)) #power series sum of A
953+
A_power = I
954+
for i in range(50):
955+
A_sum += A_power
956+
A_power = A_power @ A
957+
```
958+
959+
Let's check equality between the sum and the inverse methods.
960+
961+
```{code-cell} ipython3
962+
np.allclose(A_sum, B_inverse)
963+
```
964+
965+
Although we truncate the infinite sum at $k = 50$, both methods give us the same
966+
result which illustrates the result of the Neumann Series Lemma.
967+
968+
860969
## Exercises
861970

862971
```{exercise}

0 commit comments

Comments
 (0)