# 61. Classical Control with Linear Algebra#

Contents

## 61.1. Overview#

In an earlier lecture Linear Quadratic Dynamic Programming Problems we have studied how to solve a special class of dynamic optimization and prediction problems by applying the method of dynamic programming. In this class of problems

the objective function is

**quadratic**in**states**and**controls**the one-step transition function is

**linear**shocks are i.i.d. Gaussian or martingale differences

In this lecture and a companion lecture Classical Filtering with Linear Algebra, we study the classical theory of linear-quadratic (LQ) optimal control problems.

The classical approach does not use the two closely related methods – dynamic programming and Kalman filtering – that we describe in other lectures, namely, Linear Quadratic Dynamic Programming Problems and A First Look at the Kalman Filter.

Instead they use either.

\(z\)-transform and lag operator methods, or.

matrix decompositions applied to linear systems of first-order conditions for optimum problems.

In this lecture and the sequel Classical Filtering with Linear Algebra, we mostly rely on elementary linear algebra.

The main tool from linear algebra we’ll put to work here is LU decomposition.

We’ll begin with discrete horizon problems.

Then we’ll view infinite horizon problems as appropriate limits of these finite horizon problems.

Later, we will examine the close connection between LQ control and least squares prediction and filtering problems.

These classes of problems are connected in the sense that to solve each, essentially the same mathematics is used.

### 61.1.1. References#

Useful references include [Whi63], [HS80], [Orf88], [AP91], and [Mut60].

```
using LaTeXStrings, Polynomials, Plots, Random
using LinearAlgebra, Statistics
```

## 61.2. A Control Problem#

Let \(L\) be the **lag operator**, so that, for sequence \(\{x_t\}\) we have \(L x_t = x_{t-1}\).

More generally, let \(L^k x_t = x_{t-k}\) with \(L^0 x_t = x_t\) and

where \(d_0, d_1, \ldots, d_m\) is a given scalar sequence.

Consider the discrete time control problem

where

\(h\) is a positive parameter and \(\beta \in (0,1)\) is a discount factor

\(\{a_t\}_{t \geq 0}\) is a sequence of exponential order less than \(\beta^{-1/2}\), by which we mean \(\lim_{t \rightarrow \infty} \beta^{\frac{t}{2}} a_t = 0\)

Maximization in (61.1) is subject to initial conditions for \(y_{-1}, y_{-2} \ldots, y_{-m}\).

Maximization is over infinite sequences \(\{y_t\}_{t \geq 0}\).

### 61.2.1. Example#

The formulation of the LQ problem given above is broad enough to encompass many useful models.

As a simple illustration, recall that in lqcontrol we consider a monopolist facing stochastic demand shocks and adjustment costs.

Let’s consider a deterministic version of this problem, where the monopolist maximizes the discounted sum

and

In this expression, \(q_t\) is output, \(c\) is average cost of production, and \(d_t\) is a demand shock.

The term \(\gamma (q_{t+1} - q_t)^2\) represents adjustment costs.

You will be able to confirm that the objective function can be rewritten as (61.1) when

\(a_t := \alpha_0 + d_t - c\)

\(h := 2 \alpha_1\)

\(d(L) := \sqrt{2 \gamma}(I - L)\)

Further examples of this problem for factor demand, economic growth, and government policy problems are given in ch. IX of [Sar87].

## 61.3. Finite Horizon Theory#

We first study a finite \(N\) version of the problem.

Later we will study an infinite horizon problem solution as a limiting version of a finite horizon problem.

(This will require being careful because the limits as \(N \to \infty\) of the necessary and sufficient conditions for maximizing finite \(N\) versions of (61.1) are not sufficient for maximizing (61.1))

We begin by

fixing \(N > m\),

differentiating the finite version of (61.1) with respect to \(y_0, y_1, \ldots, y_N\), and

setting these derivatives to zero

For \(t=0, \ldots, N-m\) these first-order necessary conditions are the
*Euler equations*.

For \(t = N-m + 1, \ldots, N\), the first-order conditions are a set of
*terminal conditions*.

Consider the term

Differentiating \(J\) with respect to \(y_t\) for \(t=0,\ 1,\ \ldots,\ N-m\) gives

We can write this more succinctly as

Differentiating \(J\) with respect to \(y_t\) for \(t = N-m + 1, \ldots, N\) gives

With these preliminaries under our belts, we are ready to differentiate (61.1).

Differentiating (61.1) with respect to \(y_t\) for \(t=0, \ldots, N-m\) gives the Euler equations

The system of equations (61.4) form a \(2 \times m\) order linear *difference
equation* that must hold for the values of \(t\) indicated.

Differentiating (61.1) with respect to \(y_t\) for \(t = N-m + 1, \ldots, N\) gives the terminal conditions

In the finite \(N\) problem, we want simultaneously to solve (61.4) subject to the \(m\) initial conditions \(y_{-1}, \ldots, y_{-m}\) and the \(m\) terminal conditions (61.5).

These conditions uniquely pin down the solution of the finite \(N\) problem.

That is, for the finite \(N\) problem, conditions (61.4) and (61.5) are necessary and sufficient for a maximum, by concavity of the objective function.

Next we describe how to obtain the solution using matrix methods.

### 61.3.1. Matrix Methods#

Let’s look at how linear algebra can be used to tackle and shed light on the finite horizon LQ control problem.

#### 61.3.1.1. A Single Lag Term#

Let’s begin with the special case in which \(m=1\).

We want to solve the system of \(N+1\) linear equations

where \(d(L) = d_0 + d_1 L\).

These equations are to be solved for \(y_0, y_1, \ldots, y_N\) as functions of \(a_0, a_1, \ldots, a_N\) and \(y_{-1}\).

Let

Then we can represent (61.6) as the matrix equation

or

Notice how we have chosen to arrange the \(y_t\)’s in reverse time order.

The matrix \(W\) on the left side of (61.7) is “almost” a Toeplitz matrix (where each descending diagonal is constant).

There are two sources of deviation from the form of a Toeplitz matrix.

The first element differs from the remaining diagonal elements, reflecting the terminal condition.

The subdiagonal elements equal \(\beta\) time the superdiagonal elements.

The solution of (61.8) can be expressed in the form

which represents each element \(y_t\) of \(\bar y\) as a function of the entire vector \(\bar a\).

That is, \(y_t\) is a function of past, present, and future values of \(a\)’s, as well as of the initial condition \(y_{-1}\).

#### 61.3.1.2. An Alternative Representation#

An alternative way to express the solution to (61.7) or
(61.8) is in so called **feedback-feedforward** form.

The idea here is to find a solution expressing \(y_t\) as a function of *past* \(y\)’s and *current* and *future* \(a\)’s.

To achieve this solution, one can use an LU decomposition of \(W\).

There always exists a decomposition of \(W\) of the form \(W= LU\) where

\(L\) is an \((N+1) \times (N+1)\) lower trangular matrix

\(U\) is an \((N+1) \times (N+1)\) upper trangular matrix.

The factorization can be normalized so that the diagonal elements of \(U\) are unity.

Using the LU representation in (61.9), we obtain

Since \(L^{-1}\) is lower trangular, this representation expresses \(y_t\) as a function of

lagged \(y\)’s (via the term \(U \bar y\)), and

current and future \(a\)’s (via the term \(L^{-1} \bar a\))

Because there are zeros everywhere in the matrix on the left of (61.7) except on the diagonal, superdiagonal, and subdiagonal, the \(LU\) decomposition takes

\(L\) to be zero except in the diagional and the leading subdiagonal

\(U\) to be zero except on the diagonal and the superdiagional

Thus, (61.10) has the form

where \(L^{-1}_{ij}\) is the \((i,j)\) element of \(L^{-1}\) and \(U_{ij}\) is the \((i,j)\) element of \(U\).

Note how the left side for a given \(t\) involves \(y_t\) and one lagged value \(y_{t-1}\) while the right side involves all future values of the forcing process \(a_t, a_{t+1}, \ldots, a_N\).

#### 61.3.1.3. Additional Lag Terms#

We briefly indicate how this approach extends to the problem with \(m > 1\).

Assume that \(\beta = 1\) and let \(D_{m+1}\) be the \((m+1) \times (m+1)\) symmetric matrix whose elements are determined from the following formula:

Let \(I_{m+1}\) be the \((m+1) \times (m+1)\) identity matrix.

Let \(\phi_j\) be the coefficients in the expansion \(\phi (L) = h + d (L^{-1}) d (L)\).

Then the first order conditions (61.4) and (61.5) can be expressed as:

where \(M\) is \((m+1)\times m\) and

As before, we can express this equation as \(W \bar y = \bar a\).

The matrix on the left of this equation is “almost” Toeplitz, the exception being the leading \(m \times m\) sub matrix in the upper left hand corner.

We can represent the solution in feedback-feedforward form by obtaining a decomposition \(LU = W\), and obtain

where \(L^{-1}_{t,s}\) is the element in the \((t,s)\) position of \(L\), and similarly for \(U\).

The left side of equation (61.11) is the “feedback” part of the optimal control law for \(y_t\), while the right-hand side is the “feedforward” part.

We note that there is a different control law for each \(t\).

Thus, in the finite horizon case, the optimal control law is time dependent.

It is natural to suspect that as \(N \rightarrow\infty\), (61.11) becomes equivalent to the solution of our infinite horizon problem, which below we shall show can be expressed as

so that as \(N \rightarrow \infty\) we expect that for each fixed \(t, U^{-1}_{t, t-j} \rightarrow c_j\) and \(L_{t,t+j}\) approaches the coefficient on \(L^{-j}\) in the expansion of \(c(\beta L^{-1})^{-1}\).

This suspicion is true under general conditions that we shall study later.

For now, we note that by creating the matrix \(W\) for large \(N\) and factoring it into the \(LU\) form, good approximations to \(c(L)\) and \(c(\beta L^{-1})^{-1}\) can be obtained.

## 61.4. The Infinite Horizon Limit#

For the infinite horizon problem, we propose to discover first-order necessary conditions by taking the limits of (61.4) and (61.5) as \(N \to \infty\).

This approach is valid, and the limits of (61.4) and (61.5) as \(N\) approaches infinity are first-order necessary conditions for a maximum.

However, for the infinite horizon problem with \(\beta < 1\), the limits of (61.4) and (61.5) are, in general, not sufficient for a maximum.

That is, the limits of (61.5) do not provide enough information uniquely to determine the solution of the Euler equation (61.4) that maximizes (61.1).

As we shall see below, a side condition on the path of \(y_t\) that together with (61.4) is sufficient for an optimum is

All paths that satisfy the Euler equations, except the one that we shall select below, violate this condition and, therefore, evidently lead to (much) lower values of (61.1) than does the optimal path selected by the solution procedure below.

Consider the *characteristic equation* associated with the Euler equation

Notice that if \(\tilde z\) is a root of equation (61.13), then so is \(\beta \tilde z^{-1}\).

Thus, the roots of (61.13) come in “\(\beta\)-reciprocal” pairs.

Assume that the roots of (61.13) are distinct.

Let the roots be, in descending order according to their moduli, \(z_1, z_2, \ldots, z_{2m}\).

From the reciprocal pairs property and the assumption of distinct roots, it follows that \(\vert z_j \vert > \sqrt \beta\ \hbox{ for } j\leq m \hbox { and } \vert z_j \vert < \sqrt\beta\ \hbox { for } j > m\).

It also follows that \(z_{2m-j} = \beta z^{-1}_{j+1}, j=0, 1, \ldots, m-1\).

Therefore, the characteristic polynomial on the left side of (61.13) can be expressed as

where \(z_0\) is a constant.

In (61.14), we substitute \((z-z_j) = -z_j (1- {1 \over z_j}z)\) and \((z-\beta z_j^{-1}) = z(1 - {\beta \over z_j} z^{-1})\) for \(j = 1, \ldots, m\) to get

Now define \(c(z) = \sum^m_{j=0} c_j \, z^j\) as

Notice that (61.14) can be written

It is useful to write (61.15) as

where

Since \(\vert z_j \vert > \sqrt \beta \hbox { for } j = 1, \ldots, m\) it follows that \(\vert \lambda_j \vert < 1/\sqrt \beta\) for \(j = 1, \ldots, m\).

Using (61.17), we can express the factorization (61.16) as

In sum, we have constructed a factorization (61.16) of the characteristic polynomial for the Euler equation in which the zeros of \(c(z)\) exceed \(\beta^{1/2}\) in modulus, and the zeros of \(c\,(\beta z^{-1})\) are less than \(\beta^{1/2}\) in modulus.

Using (61.16), we now write the Euler equation as

The unique solution of the Euler equation that satisfies condition (61.12) is

This can be established by using an argument paralleling that in chapter IX of [Sar87].

To exhibit the solution in a form paralleling that of [Sar87], we use (61.17) to write (61.18) as

Using partial fractions, we can write the characteristic polynomial on the right side of (61.19) as

Then (61.19) can be written

or

Equation (61.20) expresses the optimum sequence for \(y_t\) in terms of \(m\) lagged \(y\)’s, and \(m\) weighted infinite geometric sums of future \(a_t\)’s.

Furthermore, (61.20) is the unique solution of the Euler equation that satisfies the initial conditions and condition (61.12).

In effect, condition (61.12) compels us to solve the “unstable” roots of \(h+d (\beta z^{-1})d(z)\) forward (see [Sar87]).

The step of factoring the polynomial \(h+d (\beta z^{-1})\, d(z)\) into \(c\, (\beta z^{-1})c\,(z)\), where the zeros of \(c\,(z)\) all have modulus exceeding \(\sqrt\beta\), is central to solving the problem.

We note two features of the solution (61.20)

Since \(\vert \lambda_j \vert < 1/\sqrt \beta\) for all \(j\), it follows that \((\lambda_j \ \beta) < \sqrt \beta\).

The assumption that \(\{ a_t \}\) is of exponential order less than \(1 /\sqrt \beta\) is sufficient to guarantee that the geometric sums of future \(a_t\)’s on the right side of (61.20) converge.

We immediately see that those sums will converge under the weaker condition that \(\{ a_t\}\) is of exponential order less than \(\phi^{-1}\) where \(\phi = \max \, \{\beta \lambda_i, i=1,\ldots,m\}\).

Note that with \(a_t\) identically zero, (61.20) implies that in general \(\vert y_t \vert\) eventually grows exponentially at a rate given by \(\max_i \vert \lambda_i \vert\).

The condition \(\max_i \vert \lambda_i \vert <1 /\sqrt \beta\) guarantees that condition (61.12) is satisfied.

In fact, \(\max_i \vert \lambda_i \vert < 1 /\sqrt \beta\) is a necessary condition for (61.12) to hold.

Were (61.12) not satisfied, the objective function would diverge to \(- \infty\), implying that the \(y_t\) path could not be optimal.

For example, with \(a_t = 0\), for all \(t\), it is easy to describe a naive (nonoptimal) policy for \(\{y_t, t\geq 0\}\) that gives a finite value of (61.17).

We can simply let \(y_t = 0 \hbox { for } t\geq 0\).

This policy involves at most \(m\) nonzero values of \(hy^2_t\) and \([d(L)y_t]^2\), and so yields a finite value of (61.1).

Therefore it is easy to dominate a path that violates (61.12).

## 61.5. Undiscounted Problems#

It is worthwhile focusing on a special case of the LQ problems above: the undiscounted problem that emerges when \(\beta = 1\).

In this case, the Euler equation is

The factorization of the characteristic polynomial (61.16) becomes

where

The solution of the problem becomes

### 61.5.1. Transforming discounted to undiscounted problem#

Discounted problems can always be converted into undiscounted problems via a simple transformation.

Consider problem (61.1) with \(0 < \beta < 1\).

Define the transformed variables

Then notice that \(\beta^t\,[d\, (L) y_t ]^2=[\tilde d\,(L)\tilde y_t]^2\) with \(\tilde d \,(L)=\sum^m_{j=0} \tilde d_j\, L^j\) and \(\tilde d_j = \beta^{j/2} d_j\).

Then the original criterion function (61.1) is equivalent to

which is to be maximized over sequences \(\{\tilde y_t,\ t=0, \ldots\}\) subject to \(\tilde y_{-1}, \cdots, \tilde y_{-m}\) given and \(\{\tilde a_t,\ t=1, \ldots\}\) a known bounded sequence.

The Euler equation for this problem is \([h+\tilde d \,(L^{-1}) \, \tilde d\, (L) ]\, \tilde y_t = \tilde a_t\).

The solution is

or

where \(\tilde c \,(z^{-1}) \tilde c\,(z) = h + \tilde d\,(z^{-1}) \tilde d \,(z)\), and where

We leave it to the reader to show that (61.23) implies the equivalent form of the solution

where

The transformations (61.21) and the inverse formulas (61.24) allow us to solve a discounted problem by first solving a related undiscounted problem.

## 61.6. Implementation#

Code that computes solutions to the LQ problem using the methods described above can be found in file control_and_filter.jl.

Here’s how it looks

```
function LQFilter(d, h, y_m;
r = nothing,
beta = nothing,
h_eps = nothing)
m = length(d) - 1
m == length(y_m) || throw(ArgumentError("y_m and d must be of same length = $m"))
# define the coefficients of phi up front
phi = zeros(2m + 1)
for i in -m:m
phi[m-i+1] = sum(diag(d*d', -i))
end
phi[m+1] = phi[m+1] + h
# if r is given calculate the vector phi_r
if isnothing(r)
k = nothing
phi_r = nothing
else
k = size(r, 1) - 1
phi_r = zeros(2k + 1)
for i = -k:k
phi_r[k-i+1] = sum(diag(r*r', -i))
end
if h_eps != nothing
phi_r[k+1] = phi_r[k+1] + h_eps
end
end
# if beta is given, define the transformed variables
if isnothing(beta)
beta = 1.0
else
d = beta.^(collect(0:m)/2) * d
y_m = y_m * beta.^(- collect(1:m)/2)
end
return (;d, h, y_m, m, phi, beta, phi_r, k)
end
function construct_W_and_Wm(lqf, N)
(;d, m) = lqf
W = zeros(N + 1, N + 1)
W_m = zeros(N + 1, m)
# terminal conditions
D_m1 = zeros(m + 1, m + 1)
M = zeros(m + 1, m)
# (1) Constuct the D_{m+1} matrix using the formula
for j in 1:(m+1)
for k in j:(m+1)
D_m1[j, k] = dot(d[1:j, 1], d[k-j+1:k, 1])
end
end
# Make the matrix symmetric
D_m1 = D_m1 + D_m1' - Diagonal(diag(D_m1))
# (2) Construct the M matrix using the entries of D_m1
for j in 1:m
for i in (j + 1):(m + 1)
M[i, j] = D_m1[i-j, m+1]
end
end
M
# Euler equations for t = 0, 1, ..., N-(m+1)
(;phi, h) = lqf
W[1:(m + 1), 1:(m + 1)] = D_m1 + h * I
W[1:(m + 1), (m + 2):(2m + 1)] = M
for (i, row) in enumerate((m + 2):(N + 1 - m))
W[row, (i + 1):(2m + 1 + i)] = phi'
end
for i in 1:m
W[N - m + i + 1 , end-(2m + 1 - i)+1:end] = phi[1:end-i]
end
for i in 1:m
W_m[N - i + 2, 1:(m - i)+1] = phi[(m + 1 + i):end]
end
return W, W_m
end
function roots_of_characteristic(lqf)
(;m, phi) = lqf
# Calculate the roots of the 2m-polynomial
phi_poly=Polynomial(phi[end:-1:1])
proots = roots(phi_poly)
# sort the roots according to their length (in descending order)
roots_sorted = sort(proots, by=abs)[end:-1:1]
z_0 = sum(phi) / (fromroots(proots))(1.0)
z_1_to_m = roots_sorted[1:m] # we need only those outside the unit circle
lambda = 1 ./ z_1_to_m
return z_1_to_m, z_0, lambda
end
function coeffs_of_c(lqf)
(;m) = lqf
z_1_to_m, z_0, lambda = roots_of_characteristic(lqf)
c_0 = (z_0 * prod(z_1_to_m) * (-1.0)^m)^(0.5)
c_coeffs = coeffs(Polynomial(z_1_to_m)) * z_0 / c_0
return c_coeffs
end
function solution(lqf)
z_1_to_m, z_0, lambda = roots_of_characteristic(lqf)
c_0 = coeffs_of_c(lqf)[end]
A = zeros(m)
for j in 1:m
denom = 1 - lambda/lambda[j]
A[j] = c_0^(-2) / prod(denom[1:m .!= j])
end
return lambda, A
end
function construct_V(lqf; N=nothing)
(;phi_r, k) = lqf
V = zeros(N, N)
for i in 1:N
for j in 1:N
if abs(i-j) <= k
V[i, j] = phi_r[k + abs(i-j)+1]
end
end
end
return V
end
function simulate_a(lqf, N)
V = construct_V(lqf, N + 1)
d = MVNSampler(zeros(N + 1), V)
return rand(d)
end
function predict(lqf, a_hist, t)
N = length(a_hist) - 1
V = construct_V(lqf, N + 1)
aux_matrix = zeros(N + 1, N + 1)
aux_matrix[1:t+1 , 1:t+1 ] .= I + zeros(t+1, t+1)
L = chol(V)'
Ea_hist = inv(L) * aux_matrix * L * a_hist
return Ea_hist
end
function optimal_y(lqf, a_hist, t = nothing)
(;beta, y_m, m) = lqf
N = length(a_hist) - 1
W, W_m = construct_W_and_Wm(lqf, N)
F = lu(W)
L, U = F.L, F.U
D = Diagonal(1.0./diag(U))
U = D * U
L = L * Diagonal(1.0./diag(D))
J = reverse(I + zeros(N+1, N + 1), dims = 2)
if isnothing(t) # if the problem is deterministic
a_hist = J * a_hist
# transform the a sequence if beta is given
if beta != 1
a_hist = reshape(a_hist * (beta^(collect(N:0)/ 2)), N + 1, 1)
end
a_bar = a_hist - W_m * y_m # a_bar from the lecutre
Uy = \(L, a_bar) # U @ y_bar = L^{-1}a_bar from the lecture
y_bar = \(U, Uy) # y_bar = U^{-1}L^{-1}a_bar
# Reverse the order of y_bar with the matrix J
J = reverse(I + zeros(N+m+1, N + m + 1), dims = 2)
y_hist = J * vcat(y_bar, y_m) # y_hist : concatenated y_m and y_bar
# transform the optimal sequence back if beta is given
if beta != 1
y_hist = y_hist .* beta.^(- collect(-m:N)/2)
end
else # if the problem is stochastic and we look at it
Ea_hist = reshape(predict(lqf, a_hist, t), N + 1, 1)
Ea_hist = J * Ea_hist
a_bar = Ea_hist - W_m * y_m # a_bar from the lecutre
Uy = \(L, a_bar) # U @ y_bar = L^{-1}a_bar from the lecture
y_bar = \(U, Uy) # y_bar = U^{-1}L^{-1}a_bar
# Reverse the order of y_bar with the matrix J
J = reverse(I + zeros(N + m + 1, N + m + 1), dims = 2)
y_hist = J * vcat(y_bar, y_m) # y_hist : concatenated y_m and y_bar
end
return y_hist, L, U, y_bar
end
```

```
optimal_y (generic function with 2 methods)
```

### 61.6.1. Example#

In this application we’ll have one lag, with

Suppose for the moment that \(\gamma = 0\).

Then the intertemporal component of the LQ problem disappears, and the agent simply wants to maximize \(a_t y_t - hy^2_t / 2\) in each period.

This means that the agent chooses \(y_t = a_t / h\).

In the following we’ll set \(h = 1\), so that the agent just wants to track the \(\{a_t\}\) process.

However, as we increase \(\gamma\), the agent gives greater weight to a smooth time path.

Hence \(\{y_t\}\) evolves as a smoothed version of \(\{a_t\}\).

The \(\{a_t\}\) sequence we’ll choose as a stationary cyclic process plus some white noise.

Here’s some code that generates a plot when \(\gamma = 0.8\)

```
# set seed and generate a_t sequence
Random.seed!(123)
n = 100
a_seq = sin.(range(0, 5 * pi, length = n)) .+ 2 + 0.1 * randn(n)
function plot_simulation(; gamma = 0.8, m = 1, h = 1.0, y_m = 2.0)
d = gamma * [1, -1]
y_m = [y_m]
testlq = LQFilter(d, h, y_m)
y_hist, L, U, y = optimal_y(testlq, a_seq)
y = y[end:-1:1] # reverse y
# plot simulation results
time = 1:length(y)
plt = plot(time, a_seq / h, lw = 2, color = :black, alpha = 0.8,
marker = :circle,
markersize = 2, label = L"a_t")
plot!(plt, time, y, lw = 2, color = :blue, marker = :circle, markersize = 2,
alpha = 0.8,
label = L"y_t")
plot!(plt, xlabel = "Time", grid = true, xlim = (0, maximum(time)),
legend = :bottomleft)
end
plot_simulation()
```

Here’s what happens when we change \(\gamma\) to 5.0

```
plot_simulation(gamma = 5.0)
```

And here’s \(\gamma = 10\)

```
plot_simulation(gamma = 10.0)
```

## 61.7. Exercises#

### 61.7.1. Exercise 1#

Consider solving a discounted version \((\beta < 1)\) of problem (61.1), as follows.

Convert (61.1) to the undiscounted problem (61.22).

Let the solution of (61.22) in feedback form be

or

Here

\(h + \tilde d (z^{-1}) \tilde d (z) = \tilde c (z^{-1}) \tilde c (z)\)

\(\tilde c (z) = [(-1)^m \tilde z_0 \tilde z_1 \cdots \tilde z_m ]^{1/2} (1 - \tilde \lambda_1 z) \cdots (1 - \tilde \lambda_m z)\)

where the \(\tilde z_j\) are the zeros of \(h +\tilde d (z^{-1})\, \tilde d(z)\).

Prove that (61.25) implies that the solution for \(y_t\) in feedback form is

where \(f_j = \tilde f_j \beta^{-j/2}, A_j = \tilde A_j\), and \(\lambda_j = \tilde \lambda_j \beta^{-1/2}\).

### 61.7.2. Exercise 2#

Solve the optimal control problem, maximize

subject to \(y_{-1}\) given, and \(\{ a_t\}\) a known bounded sequence.

Express the solution in the “feedback form” (61.20), giving numerical values for the coefficients.

Make sure that the boundary conditions (61.5) are satisfied.

(Note: this problem differs from the problem in the text in one important way: instead of \(h > 0\) in (61.1), \(h = 0\). This has an important influence on the solution.)

### 61.7.3. Exercise 3#

Solve the infinite time optimal control problem to maximize

subject to \(y_{-1}\) given. Prove that the solution is

### 61.7.4. Exercise 4#

Solve the infinite time problem, to maximize

subject to \(y_{-1}\) given. Prove that the solution \(y_t = 2y_{t-1}\) violates condition (61.12), and so is not optimal.

Prove that the optimal solution is approximately \(y_t = .5 y_{t-1}\).