@@ -39,11 +39,11 @@ Such a problem is also sometimes called an optimal linear regulator problem.
39394040A Lagrangian formulation
414142- * carries insights about connections between stability and optimality
42+* carries insights about connections between stability and optimality
434344- * is the basis for fast algorithms for solving Riccati equations
44+* is the basis for fast algorithms for solving Riccati equations
454546- * opens the way to constructing solutions of dynamic systems that don't come directly from an intertemporal optimization problem
46+* opens the way to constructing solutions of dynamic systems that don't come directly from an intertemporal optimization problem
47474848A key tool in this lecture is the concept of an $n \times n$ **symplectic** matrix.
4949@@ -78,7 +78,7 @@ $$
78787979subject to $x_{t+1}=Ax_t+Bu_t$, where $x_0$ is a given initial state vector.
808081- Here $x_t$ is an $(n\times 1)$ vector of state variables, $u_t$ is a $(k\times 1)$
81+Here $x_t$ is an $(n\times 1)$ vector of state variables, $u_t$ is a $(k\times 1)$
8282vector of controls, $R$ is a positive semidefinite symmetric matrix,
8383$Q$ is a positive definite symmetric matrix, $A$ is an $(n\times n)$
8484matrix, and $B$ is an $(n\times k)$ matrix.
@@ -116,8 +116,9 @@ $$
116116or
117117118118$$
119- u=-Fx,
119+u=-Fx,
120120$$
121+121122where
122123123124$$
@@ -139,7 +140,7 @@ But only one of them is positive definite.
139140140141The positive define solution is associated with the maximum of our problem.
141142142-It expresses the matrix $P$ as an implicit function of the matrices
143+It expresses the matrix $P$ as an implicit function of the matrices
143144$R,Q,A,B$.
144145145146Notice that the **gradient of the value function** is
@@ -168,7 +169,9 @@ where $2 \mu_{t+1}$ is a vector of Lagrange multipliers on the time $t$ transiti
168169First-order conditions for maximization with respect to $\{u_t,x_{t+1}\}_{t=0}^\infty$ are
169170170171$$
171-\eqalign{2 Q u_t &+ 2B^\prime \mu_{t+1} = 0 \ ,\ t \geq 0 \cr \mu_t &= R x_t + A^\prime \mu_{t+1}\ ,\ t\geq 1.\cr}
172+\begin{aligned}
173+2 Q u_t &+ 2B^\prime \mu_{t+1} = 0 \ ,\ t \geq 0 \cr \mu_t &= R x_t + A^\prime \mu_{t+1}\ ,\ t\geq 1.\cr
174+\end{aligned}
172175$$ (eq2)
173176174177Define $\mu_0$ to be a vector of shadow prices of $x_0$ and apply an envelope condition to {eq}`eq1`
@@ -183,7 +186,7 @@ which is a time $t=0 $ counterpart to the second equation of system {eq}`eq2`.
183186An important fact is that
184187185188$$
186- \mu_{t+1} = P x_{t+1}
189+\mu_{t+1} = P x_{t+1}
187190$$ (eqn:muPx)
188191189192where $P$ is a positive define matrix that solves the algebraic Riccati equation {eq}`riccati`.
@@ -196,36 +199,36 @@ corresponds to the **state** vector $x_t$.
196199197200It is useful to proceed with the following steps:
198201199- * solve the first equation of {eq}`eq2` for $u_t$ in terms of $\mu_{t+1}$.
202+* solve the first equation of {eq}`eq2` for $u_t$ in terms of $\mu_{t+1}$.
200203201- * substitute the result into the law of motion $x_{t+1} = A x_t + B u_t$.
202-203- * arrange the resulting equation and the second equation of {eq}`eq2` into the form
204+* substitute the result into the law of motion $x_{t+1} = A x_t + B u_t$.
205+206+* arrange the resulting equation and the second equation of {eq}`eq2` into the form
204207205208$$
206-L\ \pmatrix{x_{t+1}\cr \mu_{t+1}\cr}\ = \ N\ \pmatrix{x_t\cr \mu_t\cr}\
209+L\ \begin{pmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{pmatrix}\ = \ N\ \begin{pmatrix}x_t\cr \mu_t\cr\end{pmatrix}\
207210,\ t \geq 0,
208211$$ (eq:systosolve)
209212210213where
211214212215$$
213-L = \ \pmatrix{I & BQ^{-1} B^\prime \cr 0 & A^\prime\cr}, \quad N = \
214-\pmatrix{A & 0\cr -R & I\cr}.
216+L = \ \begin{pmatrix}I & BQ^{-1} B^\prime \cr 0 & A^\prime\cr\end{pmatrix}, \quad N = \
217+\begin{pmatrix}A & 0\cr -R & I\cr\end{pmatrix}.
215218$$
216219217220When $L$ is of full rank (i.e., when $A$ is of full rank), we can write
218221system {eq}`eq:systosolve` as
219222220223$$
221-\pmatrix{x_{t+1}\cr \mu_{t+1}\cr}\ = M\ \pmatrix{x_t\cr\mu_t\cr}
224+\begin{pmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{pmatrix}\ = M\ \begin{pmatrix}x_t\cr\mu_t\cr\end{pmatrix}
222225$$ (eq4orig)
223226224227where
225228226229$$
227-M\equiv L^{-1} N = \pmatrix{A+B Q^{-1} B^\prime A^{\prime-1}R &
228--B Q^{-1} B^\prime A^{\prime-1}\cr -A^{\prime -1} R & A^{\prime -1}\cr}.
230+M\equiv L^{-1} N = \begin{pmatrix}A+B Q^{-1} B^\prime A^{\prime-1}R &
231+-B Q^{-1} B^\prime A^{\prime-1}\cr -A^{\prime -1} R & A^{\prime -1}\cr\end{pmatrix}.
229232$$ (Mdefn)
230233231234+++
@@ -236,15 +239,16 @@ $$ (Mdefn)
236239We seek to solve the difference equation system {eq}`eq4orig` for a sequence $\{x_t\}_{t=0}^\infty$
237240that satisfies
238241239- * an initial condition for $x_0$
240- * a terminal condition $\lim_{t \rightarrow +\infty} x_t =0$
242+* an initial condition for $x_0$
243+* a terminal condition $\lim_{t \rightarrow +\infty} x_t =0$
241244242245This terminal condition reflects our desire for a **stable** solution, one that does not diverge as $t \rightarrow \infty$.
243246244247245248We inherit our wish for stability of the $\{x_t\}$ sequence from a desire to maximize
246249247-$$ -\sum_{t=0}^\infty \bigl[ x_t ' R x_t + u_t' Q u_t \bigr],
250+$$
251+-\sum_{t=0}^\infty \bigl[ x_t ' R x_t + u_t' Q u_t \bigr],
248252$$
249253250254which requires that $x_t' R x_t$ converge to zero as $t \rightarrow + \infty$.
@@ -258,7 +262,7 @@ To proceed, we study properties of the $(2n \times 2n)$ matrix $M$ defined in {e
258262It helps to introduce a $(2n \times 2n)$ matrix
259263260264$$
261-J= \pmatrix{0 & -I_n\cr I_n & 0\cr}.
265+J = \begin{pmatrix}0 & -I_n\cr I_n & 0\cr\end{pmatrix}.
262266$$
263267264268The rank of $J$ is $2n$.
@@ -283,11 +287,11 @@ by a **similarity transformation**.
283287284288For square matrices, recall that
285289286- * similar matrices share eigenvalues
287-288- * eigenvalues of the inverse of a matrix are inverses of eigenvalues of the matrix
289-290- * a matrix and its transpose share eigenvalues
290+* similar matrices share eigenvalues
291+292+* eigenvalues of the inverse of a matrix are inverses of eigenvalues of the matrix
293+294+* a matrix and its transpose share eigenvalues
291295292296It then follows from equation {eq}`eq4` that
293297the eigenvalues of $M$ occur in reciprocal pairs: if $\lambda$ is an
@@ -299,12 +303,12 @@ $$
299303y_{t+1} = M y_t
300304$$ (eq658)
301305302-where $y_t = \pmatrix{x_t\cr \mu_t\cr}$.
306+where $y_t = \begin{pmatrix}x_t\cr \mu_t\cr\end{pmatrix}$.
303307304308Consider a **triangularization** of $M$
305309306310$$
307-V^{-1} M V= \pmatrix{W_{11} & W_{12} \cr 0 & W_{22}\cr}
311+V^{-1} M V= \begin{pmatrix}W_{11} & W_{12} \cr 0 & W_{22}\cr\end{pmatrix}
308312$$ (eqn:triangledecomp)
309313310314where
@@ -329,7 +333,7 @@ A solution of equation {eq}`eq659` for arbitrary initial condition $y_0$ is
329333evidently
330334331335$$
332-y_{t} = V \left[\matrix{W^t_{11} & W_{12,t}\cr 0 & W^t_{22}\cr}\right]
336+y_{t} = V \left[\begin{matrix}W^t_{11} & W_{12,t}\cr 0 & W^t_{22}\cr\end{matrix}\right]
333337\ V^{-1} y_0
334338$$ (eq6510)
335339@@ -344,9 +348,9 @@ and where $W^t_{ii}$ is $W_{ii}$ raised to the $t$th power.
344348Write equation {eq}`eq6510` as
345349346350$$
347-\pmatrix{y^\ast_{1t}\cr y^\ast_{2t}\cr}\ =\ \left[\matrix{W^t_{11} &
348-W_{12, t}\cr 0 & W^t_{22}\cr}\right]\quad \pmatrix{y^\ast_{10}\cr
349-y^\ast_{20}\cr}
351+\begin{pmatrix}y^\ast_{1t}\cr y^\ast_{2t}\cr\end{pmatrix}\ =\ \left[\begin{matrix} W^t_{11} &
352+W_{12, t}\cr 0 & W^t_{22}\cr\end{matrix}\right]\quad \begin{pmatrix}y^\ast_{10}\cr
353+y^\ast_{20}\cr\end{pmatrix}
350354$$
351355352356where $y^\ast_t = V^{-1} y_t$, and in particular where
@@ -385,7 +389,7 @@ But notice that because $(V^{21}\ V^{22})$ is the second row block of
385389the inverse of $V,$ it follows that
386390387391$$
388-(V^{21} \ V^{22})\quad \pmatrix{V_{11}\cr V_{21}\cr} = 0
392+(V^{21} \ V^{22})\quad \begin{pmatrix}V_{11}\cr V_{21}\cr\end{pmatrix} = 0
389393$$
390394391395which implies
@@ -514,8 +518,8 @@ eigvals
514518515519When we apply Schur decomposition such that $M=V W V^{-1}$, we want
516520517- * the upper left block of $W$, $W_{11}$, to have all of its eigenvalues less than 1 in modulus, and
518- * the lower right block $W_{22}$ to have eigenvalues that exceed 1 in modulus.
521+* the upper left block of $W$, $W_{11}$, to have all of its eigenvalues less than 1 in modulus, and
522+* the lower right block $W_{22}$ to have eigenvalues that exceed 1 in modulus.
519523520524To get what we want, let's define a sorting function that tells `scipy.schur` to sort the corresponding eigenvalues with modulus smaller than 1 to the upper left.
521525@@ -786,7 +790,9 @@ First-order conditions for maximization with respect
786790to $\{u_t,x_{t+1}\}_{t=0}^\infty$ are
787791788792$$
789-\eqalign{2 Q u_t &+ 2 \beta B^\prime \mu_{t+1} = 0 \ ,\ t \geq 0 \cr \mu_t &= R x_t + \beta A^\prime \mu_{t+1}\ ,\ t\geq 1.\cr}
793+\begin{aligned}
794+2 Q u_t &+ 2 \beta B^\prime \mu_{t+1} = 0 \ ,\ t \geq 0 \cr \mu_t &= R x_t + \beta A^\prime \mu_{t+1}\ ,\ t\geq 1.\cr
795+\end{aligned}
790796$$ (eq662)
791797792798Define $2 \mu_0$ to be the vector of shadow prices of $x_0$ and apply an envelope condition to
@@ -802,12 +808,12 @@ Proceeding as we did above with the undiscounted system {eq}`eq2`, we can rear
802808system
803809804810$$
805-\left[\matrix{ I & \beta B Q^{-1} B' \cr
806- 0 & \beta A' }\right]
807-\left[\matrix{ x_{t+1} \cr \mu_{t+1} }\right] =
808-\left[\matrix{ A & 0 \cr
809- - R & I }\right]
810-\left[\matrix{ x_t \cr \mu_t }\right]
811+\left[\begin{matrix} I & \beta B Q^{-1} B' \cr
812+ 0 & \beta A' \end{matrix}\right]
813+\left[\begin{matrix} x_{t+1} \cr \mu_{t+1} \end{matrix}\right] =
814+\left[\begin{matrix} A & 0 \cr
815+ - R & I \end{matrix}\right]
816+\left[\begin{matrix} x_t \cr \mu_t \end{matrix}\right]
811817$$ (eq663)
812818813819which in the special case that $\beta = 1$ agrees with equation {eq}`eq2`, as expected.
@@ -889,8 +895,4 @@ $$ (eq667)
889895890896where we must require that $F$ obeys equation {eq}`eqn:optimalFformula`.
891897892-Equations {eq}`eq666` and {eq}`eq667` provide different perspectives on the optimal value function.
893-894-```{code-cell} ipython3
895-896-```
898+Equations {eq}`eq666` and {eq}`eq667` provide different perspectives on the optimal value function.