Discrete Riccati equation in discrete $h-\infty$ controller design I want to design an discrete H infinty controller， I get this reference
consider a discrete system with the state space representation like this 
 $$ x_k+1 = Ax_K + B1w_k + B2u_k,X_0 = 0$$
$$ z_k = C1x_k + D12u_k$$
$$ y_k = C2x_k + D21w_k$$
and for simplicity ,the following assumptions are made: 
 $D12^TD12>0$, $C1^TD12 =0$，$B1D21^T =0$,$D21D21^T>0$ 
there is a Riccati equation ：$$ M =A^TMP^{-1}A +C1^TC1$$  , 
                         $$ P = I+(B2(D12^T D12)^{-1}*B2^T-\gamma^{-2}B1B1^T)M$$
where $A,B1,B2,C1,C2$ are appropriate matrix , 
there is a problem,  it does't like the normal discrete equation we can use dare to solve it,
$$A^TXA−X−A^TXB(B^TXB+R)^{−1}B^TXA+Q=0 $$
I don't know how to solve this kind of riccati equation , besides  how to choose the parameter $\gamma$,
I konw how to solve the reccati equation mentioned above.l afraid that my presentation is not clearly, so I attached the image of the Riccati equation, l hope this will help you understand more clearly,
enter image description hereenter image description hereenter image description here
I alredy have a discrete system:
 clc;clear;


 A = [0 0 -0.06;
    1  0  0.25;
    0  1    1];

B1 = [0; 0; 1]
B2 = [0; 0; 1];

C1 = [sqrt(2) 0 0;
      0    1   0;
      0    0   1;
      0    0  0];

D12 = [0 0 0 1];

C2 = [0 0 1],

D21 =0;

OB = rank(obsv(A,C2))

CO = rank(ctrb(A,B2))

so the riccati equation can be simplified with $D12^TD12 =I$:
$$M =A^TM(I+(B2B2^T-\gamma^{-2}B1B1^T)M)^{-1}A +C1^TC1$$
I am learning discrete H infinty control theory, and stuck with this question for a while,l already konw there are other approachs to deal with output feedback discrete H infinity controller design such that  bilinear transformation ,while acording to my homework requirement l have to use this method,   
I appreciate any guidance or suggestion , Thanks in advance!
 A: You can convert the stated matrix equation into the standard DARE form by using the Woodbury matrix identity, which states
$$
\left(A + U\,C\,V \right)^{-1} = A^{-1} - A^{-1} U \left(C^{-1} + V\,A^{-1} U \right)^{-1} V\,A^{-1}. \tag{1}
$$
Using $(1)$ together with $A = I$, $U = F(\gamma) = B_2 B_2^\top - \gamma^{-2} B_1 B_1^\top$, $C = I$ and $V = M$  yields the following
$$
\left(I + F(\gamma)\,M\right)^{-1} = I - F(\gamma)\,(I + M\,F(\gamma))^{-1} M. \tag{2}
$$
When assuming that $F(\gamma) \geq 0$ it should also be possible find a $L(\gamma)$ such that $F(\gamma) = L(\gamma)\,L(\gamma)^\top$. One way to find such $L(\gamma)$ would be for example by using the Cholesky decomposition. Substituting this in $F(\gamma)\,(I + M\,F(\gamma))^{-1}$ and partially applying the push-through identity yields
$$
F(\gamma)\,(I + M\,F(\gamma))^{-1} = L(\gamma)\,(I + L(\gamma)^\top M\,L(\gamma))^{-1} L(\gamma)^\top. \tag{3}
$$
Substituting this in $(2)$ and its resulting expression in the original matrix equation yields
$$
M = A^\top M\,A - A^\top M\,L(\gamma)\,(I + L(\gamma)^\top M\,L(\gamma))^{-1} L(\gamma)^\top M\,A + C_1^\top C_1, \tag{4}
$$
which can be solved for $M$ using a DARE solver using $R = I$ and $B = L(\gamma)$.
