Author: Willem Hekman
Hey John, Chase,
I had a closer look at the section yesterday and want to say I really appreciate the effort that went into making it.
To offer something in return, in case you are interested, I’ve written out the derivation of the solution in mathjax/latex that can be copy/pasted into Jupyter.
Feel free to use it for the course, it would be an honor.
Here it is:
We have an optimization problem:
$$ v(x) = \max_{x,u} { y’Py  u’Qu } $$
s.t.
$$ y = Ax + Bu $$
with

$P > 0$, symmetric, an $n \times n$ matrix.

$Q > 0$, symmetric, an $m \times m$ matrix.

$B$ an $n \times m$ matrix.

$x$ an $n \times 1$ matrix.

$y$ an $m \times 1$ matrix.
The associated Lagrangian:
$$L = y’Py  u’Qu + \lambda’ \lbrack Ax + Bu  y \rbrack$$
1.
Differentiating w.r.t y  and setting this derivative equal to zero  yields
$$ \frac{ \partial L}{\partial y} =  2 \cdot y’P’  \lambda’ = 0 :.$$
Accordingly
$$ \lambda = 2 Py $$
Notice, for the above we make use of the fact that $P$ is symmetric.
2.
Differentiating w.r.t. u  and setting this derivative equal to zero  yields
$$ \frac{ \partial L}{\partial u} =  2 \cdot u’Q + \lambda’B = 0 :.$$
substituting $\lambda$ gives
$$ u’Q + y’PB = 0 :.$$
Taking the transpose (using $P’=P$, $Q’=Q$) gives
$$ B’Py + Qu = 0 :.$$
Substituting for $y$, $y = Ax + Bu$, gives
$$ B’P(Ax + Bu) + Qu = 0 :.$$
$$ B’PAx + (B’PB + Q)u = 0$$
so
$$ u = (B’PB + Q)^{1}B’PAx $$
To clean up these equations, let us define
$$R:=(B’PB + Q)^{1}:.$$
Notice that
$$R’ = ((B’PB + Q)^{1})’ = $$
$$((B’PB + Q)’)^{1} = (B’PB + Q)^{1} = R $$
That way
$$ u = RB’PAx $$
Then let us define
$$ S = RB’PA $$
such that
$$ u = Sx $$
is optimal.
3.
We have found the following “optimal coordinates”
$$ u(x) = Sx $$
and
$$ y(x) = Ax + Bu = Ax  BSx = (A  BS)x :.$$
To evaluate the function
$$v(x)=  y’Py  u’Qu$$
at these coordinates,
let us first write out
$$y’Py = $$
$$((A  BS)x)'P(A  BS)x = $$
$$ x’(A’  S’B’)P(A  BS)x = $$
$$ x’A’PAx $$
$$ x’A’PBSx$$
$$ x’S’B’PAx$$
$$ +x’S’B’PBSx $$
Notice that the 2nd and 3rd term are each others transpose.
Now let us write out
$$u’Qu = $$
$$ x’S’QSx = x’(RB’PA)'Q(RB’PA)x = $$
$$ x’A’PB(RQR)B’PAx $$
Now the cool part:
If we add $y’Py$ and $u’Qu$ we will see some terms cancel:
$$ y’Py + u’Qu = $$
$$ x’A’PAx $$
$$ x’A’PBSx $$
$$ x’S’B’PAx $$
$$ +x’S’(B’PB + Q)Sx :.$$
Notice, the last term contains parts of $y’Py$ and $u’Qu$.
Remember
$$ R := (B’PB + Q)^{1} $$
and $$ S : = RB’PA :.$$
On closer inspection the last term
$$ x’S’(B’PB + Q)Sx = $$
$$ x’S’R^{1}Sx =$$
$$ x’(A’PBR) : R^{1} : Sx = $$
$$ x’A’PBSx$$
cancels with the second term.
Thus the solution to the optimization problem is
$$ v(x) = y’Py + u’Qu = $$
$$ x’A’PAx  x’S’B’PAx = $$
$$ x’ (A’PA  A’PB(B’PB+Q)^{1}B’PA) x :=$$
$$ x’\tilde{P}x$$
That finishes the derivation. Btw, I read that you like Kyuss, must also be one of my favorites!
Now I`ll continue with the next chapter