\input{ccs_gyak_defs}
\author{Lecture 4}

\begin{document}

\selectlanguage{english}
\maketitle


\section{State space transformation}


As we shall already know, the state space model is not unique.
For the given example, define a new SSM using a state space transformation.
% Már említettük, hogy az ÁTM nem egyértelmű. Definiáljunk az alábbi példához egy másik ÁTM-et állapottranszformáció segítségével!
$$
A =\begin{pmatrix}
		-6 & -4 \\
		2 & 0
	\end{pmatrix}	\quad
B =	\begin{pmatrix}
		4 \\
		0
	\end{pmatrix}  \quad
C =
	\begin{pmatrix}
		0 & 1
	\end{pmatrix}
$$
Let the linear transformation of the state vector be the following:
% Legyen az állapotvektor lineáris transzformációja a következő:
	$$\begin{array}{c}
	\bar{x}_1=x_1+x_2 \\
	\bar{x}_2=3x_1-2x_2
	\end{array}$$
	In matrix form:
	$$
	\begin{pmatrix}
	\bar{x}_1 \\
	\bar{x}_2
	\end{pmatrix}
	=
	\begin{pmatrix}
	1 & 1 \\
	3 & -2
	\end{pmatrix} \cdot
	\begin{pmatrix}
	x_1 \\
	x_2
	\end{pmatrix}
	$$
	$\bar{x}=Tx, \ x=T^{-1}\bar{x} \quad \rightarrow \quad$
    state state space equation can be written for the new state vector $\bar{x}$ as well
	$$\dot{x}=Ax+Bu \quad \rightarrow \quad T^{-1}\dot{\bar{x}}=AT^{-1}\bar{x}+Bu$$
	$$\dot{\bar{x}}=TAT^{-1}\bar{x}+TBu \quad \rightarrow \quad \bar{A}=TAT^{-1} \quad \bar{B}=TB$$
	$$y=Cx=CT^{-1}\bar{x} \quad \rightarrow \quad \bar{C}=CT^{-1}$$
    Returning to the example:
	$$T=
	\begin{pmatrix}
	1 & 1 \\
	3 & -2
	\end{pmatrix}
	\quad
	T^{-1}=
	-\frac{1}{5}
	\begin{pmatrix}
	-2 & -1 \\
	-3 & 1
	\end{pmatrix}
	$$
	$$
	\bar{A}=TAT^{-1}=
	\begin{pmatrix}
	-4 & 0 \\
	-16 & -2
	\end{pmatrix}
	\quad
	\bar{B}=TB=
	\begin{pmatrix}
	4 \\
	12
	\end{pmatrix}
	\quad
	\bar{C}=CT^{-1}=
	\begin{pmatrix}
	\frac{3}{5} & -\frac{1}{5}
	\end{pmatrix}
	$$

% Állapottranszformáció mátrixának meghatározása
% \begin{cfel}[Determining the state space transformation's matrix]
    If the original and the transformed SSM are ($A,B,C$) and ($\bar{A},\bar{B},\bar{C}$), respectively,
    determine the transformation matrix $T$, which connects them.

    \begin{align}
        & \label{eq:sstrafo_original}
        A = \pmqty{ 3 & 2 \\ -4 & 1 } \quad
        B = \pmqty{ 1 \\ 1 } \quad
        C = \pmqty{ 1 & 0 }
        \\ & \label{eq:sstrafo_new}
        \bar{A} = \pmqty{ 1.8 & 1.6 \\ -4.4 & 2.2 } \quad
        \bar{B} = \pmqty{ 3 \\ 1 } \quad
        \bar{C} = \pmqty{ 0.4 & -0.2 }
    \end{align}
    \emph{Solution.}
    $
        \bar{B}= TB, \ \bar{A}\bar{B}=TAB ~~\rightarrow~~
        T \cdot [B | AB] = [\bar{B} | \bar{A}\bar{B}] ~~\rightarrow~~
        \TODO{$T = \bar {\mathcal C}_2 \cdot \mathcal C_2^{-1}$}
    $,
    where $\mathcal C_2 = [B | AB]$ and $\bar {\mathcal C}_2 = [\bar B | \bar A \bar B]$ are the controllability matrices of
    \eqref{eq:sstrafo_original} and \eqref{eq:sstrafo_new}, respectively. \\
    \emph{Remark.} $B$ and $AB$ are $(2 \times 1)$ matrices.

    $$\mathcal C_2 = \begin{pmatrix} 1 & 5 \\ 1 & -3 \end{pmatrix}, \quad
    \mathcal C_2^{-1} = \frac{1}{-8}\begin{pmatrix} -3 & -5 \\ -1 & 1 \end{pmatrix}, \quad
    \bar{\mathcal C}_2 = \begin{pmatrix} 3 & 7 \\ 1 & -11 \end{pmatrix}$$

    $$T= \frac{1}{-8} \cdot \begin{pmatrix} 3 & 7 \\ 1 & -11 \end{pmatrix} \cdot \begin{pmatrix} -3 & -5 \\ -1 & 1  \end{pmatrix} = \begin{pmatrix} 2 & 1 \\ -1 & 2 \end{pmatrix} \qquad
    T^{-1} = \frac{-1}{5} \begin{pmatrix} 2  & -1 \\ 1 &  2     \end{pmatrix} $$
% \end{cfel}

% \begin{cfel}
    Just as in the previous example, determine the transformation matrix $T$.
    \begin{align}
        &A = \pmqty{ 2 & 0 \\ -1 & 2 } \quad
        B = \pmqty{ 1 \\ 0 } \quad
        C = \pmqty{ 1 & 0 }
        \\
        &\bar{A} = \pmqty{ 3 & -1 \\ 1 & 1 } \quad
        \bar{B} = \pmqty{ -1 \\ 1 } \quad
        \bar{C} = \pmqty{ \frac{-1}{2} & \frac{1}{2} }
    \end{align}
    \emph{Solution.} $T= \begin{pmatrix} -1 & 2 \\ 1 & 2 \end{pmatrix} \quad  T^{-1} = \frac{-1}{4} \cdot \begin{pmatrix} 2 & -2 \\ -1 & -1 \end{pmatrix}$
% \end{cfel}
\bigbreak

\noindent\emph{Remark.} In case of SISO model,
this method can be applied for an even higher dimensional state-space model, but then the controllability matrix will involve further rows.
If the state vector is $n$-dimensional $\qty(A \in \mathbb{R}^{n \times n})$, than
$\mathcal C_n = [B|AB|A^2B| \ldots | A^{n-1}B]$.
To conclude, if the SSM is controllable:
\begin{equation}
    \TODOx{$T = \bar {\mathcal C}_n \cdot \mathcal C_n^{-1}$}
\end{equation}
\smallbreak

\noindent\emph{Megjegyzés:} SISO modell esetén a fenti módszer több állapotváltozó esetén is alkalmazható, de ekkor több oszlopra van szükség.
Ha $A \in \mathbb{R}^{n \times n}$, akkor a $[B|AB|A^2B| \ldots | A^{n-1}B]$ alakú mátrixokkal lehet számolni.

\section{Controllability, observability}
\textbf{In general} Given the following CT-LTI system:
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{fig/gyak3_system.png}
\label{fig:sys}
\end{figure}
The question arouse: In the full knowledge of $y(t)$ and $u(t)$ can we say something about the unknown state vector $x(t)$?
In the other words is $x(t)$ \textbf{observable}?

The second question would be the following: is there an input function $u(t)$, with which we can lead the system from the initial state $x_0$ to state $x_1$ in a finite time. If we can do so (for every possible initial and final states), we say that the system is \textbf{controllable}.

\subsection{Observability}
\begin{cthmw}[Sufficient and necessary condition for observability]{}\label{}
    A state space model described by matrices $(A,B,C)$ is observable if and only if (iff) its observability matrix $\mathcal O_n$ is full-rank:
    % Az $(A,B,C)$ mátrixok által leírt rendszer pontosan akkor megfigyelhető, ha az $\mathcal{O}_n$ megfigyelhetőségi mátrix teljes oszloprangú.
    $$
    \mathcal{O}_n=
    \spmqty{ C \\ CA \\ \vdots \\ CA^{n-1} } ~,~~~~
    \rank \qty(\mathcal O_n) = n
    $$
    \noindent \emph{Remark.} In SISO case $\mathcal{O}_n$ is a square matrix, which is full-rank iff its determinant is nonzero.
\end{cthmw}
\begin{cexamplew}*{}[breakable=false]\label{}
    Is the system $(A,B,C)$ observable?
    $$A=
    \begin{pmatrix}
    2 & 3 \\
    2 & 1
    \end{pmatrix}
    \quad
    B=
    \begin{pmatrix}
    1 \\
    1
    \end{pmatrix}
    \quad
    C=
    \begin{pmatrix}
    0 & 1
    \end{pmatrix}
    $$
    The observability matrix is the following
    $$CA=
    \begin{pmatrix}
    2 & 1
    \end{pmatrix}
    \rightarrow
    \mathcal{O}_2=
    \begin{pmatrix}
    C \\
    CA
    \end{pmatrix}
    =
    \begin{pmatrix}
    0 & 1 \\
    2 & 1
    \end{pmatrix}
    ~,~~~
    \det\qty(\mathcal O_2) = -2 \ne 0
    \Rightarrow \mathcal O_2 \text{ is full-rank}
    $$
    Hence, $x(t)$ is observable, namely, using $y(t)$ and its time derivetive $\dot y(t)$,
    we can compute the actual value of $x(t)$
    \begin{equation}
        \left\{\begin{aligned}
            &y(t) = Cx(t) \\
            &\dot y(t) = C A x(t) + C B u(t)
        \end{aligned}\right.
        \Rightarrow
        \begin{aligned}
            x(t) = \mathcal O_2^{-1} \pmqty{ y(t) \\ \dot y(t) - C B u(t) }
        \end{aligned}
    \end{equation}
\end{cexamplew}

\begin{cexamplew}{Unobservable subspace (mathematical background presented in \ref{sec:unobs})}\label{}
    Given the state space model:
    \begin{equation} \label{eq:unobs}
        \begin{aligned}
            A = \pmqty{ 1 & 2 \\ -2 & -3 } ,~~~
            B: \text{arbitrary} ,~~~
            C = \pmqty{ 1 & 1 } ,~~~
            \mathcal O_n = \pmqty{ 1 & 1 \\ -1 & -1 }
        \end{aligned}
    \end{equation}
    A basis for the kernel of $\mathcal O_n$ is $v_1 = \spmqty{-1 \\ 1}$.
    This means that
    \begin{enumerate}[{$\rightarrow$}]
        \item
        if there is a zero input and $x(0) = \lambda v_1 \in \mathcal O_2$,
        than $x(t) \in \Ker\qty(\mathcal O_2)$ (Proposition \ref{prop:unobs}) and $y(t) = 0$ for every $t > 0$.

        \item
        for a given input $u(t)$ and with an initial condition $x(0) = x_0 + \lambda v_1 \in x_0 + \Ker\pqty{\mathcal O_2}$ (where $\lambda \in \mathbb{R}$ is arbitrary)
        the system will produce \emph{the same ouput $y(t)$}.
    \end{enumerate}
    \begin{center}
        \includegraphics[width=\textwidth]{fig/unobs_demo/fig.pdf}
        \small
        Figure \refstepcounter{figure}\arabic{figure}.
        Simulation of system \eqref{eq:unobs} from different initial conditions $x(0) \in x_0 + \Ker\qty(\mathcal O_2)$
        (denoted by dots) with zero input.
        As one can observe, the state trajectories are different, however this difference does not appear in the output of the system.
        In this example $u \equiv 0$ and $x_0 = \spmqty{1\\1}$.
        The blue dashed line in the right figure illustrates the actual unobservability subspace of the system corresponding to $x_0$.
        \label{fig:unbs}
    \end{center}
\end{cexamplew}

%\begin{figure}[h]
%\centering
%\includegraphics[scale=0.5]{fig/gyak4_obs_deg.png}
%\label{fig:obs_deg}
%\end{figure}

\pagebreak
\subsection{Controllability}
Given a strictly proper state space model $(A,B,C)$ with $x(t_0)$ initial and $x(t_1) \neq x(t_0)$ final condition.
The question arises, is there any input function $u(t)$, which leads the system from $x(t_0)$ to $x(t_1)$ in a finite time.
\begin{cthmw}*[Controllability]{}[breakable=false]\label{}
    A state space model described by matrices $(A,B,C)$ is controllable iff its controllability matrix $\mathcal C_n$ is full-rank:
    $$
    \mathcal{C}_n=
    \pmqty{ B & A B & \cdots & A^{n-1} B } ~,~~~~
    \rank \qty(\mathcal C_n) = n
    $$
    \noindent \emph{Remark.} In SISO case $\mathcal{C}_n$ is a square matrix, which is full-rank iff its determinant is nonzero.
\end{cthmw}

\begin{cexamplew}*{}\label{}
	$$A=
	\begin{pmatrix}
	2 & 3 \\
	2 & 1
	\end{pmatrix}
	,\quad
	B=
	\begin{pmatrix}
	1 \\
	1
	\end{pmatrix}
	,\quad
	C=
	\begin{pmatrix}
	0 & 1
	\end{pmatrix}
    ,\qquad
	\mathcal{C}_2=
	\begin{pmatrix}
	B & AB
	\end{pmatrix}
	=
	\begin{pmatrix}
	1 & 5 \\
	1 & 3
	\end{pmatrix}
	$$
	This system is controllable, since the determinant of $\mathcal{C}_2$ is nonzero.
    In this case the controllability subspace is the whole $\mathbb{R}^{2}$ itself.
    If we start the system from zero initial condition, we can lead the system (with an appropriate input)
    to any other states of the controllability subspace in a finite time.
	% Ha nulla kezdetiértékből indítom a rendszert, véges idő alatt nem fogom tudni kijuttatni az irányíthatósági altérből.
\end{cexamplew}

\begin{cexamplew}[]{Controllable subspace (mathematical background presented in \ref{sec:controllable_subspace})}\label{}
    Given the following state space system and its rank-deficient controllability matrix:
    \begin{equation}
        A = \spmqty{ -1 & 2 & -2 \\ - \frac{2}{3} & -6 & \frac{20}{3} \\ - \frac{1}{2} & -1 & -1 } ~,~~~~
        B = \spmqty{ 0 \\ 8 \\ 0 } ~,~~~~
        \text{ eigenvalues of $A$: } \spmqty{ -2 \\ -2 \\ -4 } ~,~~~~
        \mathcal C_3 = \spmqty{ 0 & 16 & -96 \\ 8 & -48 & 224 \\ 0 & -8 & 48 }
    \end{equation}
    The basis vectors of $\Im(\mathcal C_3)$ are:
    $
    v_1 = \spmqty{ 0.3832 \\ -0.9036 \\ -0.1916 }, ~
    v_2 = \spmqty{ 0.8082 \\ 0.4285 \\ -0.4041 }.
    $
    They span a 2-dimensional subspace in $\mathbb{R}^{3}$, illustrated by the green plane in the Figure \ref{fig:contrl}.
    If we start the system from an initial condition which is an element of this subspace $x(0) \in \Im(\mathcal C_3)$,
    the system trajectory will never leave this subspace.
    If the initial condition is outside of $\Im(\mathcal C_3)$ and $A$ is stable, the system trajectory will tend to this subspace.
    \begin{center}
        \includegraphics[width=0.8\textwidth]{fig/contrl_demo/fig.pdf}

        \small
        Figure \refstepcounter{figure}\arabic{figure}.
        Simulation of system \eqref{eq:unobs} from different initial conditions
        \label{fig:contrl}
    \end{center}
\end{cexamplew}


\subsection{Controllability and observability in case of a diagonal SSM}
    $$A=
    \begin{pmatrix}
    a_1 & 0 \\
    0 & a_2
    \end{pmatrix}
    \quad
    B=
    \begin{pmatrix}
    b_1 \\
    b_2
    \end{pmatrix}
    \quad
    AB=
    \begin{pmatrix}
    a_1 b_1 \\
    a_2 b_2
    \end{pmatrix}
    \quad
    C=
    \begin{pmatrix}
    c_1 & c_2
    \end{pmatrix}
    \quad
    CA=
    \begin{pmatrix}
    c_1a_1 & c_2a_2
    \end{pmatrix}
    $$
    $$
    \mathcal{C}_2=
    \begin{pmatrix}
    b_1 & a_1 b_1 \\
    b_2 & a_2 b_2
    \end{pmatrix} \qquad
    \mathcal{O}_2=
    \begin{pmatrix}
    c_1 & c_2 \\
    c_1a_1 & c_2 a_2
    \end{pmatrix}
    $$


\noindent SISO rendszer diagonális $A$ mátrix esetén \\
irányítható $\quad \Longleftrightarrow \quad $  a főátlóbeli elemek páronként különbözőek, és $\forall i \ b_i \neq 0$  \\
megfigyelhető $\quad \Longleftrightarrow \quad $  a főátlóbeli elemek páronként különbözőek, és $\forall j \ c_j \neq 0$ \\


\begin{cthmw}*{}\label{}
    The rank of $\mathcal O_n$ and $\mathcal C_n$ is invariant to the state space transformations.
\end{cthmw}
\begin{proof}
    $$\bar{A}=TAT^{-1} \quad \bar{B}=TB \quad \bar{C}=CT^{-1}$$
    $$
    \bar{\mathcal{C}}_n=
    \begin{pmatrix}
    TB & TAT^{-1} TB
    \end{pmatrix}=T
    \begin{pmatrix}
    B & AB
    \end{pmatrix}=
    T\mathcal{C}_n
    $$
    $$\bar{\mathcal{O}}_n=
    \begin{pmatrix}
    CT^{-1} \\ CT^{-1}TAT^{-1} \end{pmatrix}=
    \begin{pmatrix}
    C \\ CA
    \end{pmatrix} T^{-1}=
    \mathcal{O}_n T^{-1}    $$
\end{proof}


\subsection{Markov parameters}
	$$CA^iB$$
    Markov parameters are invariant to the state space transformations.
	$$\bar{CB}=CT^{-1}TB=CB$$
	$$\bar{C}\bar{A}\bar{B}=CT^{-1}TAT^{-1}TB=CAB$$


\section[Joint ctrb-obsv]{Joint controllability and observability}

\begin{itemize}
\item Egy $H(s)=\frac{b(s)}{a(s)}$ (SISO) átviteli függvény $n$-edrendű realizációjának nevezzük az $(A,B,C,D)$ állapottér-modellt, ha $H(s)=C(sI-A)^{-1}B+D$,
ahol $A\in\mathbb{R}^{n\times n}$, $B\in\mathbb{R}^{n\times 1}$, $C\in\mathbb{R}^{1\times n}$, $D\in\mathbb{R}$
(nem egyértelmű!)
\item Egy $H(s)$ átviteli függvény $n$-edrendű realizációját minimálisnak nevezzük, ha nem létezik nála kisebb rendű realizáció.
\item Egy $n$-dimenziós $(A,B,C,D)$ állapottér-modellt együttesen irányíthatónak és megfigyelhetnek nevezünk, ha teljesülnek rá az irányíthatóság és a megfigyelhetőség feltételei (azaz $\mathcal{O}_n$ és $\mathcal{C}_n$ teljes rangú).
\item Egy ÁTM minimális $\iff$ egyszerre irányítható és megfigyelhető.
\end{itemize}


\begin{cexamplew}*{}\label{}
    Is the state space representation minimal?
        $$A=
        \begin{pmatrix}
        2 & 3 \\
        2 & 1
        \end{pmatrix}
        \quad
        B=
        \begin{pmatrix}
        1 \\
        1
        \end{pmatrix}
        \quad
        C=
        \begin{pmatrix}
        0 & 1
        \end{pmatrix}
        $$
        Transfer function: $H(s)=\frac{s}{s^2-3s-4}$.
        This SSM is minimal, since $H(s)$ is irreducible and the degree of the denominator is equal to the order of the state space realization ($n = 2$).
\end{cexamplew}


\begin{cexamplew}*{}\label{}
    Is the state space representation minimal?
    	$$A=
    	\begin{pmatrix}
    	-2 & -1 \\
    	-1 & -2
    	\end{pmatrix}
    	\quad
    	B=
    	\begin{pmatrix}
    	1 \\
    	0
    	\end{pmatrix}
    	\quad
    	C=
    	\begin{pmatrix}
    	1 & 1
    	\end{pmatrix}
    	$$
    	$$H(s)=C(sI-A)^{-1}B=\frac{s+1}{s^2+4s+3}=\frac{s+1}{(s+1)(s+3)}$$
        This SSM is not minimal, meaning the one of two properties is broken:
        the SSM is controllable but its is no observable.
\end{cexamplew}

\begin{cexamplew}*{}\label{}
    Is the state space representation minimal?
    	$$A=
    	\begin{pmatrix}
    	-6 & -4 \\
    	2 & 0
    	\end{pmatrix}
    	\quad
    	B=
    	\begin{pmatrix}
    	4 \\
    	0
    	\end{pmatrix}
    	\quad
    	C=
    	\begin{pmatrix}
    	0 & 1
    	\end{pmatrix}
    	$$
    Controllability matrix:
    $$\mathcal{C}_2=
    \begin{pmatrix}
    B & AB
    \end{pmatrix}
    =
    \begin{pmatrix}
    4 & -24 \\
    0 & 8
    \end{pmatrix}$$
    The determinant of matrix $\mathcal C_2$ is nonzero, therefore, it is controllable.
    \\
    Observability matrix:
    $$\mathcal{O}_2=
    \begin{pmatrix}
    C \\ CA
    \end{pmatrix}
    =
    \begin{pmatrix}
    0 & 1 \\
    2 & 0
    \end{pmatrix}$$
    The determinant of matrix $\mathcal O_2$ is nonzero, therefore, it is observable.
    Consequently, the SSM is minimal.
\end{cexamplew}

\begin{cexamplew}*{MIMO case}\label{}
    Is the state space representation minimal?
	$$A=
	\begin{pmatrix}
	1 & 4 \\
	-2 & 2
	\end{pmatrix}
	\quad
	B=
	\begin{pmatrix}
	1 & 4 & 1 \\
	2 & 3 & 0
	\end{pmatrix}
	\quad
	C=
	\begin{pmatrix}
	1 & 2 \\
	0 & 7
	\end{pmatrix}
	$$
	$$AB=
	\begin{pmatrix}
	9 & 16 & 1 \\
	2 & -2 & -2
	\end{pmatrix}
	\quad
	CA=\begin{pmatrix}
	-3 & 8 \\
	-14 & 14
	\end{pmatrix}$$
	$$
	\mathcal{O}_2=\begin{pmatrix}
	C \\
	CA
	\end{pmatrix}
	=\begin{pmatrix}
	1 & 2 \\
	0 & 7 \\
	-3 & 8 \\
	-14 & 14
	\end{pmatrix}
	\quad
	\mathcal{C}_2=
	\begin{pmatrix}
	B & AB
	\end{pmatrix}
	=
	\begin{pmatrix}
	1 & 4 & 1 & 9 & 16 & 1 \\
	2 & 3 & 0 & 2 & -2 & -2
	\end{pmatrix}
	$$
	Matrix $\mathcal{O}_2$ is full-column-rank, and $\mathcal{C}_2$ is full row rank, meaning that the system is jointly controllable and observable and $(A,B,C)$ is minimal.
\end{cexamplew}

%\subsection{Controller form}
%	$$H(s)=
%	\frac
%	{\color{blue}b_1 \color{black}{s}^{n-1}+\color{blue}b_2 \color{black}{s}^{n-2}+ \cdots + \color{blue}b_n}
%	{ \color{red}1 \color{black} s^n + \color{red}a_1\color{black} {s}^{n-1}+ \cdots + \color{red}a_n} = %\frac{b(s)}{a(s)}
%	$$
%	A nevezőben szereplő polinom vezéregyütthatója mindig 1 kell, hogy legyen!
%	$$
%	\dot{x}=
%	\begin{pmatrix}
%	\color{red}-a_1 & \color{red}-a_2 & \cdots & \color{red}-a_{n-1}& \color{red}-a_n \\
%	1 & 0 & \cdots & 0 & 0 \\
%	\vdots & \ddots & \cdots & \vdots & \vdots \\
%	0 & 0 & \cdots & 1 & 0
%	\end{pmatrix}x
%	+
%	\begin{pmatrix}
%	1 \\
%	0 \\
%	\vdots \\
%	0
%	\end{pmatrix}u$$
%	$$
%	y=
%	\begin{pmatrix}
%	\color{blue}b_1 & \color{blue}b_2 & \cdots & \color{blue}b_n
%	\end{pmatrix}
%	x
%	$$

\begin{cexamplew}*{}\label{}
    Is the SSM minimal?
    If not give a minimal representation.
	$$A=
	\begin{pmatrix}
	-3 & 0 & 0 \\
	0 & 4 & 0 \\
	0 & 0 & 6
	\end{pmatrix}
	\quad
	B=
	\begin{pmatrix}
	1 \\
	2 \\
	6
	\end{pmatrix}
	\quad
	C=
	\begin{pmatrix}
	3 & 0 & 4
	\end{pmatrix}
	$$
	\begin{eqnarray}
	H(s)&=&\sum_{i=1}^{n} \frac{c_i b_i}{s-\lambda_i}=\frac{3 \cdot 1}{s+3} + \frac{0 \cdot 2}{s-4} + \frac{6 \cdot 4}{s-6}=\frac{3(s-6)+24(s+3)}{(s+3)(s-6)} \nonumber\\
	H(s)&=&\frac{27s+54}{s^2-3s-18}	 \nonumber
	\end{eqnarray}
    The SSM is not minimal, because the transfer function can be reduced.
	$$ A^2 =\begin{pmatrix}
	9 & 0 & 0 \\
	0 & 16 & 0 \\
	0 & 0 & 36
	\end{pmatrix} \qquad
	\mathcal{O}_n = \begin{pmatrix}
	3 & 0 & 4\\
	-9 & 0 & 24 \\
	27 & 0 & 144
	\end{pmatrix} \qquad
	\mathcal{C}_n = \begin{pmatrix}
	1 & -3 & 9\\
	2 & 8 & 32 \\
	6 & 36 & 216
	\end{pmatrix}$$
    A minimal SSM can be given by skipping the single degenerated state variable:
	$$A=
	\begin{pmatrix}
	-3 & 0 \\
	 0 & 6
	\end{pmatrix}
	\quad
	B=
	\begin{pmatrix}
	1 \\
	6
	\end{pmatrix}
	\quad
	C=
	\begin{pmatrix}
	3 & 4
	\end{pmatrix}
	$$
    A minimal realization can also be given using the controller form:
	$$A=
	\begin{pmatrix}
	3 & 18 \\
	1 & 0
	\end{pmatrix}
	\quad
	B=
	\begin{pmatrix}
	1 \\
	0
	\end{pmatrix}
	\quad
	C=
	\begin{pmatrix}
	27 & 54
	\end{pmatrix}
	$$
\end{cexamplew}

\begin{cexamplew}*{}\label{}
    It is given a SSM in the controller form.
    Is the SSM jointly controllable and observable?
	$$
	A=
	\begin{pmatrix}
	0 & 7 & -6 \\
	1 & 0 & 0 \\
	0 & 1 & 0
	\end{pmatrix}
	\quad
	B=
	\begin{pmatrix}
	1 \\
	0 \\
	0
	\end{pmatrix}
	\quad
	C=
	\begin{pmatrix}
	0 & 3 & 9
	\end{pmatrix}
	$$
	Transfer function:
	$$H(s)=\frac{3s+9}{s^3-7s+6}$$
	% Since $(s=-3)$ is a root of both the denominator and numerator,
    % so $H(s)$ is reducible.
    The realization is most be controllable, since it is given in controller form:
	$$A^2 =\begin{pmatrix}
	7 & -6 & 0 \\
	0 & 7 & -6 \\
	1 & 0 & 0
	\end{pmatrix} \qquad
	\mathcal{O}_n =\begin{pmatrix}
	0 & 3 & 9 \\
	3 & 9 & 0 \\
	9 & 21 & -18
	\end{pmatrix} \qquad
	\mathcal{C}_n =\begin{pmatrix}
	1 & 0 & 7 \\
	0 & 1 & 0 \\
	0 & 0 & 1
	\end{pmatrix}
    ~~~~~
    \begin{aligned}
        &\rank(\mathcal{C}_n) = 3 \\
        &\rank(\mathcal O_n) = 2
    \end{aligned}
    $$
    However the SSM is not observable, because it is not minimal:
    $H(s)$ is reducible by $s+3$.
    % $$(-3)^3 -7(-3)+6=-27+21+6=0$$
    Using the controller form (on the irreducible form of $H(s)$),
    we can obtain a jointly controllable and observable realization
    Tehát nem együttesen megfigyelhető és irányítható a rendszer.
    The a unobservable subspace
    $$\Ker(\mathcal{O}_n) = \qty{\alpha \spmqty{ 9 \\ -3 \\1 } \ \middle| \ \alpha \in \mathbb{R}}$$
\end{cexamplew}


\noindent\textbf{Felhasználás:} Állapotmegfigyelők tervezése \\
Bizonyos mennyiségeket (pl. szögsebesség) nem tudunk mérni, csak becsülni. Ld.: \ref{obs}. ábra

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{fig/gyak5_obs.png}
\caption{State observer design}
\label{obs}
\end{figure}

\bibliographystyle{unsrt}
\bibliography{References}


\newpage

\appendix
\section[Supplementary material in linear algebra]{Supplementary material in linear algebra (not needed for the exam)}
% \begin{multicols}{2}

% \begin{lemma}
% If $(A,B,C)$ is not controllable $\rank(\mathcal C_n) = k < n$, there exists a state space transformation
% $T_{ij} = \delta_{\sigma(i)j}$,
% such that the first $k$ rows of $\bar{\mathcal C}_n$ of the transformed model are linearly independent.
% \end{lemma}

\begin{cthmw}[The fundamental theorem of linear algebra]{}\label{thm:FTLA}
    Let $\mathcal A : \mathbb{R}^{n} \to \mathbb{R}^{m}$, $\mathcal A(x) = A x$, where $A \in \mathbb{R}^{{m}\times{n}}$.
    Then the followings are true
    \begin{subequations} \label{eq:FTLA}
        \begin{align}
            &\rm{Im}\qty(A) = \rm{Ker}\qty(A^T)^\perp \subset \mathbb{R}^{m}
            \label{eq:FTLA_1}
            \\
            &\rm{Im}\qty(A^T) = \rm{Ker}\qty(A)^\perp \subset \mathbb{R}^{n}
            \label{eq:FTLA_2}
        \end{align}
    \end{subequations}
    Furthermore
    \begin{subequations} \label{eq:FTLA_otimes}
        \begin{align}
            &\rm{Im}\qty(A) \otimes \rm{Ker}\qty(A^T) = \mathbb{R}^{m}
            \label{eq:FTLA_otimes_1}
            \\
            &\rm{Im}\qty(A^T) \otimes \rm{Ker}\qty(A) = \mathbb{R}^{n}
            \label{eq:FTLA_otimes_2}
        \end{align}
    \end{subequations}
    \emph{Remark. } If $r = \rank(A)$, than
    \begin{subequations} \label{eq:FTLA_dims}
        \begin{align}
            &\dim \rm{Im}\qty(A) = r, && \dim \rm{Ker}\qty(A^T) = m - r
            \label{eq:FTLA_dims_1}
            \\
            &\dim \rm{Im}\qty(A^T) = r, && \dim \rm{Ker}\qty(A) = n - r
            \label{eq:FTLA_dims_2}
        \end{align}
    \end{subequations}
\end{cthmw}
\begin{proof} Proof of \eqref{eq:FTLA_1} as presented in \cite{FTLA}.
    Let
    \begin{subequations}
        \begin{align}
            &A = \pmqty{\vec a_1 & \vec a_2 & ... & \vec a_n} ~\implies~ A^T = \spmqty{\vec a^T_1 \\ \vec a^T_2 \\ ... \\ \vec a^T_n} \label{FTLA_proof_1} \\
            &\vec x \in \rm{Ker}\qty(A^T) ~\implies~ A^T \vec x = \spmqty{\vec a^T_1 \vec x \\ \vec a^T_2 \vec x \\ ... \\ \vec a^T_n \vec x} = \spmqty{0 \\ 0 \\ \cdots \\ 0} \label{FTLA_proof_2} \\
            &\vec y \in \rm{Im}\qty(A) ~\implies~ \exists \alpha_i \in \mathbb{R} \text{ such that } \vec y = \sum_{i = 1}^{n} \alpha_i \vec a_i \label{FTLA_proof_3}
        \end{align}
    \end{subequations}
    Note that $\vec x$ and $\vec y$ are arbitrary vector elements of $\rm{Ker}\qty(A^T)$ and $\rm{Im}\qty(A)$, respectively.
    Then we compute the dot product of $\vec x$ and $\vec y$:
    \begin{align}
        \begin{aligned}
            \dotprod{\vec x, \vec y} = \vec y^T \vec x = \sum_{i=1}^{n} \alpha_i \vec a_i^T \vec x = 0,
        \end{aligned}
    \end{align}
    since $\vec a_i^T \vec x = 0, ~\forall i = \overline{1,n}$. Consequently, $\vec x \perp \vec y$ for all possible
    $x \in \rm{Ker}\qty(A^T)$ and $y \in \rm{Im}\qty(A)$, which means that the two subspaces are the \Emph{orthogonal complement} for each other:
    \begin{align}
        \begin{aligned}
            &\rm{Im}\qty(A) = \rm{Ker}\qty(A^T)^\perp \\
            &\rm{Im}\qty(A) \cap \rm{Ker}\qty(A^T) = \qty{0}
        \end{aligned}
    \end{align}
    Following this idea, we can conclude that the subspaces are linearly independent,
    therefore,
    \begin{align} \label{eq:directprod}
        \begin{aligned}
            \dim\qty\Big( \rm{Im}\qty(A) \otimes \rm{Ker}\qty(A^T) ) = r + (m - r) = m.
        \end{aligned}
    \end{align}
    This can only happend if \Emph{direct product} of the two spaces is $\mathbb{R}^{m}$,
    which completes the proof for \eqref{eq:FTLA_otimes_1}.
\end{proof}

\bigbreak
\begin{prop}{Self-adjoint operator}\label{}
    Let $\mathcal A : \mathbb{R}^{n} \to \mathbb{R}^{n}$, $\mathcal A(x) = A x$, where $A \in \mathbb{R}^{{n}\times{n}}$ is a symmetric matrix: $A = A^T$.
    Than, as a consequence of Theorem \ref{thm:FTLA}, we have that
    \begin{align*}
        \begin{aligned}
            \rm{Im}\qty(A) = \rm{Ker}\qty(A)^\perp
            ~\text{and}~
            \rm{Im}\qty(A) \otimes \rm{Ker}\qty(A) = \mathbb{R}^{n}.
        \end{aligned}
    \end{align*}
    For more, see \cite[Eq. (10.3)]{Lantos1}.
\end{prop}

\medskip
\begin{cpropw}[Singular value decomposition (SVD)]{}[breakable=false]\label{prop:SVD}%
    If we make the SVD for matrix $A \in \mathbb{R}^{{m}\times{n}}$
    \begin{align}
        \begin{aligned}
            A = U \Sigma V^T,
        \end{aligned}
    \end{align}
    where
    \begin{subequations} \label{eq:SVD}
        \begin{align}
            &U \in \mathbb{R}^{{m}\times{m}} \text{ is unitary: } U^* U = I_m
            \label{eq:SVD_1}
            \\
            &V \in \mathbb{R}^{{n}\times{n}} \text{ is unitary: } V^* V = I_n
            \label{eq:SVD_2}
            \\
            &\Sigma \in \mathbb{R}^{{m}\times{n}} \text{ eigenvalues in the diagonal.}
            \label{eq:SVD_3}
        \end{align}
    \end{subequations}
    After this decomposition, the basis of the four subspaces \eqref{eq:FTLA_otimes} can be obtained as presented below.
    \begin{align*}
        \begin{aligned}
            &\rm{Im}\qty(A): && \text{ the first $r$ colums of $U$} \\
            &\rm{Ker}\qty(A^T): && \text{ the last $m-r$ columns of $U$} \\
            &\rm{Im}\qty(A^T): && \text{ the first $r$ columns of $V$} \\
            &\rm{Ker}\qty(A): && \text{ the last $n-r$ columns of $V$} \\
        \end{aligned}
    \end{align*}
    In short
    \begin{equation}
        \raisebox{-10pt}{\scalebox{1.5}{$``$}}~
            A = \bmqty{\rm{Im}\qty(A) & \rm{Ker}\qty(A^T)} \Sigma \bmqty{\rm{Im}\qty(A^T) & \rm{Ker}\qty(A)}^T
        ~\raisebox{0pt}{\scalebox{1.5}{$"$}}
    \end{equation}

\end{cpropw}

\section{Subspaces of the state space}
Having a strictly proper ($D = 0$) MIMO LTI system:
\begin{align}
    \begin{aligned}
        &\dot x = A x + B y \\
        &y = C x
    \end{aligned}
\end{align}
The state space could be partitioned as follows:
\begin{align}
    \begin{aligned}
        X = X_{co} \otimes X_{c \bar o} \otimes X_{\bar c o} \otimes X_{\bar c \bar o}
    \end{aligned}
\end{align}
where $X_{\cdot \cdot}$ are pairwise orthogonal subspaces of the state space, in other words:
\begin{align}
    \begin{aligned}
        &X_{co} \perp X_{c \bar o}, ~~~
        X_{co} \perp X_{\bar c o}, ~~~
        X_{co} \perp X_{\bar c \bar o}, \\
        &X_{c \bar o} \perp X_{\bar c o}, ~~~
        X_{c \bar o} \perp X_{\bar c \bar o}, ~~~
        X_{\bar c o} \perp X_{\bar c \bar o}.
    \end{aligned}
\end{align}
\bigbreak

\subsection[Unobservable subspace]{Unobservable subspace $X_{\overline o} = \rm{Ker}\qty(\mathcal O_n)$. Observable subspace $X_o = X_{\overline o}^\perp = \rm{Im}\qty(\mathcal O_n^T)$.} \label{sec:unobs}
\color{red}
TODO: Ezt ki kell javítani, lásd 4. gyakorlat jegyzete. Az, hogy $A^i B \in \rm{Im}\qty(\mathcal C_n)$ bármely $i \ge n$ a Cayley-Hamilton tételből következik.
Ugyanúgy mint azt is, hogy $\qty(A^T)^i C^T \in \rm{Im}\qty(\mathcal O_n^T)$.
\color{black}
\begin{clemmaw}[Linear independence of the first $k$ rows of $\mathcal O_n$]{}\label{prop:CAk}
    If $\rank\qty(\mathcal O_n) = k \le n$, then
    the first $k$ rows of $\mathcal O_n$ are linearly independent, and any further rows of it can be expressed as the linear combination of the first $k$ rows.

    \medbreak
    Formally:
    $\forall i \in \mathbb{N} ~ \exists \alpha \in \mathbb{R}^{k}$, that $C A^{k+i} = \alpha^T \mathcal O_k$,
    where $\mathcal O_k \in \mathbb{R}^{{k}\times{n}}$ is defined as
    $\mathcal O_k = \smash{\spmqty{C \\ C A \\ ... \\ C A^{k-1}}}$.

    \medbreak
    \emph{Remark. } $\mathbb{N} = \qty{0,1,2,..}$, $\mathbb{N}_+ := \mathbb{N}\backslash \qty{0}$.
\end{clemmaw}
% \begin{proof}
\noindent\emph{Proof. } The proof is given in the following three steps:
    \begin{enumerate}[(i)]
        \item
        If $k = n$, the set of row vectors (also called as ``covariant vectors'') $C, CA, .., CA^{n-1}$ constitutes a linearly independent
        (covariant) basis for vector space $\mathbb{R}^{n}$,
        which means that any other row vectors in $\mathbb{R}^{n}$ can be expressed by their linear combinations, the same as
        $CA^{n+i}, \forall i \in \mathbb{N}$ can be.

        \item \label{en:CAk_ii}
        Let $k$ be the first natural number, for which there exists
        $\alpha \in \mathbb{R}^{k}$ such that $C A^k = \alpha^T \mathcal O_k$.
        Then $C A^{k+1}$ can also be expressed by the covariant vectors of $\mathcal O_k$:
        \begin{equation}
            \begin{aligned}
                C A^{k+1} = \qty(C A^k) A = \pqty{\sum_{j = 1}^k \alpha_j C A^{j-1}} A
                % = \sum_{j = 1}^k \alpha_j C A^j
                % = \sum_{j = 1}^{k-1} \alpha_j C A^j + \alpha_k \qty(C A^k)
                = \sum_{j = 1}^{k-1} \alpha_j C A^j + \alpha_k \sum_{j = 1}^k \alpha_j C A^{j-1}
            \end{aligned}
        \end{equation}
        By induction, we have that for every every $i \in \mathbb{N}$ there exists
        $\alpha \in \mathbb{R}^{k}: C A^{k+i} = \alpha \mathcal O_k$.

        \item
        As a consequence of \eqref{en:CAk_ii}, we can state that if $\rank\qty(\mathcal O_n) = k < n$,
        that the first $k$ rows of $\mathcal O_n$ are linearly independent (i.e. $\rank\qty(\mathcal O_k) = k$).
        \hfill $\square$
    \end{enumerate}
% \end{proof}
\bigbreak

\begin{clemmaw}*{}[breakable=false]\label{}
    For every $v \in \rm{Im}\qty(\mathcal O_n^T)$, we have that $A^T v \in \rm{Im}\qty(\mathcal O_n^T)$. In this sense, the observable subspace $X_o = \rm{Im}\qty(\mathcal O_n^T)  = \rm{Ker}\qty(\mathcal O_n)^\perp \subseteq \mathbb{R}^{n}$ of the state space $X = \mathbb{R}^{n}$ is invariant with respect to the linear transformation $\mathcal A'(v) = A^T v$, i.e. $\mathcal A'(X_o) = X_o$.
\end{clemmaw}
\begin{proof}
    Given as homework (see Lemma \ref{lemma11}).
\end{proof}
\bigskip


\begin{cpropw}[$x(0) \in \Ker\qty(\mathcal O_n)$ and $u(t) = 0 ~\implies~ y(t) = 0$]{}\label{prop:unobs}
    Let $\rank\qty(\mathcal O_n) = k < n$.
    If $x_0 \in \Ker\qty(\mathcal O_n)$ and $u \equiv 0$, than $y(t) = 0$ for every $t > 0$,
    i.e
    $$x(t) = e^{At} x_0 \in \Ker\qty(\mathcal O_n)$$
    In other words, if there is no input signal ($u(t) = 0$) and the initial condition $x_0$ belongs to the unobservable subspace $\Ker\qty(\mathcal O_n)$, than the state response of the system $x(t) = e^{At} x_0$ will remain in this subspace.
\end{cpropw}
\begin{proof}
    As a consequence of Proposition \ref{prop:CAk},
    we have that if $CA^k x_0 = 0$ for $k = \overline{0,n\!-\!1}$,
    than $CA^k x_0 = 0$ holds for every $k \in \mathbb{N}$.
    If we consider the Taylor expansion of matrix exponent $e^{At}$, we have:
    \begin{equation}
        \begin{aligned}
            C A^k e^{At} x_0 = \sum_{j=0}^\infty \frac{t^k}{k!} \cdot \underbrace{C A^{k+j} x_0}_{0} = 0 ~~ \forall k = \overline{0,n\!-\!1}
            ~~\Rightarrow~~ \mathcal O_n e^{At} x_0 = 0 \Leftrightarrow e^{At} x_0 \in \Ker\qty(\mathcal O_n)
        \end{aligned}
    \end{equation}
    Consequently, for a given unobservable state space model (A,B,C,D) if we start the system from the unobservable subspace
    $x(0) \in \Ker\qty(\mathcal O_n)$ and having a zero input ($u\equiv 0$) the output will be zero $y(t) = 0$, for every $t > 0$.
\end{proof}
\bigskip

\begin{cpropw}[Same output for all initial state of an unobservable class]{}[breakable=false]\label{}
Let us denote $v_1,..,v_{n-k} \in \mathbb{R}^{n}$, $k < n$ the basis vectors of the null space of $\mathcal O_n$:
\begin{equation*}
    \Ker\qty(\mathcal O_n) = \qty{ \alpha_1 v_1 + .. + \alpha_{n-k} v_{n-k} = \alpha^T N ~\middle|~ \alpha \in \mathbb{R}^{n-k}},
    ~~ \text{ where } N := \pmqty{v_1 & .. & v_{n-k}} \in \mathbb{R}^{{n}\times{(n-k)}}
\end{equation*}
Matrix $N$ is called an \emph{annihilator} of $\mathcal O_n$, since $\mathcal O_n N = 0_{n\times(n-k)}$.
Now we introduce the following notations:
\begin{equation}
    x_0 + \Ker\qty(\mathcal O_n) :=  \qty{ x_0 + \alpha^T N ~\middle|~ \alpha \in \mathbb{R}^{n-k}}
\end{equation}
\emph{From any initial condition $x(0) \in x_0 + \Ker\qty(\mathcal O_n)$ and for a given input $u(t)$,
the system will produce the same output $y(t)$.
}
\end{cpropw}
\begin{proof}
    The explicit solution of the state space model is
    \begin{equation}
        y(t) = C e^{A t} x(0) + C \int_0^t e^{A(t-\tau)} B u(\tau) \diffd \tau
    \end{equation}
    Considering an initial condition $x(0) = x_0 + \alpha^T N \in x_0 + \Ker\qty(\mathcal O_n)$
    with an arbitrary $\alpha \in \mathbb{R}^{n-k}$,
    and keeping in mind, that $\alpha^T N \in \Ker\pqty{\mathcal O_n}$ (i.e. $C A^i \alpha^T N = 0$ for all $i \in \mathbb{N}$) we obtain:
    \begin{equation}
        y(t) = C e^{A t} \qty(x_0 + \alpha^T N) + C \int_0^t e^{A(t-\tau)} B u(\tau) \diffd \tau =
        C e^{A t} x_0 + C \int_0^t e^{A(t-\tau)} B u(\tau) \diffd \tau
    \end{equation}
    Finally, we can observe that the expression for $y(t)$ does not depend on $\alpha$.
    It depends only on the input $u(t)$ and on $x_0$,
    furthermore, for each $x_0$ we obtain different outputs,
    $x_0$ defines the unobservability class, that the system is actually in.
    If we can find a particular solution $x(t)$ for the (under-determined) linear equation system
    \begin{equation}
        {\mathcal{Y}}(t)={\cal O}_{n}x(t)+{\mathcal{T}}{\mathcal{U}}(t)
        ~~~~~~
        [{\tt lec\_03.pdf} \text{, pg. 10/31}]
    \end{equation}
    we can determine the actual unobservability class of the system,
    but we have no further informations about the state vector itself.
\end{proof}
\smallbreak\noindent\emph{Remark.}
Set $x_0 + \Ker\qty(\mathcal O_n)$ is not a subspace of $\mathbb{R}^{n}$,
since many properties of the vector space broke (eg. does not have a unity element),
however, it is a $k$ dimensional manifold (sokaság) in vector space $\mathbb{R}^{n}$.

\subsection[Controllable subspace]{Controllable subspace $X_{c} = \rm{Im}\qty(\mathcal C_n)$. Uncontrollable subspace $X_{\overline c} = X_c^\perp = \rm{Ker}\qty(\mathcal C_n^T)$.} \label{sec:controllable_subspace}
\begin{clemmaw}*{}\label{prop:Cn_k}
    If $(A,B,C)$ is not controllable $\rank(\mathcal C_n) = k < n$, the first $k$ columns of $\mathcal C_n$ are linearly independent.
\end{clemmaw}
\begin{proof}
    Same as Lemma \ref{prop:CAk}.
\end{proof}
\bigbreak

\begin{clemmaw}*{}[breakable=false]\label{lemma11}
    For every $v \in \rm{Im}\qty(\mathcal C_n)$, vector $A v \in \rm{Im}\qty(\mathcal C_n)$. In this sense, the controllable subspace $X_c = \rm{Im}\qty(\mathcal C_n) \subseteq \mathbb{R}^{n}$ of the state space $X = \mathbb{R}^{n}$ is invariant with respect to the linear transformation $\mathcal A(v) = A v$, i.e. $\mathcal A(X_c) = X_c$.
\end{clemmaw}
\begin{proof}
    Let $v \in X_c = \rm{span}\left<B, A B, ..., A^{n-1} B\right>$, therefore, there exist real values $\alpha_1,...,\alpha_n \in \mathbb{R}$, such that
    \begin{align}
        \begin{aligned}
            v = \sum_{i = 1}^n \alpha_i A^{i-1} B ~\implies~ A v = \sum_{i = 1}^n \alpha_i A^i B.
        \end{aligned}
    \end{align}
    It is obvious that $A^i B \in X_c$ for all $i=\overline{1,n-1}$, furthermore, due to Lemma \ref{prop:Cn_k}, $A^n B$ can be expressed as the linear combination of vectors $A^{i-1},B$, $i=\overline{1,n}$. Finally, we have that $A v \in X_c$.
\end{proof}
\bigbreak

\begin{cpropw}[$x_0 \in \Im\qty(\mathcal C_n) \implies x(t) \in \Im\qty(\mathcal C_n)$]{}\label{prop:ctrb1}
    If the initial condition $x(0) = x_0$ belongs to the controllable subspace of the state space, than the solution $x(t)$ will also belong to it.
    Formally:
    \begin{align}
        \begin{aligned}
            x_0 \in \rm{Im}\qty(\mathcal C_n) \implies x(t) \in \rm{Im}\qty(\mathcal C_n)\, \forall t \ge 0.
        \end{aligned}
    \end{align}
    If the initial condition is not an element of $\rm{Im}\qty(\mathcal C_n)$, but the system is stable, than the trajectory will tend exponentially to the controllable subspace of the state space, i.e.
    \begin{align}
        \begin{aligned}
            A \prec 0 \implies x(t) \to \rm{Im}\qty(\mathcal C_n)
        \end{aligned}
    \end{align}
\end{cpropw}
\begin{proof} If $x_0 \in \rm{Im}\qty(\mathcal C_n) = X_c$, than
    \begin{align}
        \begin{aligned}
            x(t) = e^{A t} x_0 + \int_0^t e^{A (t - \tau)} B u(\tau) \diffd \tau
            = \sum_{k = 0}^\infty \frac{t^k}{k!} \underbrace{A^k x_0}_{\in \, X_c}
            + \int_0^t \sum_{k = 0}^\infty \frac{(t-\tau)^k}{k!} \underbrace{A^k B}_{\in \, X_c} u(\tau) \diffd \tau
            \in X_c.
        \end{aligned}
    \end{align}
    If $x_0 \not\in X_c$ but $A \prec 0$ (is negative definite), than
    \begin{align}
        \begin{aligned}
            x(t) = \underbrace{e^{A t} x_0}_{\to \, 0} + \underbrace{\int_0^t e^{A (t - \tau)} B u(\tau) \diffd \tau}_{\in\, X_c}
            \to X_c.
        \end{aligned}
    \end{align}
    So, the solution tends to the controllable subspace.
\end{proof}
\bigskip

\begin{cthmw}*{Control the system to a given state}\label{}
    If the system is controllable, there exists an input
    \begin{equation}
        u(t) = -B^T e^{A^T(t_1 - t)} P^{-1}(t_1) \qty( e^{A t_1} x_0 - x_1 ),
        \text{ where }
        P(t) = \int_0^t e^{A \tau} B B^T e^{A^T \tau} \diffd \tau, ~~ t \in [0,t_1],
    \end{equation}
    which leads the system from $x(0)$ to $x(t_1) = x_1$ in a finite time $t_1 < \infty$.
\end{cthmw}
\begin{proof}
    A proof for it can be found in \cite[Theorem 2.21]{citeulike:1246499}.
\end{proof}

\subsection{Controllability staircase form}

\begin{comment}
\bigbreak
\color{red}
\begin{cpropw}[!!!HIBÁS!!!!]{}[breakable=false]\label{}
    \color{red}
    Let $\rank(\mathcal C_n) = k < n$. We construct a matrix $S = \pqty{B,..,A^{k-1}B,N}$,
    where
    $N = \pqty{w_{k+1},..,w_n}$ contains the basis vectors of $\rm{Im}\qty(\mathcal C_n)^\perp = \rm{Ker}\qty(\mathcal C_n^T)$.
    \color{black}
    Then, we can state the followings:
    \begin{enumerate}
        \item the last $n-k$ columns of $\mathcal C_n S$ are zeros
        \item the last $n-k$ rows of $S^{-1} \mathcal C_n$ are zeros (trivial)
    \end{enumerate}
\end{cpropw}

\begin{proof}
    \begin{align}
        \begin{aligned}
            &\mathcal C_n := \pmqty{C_{11} & C_{12} \\ C_{21} & C_{22}} \Rightarrow
            S = \pmqty{C_{11} & N_{1} \\ C_{21} & N_{2}} \\
            &S^{-1} := \pmqty{C'_{11} & C'_{21} \\ N'_{1} & N'_{2}}
        \end{aligned}
    \end{align}
    $\mathcal C_n$ is column-rank deficient, therefore, there exists a nonempty covariant
    null space of it, represented by covariant \emph{annihilator}
    $N = \spmqty{N_1 \\ N_2} \in \mathbb{R}^{{n}\times{(n-k)}}$,
    $\mathcal C_n N = 0_{n\times (n-k)}$, which contains in its columns the basis of
    $\Ker(\mathcal C_n)$.
    Since $\mathcal C_n$ is a square matrix (SISO case) there exists a contravariant
    null space represented by contravariant annihilator $N' = \pmqty{N'_1 & N'_2} \in \mathbb{R}^{{(n-k)}\times{n}}$,
    $N' \mathcal C_n = 0_{(n-k)\times n}$
    \begin{align}
        \begin{aligned}
            S^{-1} S
            &= \pmqty{C'_{11} & C'_{21} \\ N'_{1} & N'_{2}} \cdot \pmqty{C_{11} & N_{1} \\ C_{21} & N_{2}} \\
            &= \pmqty{
                C'_{11} C_{11} + C'_{21} C_{21} & C'_{11} N_1 + C'_{21} N_2 \\
                {\color{red} N'_1 C_{11} + N'_2 C_{21}} & N_1' N_1 + N'_2 N_2
            }
        \end{aligned}
    \end{align}
    Consequently:
    \begin{equation}
        N'_1 C_{11} + N'_2 C_{21} =
        \pmqty{N'_{1} & N'_{2}} \cdot \pmqty{ C_{11} \\ C_{21}} = 0_{(n-k)\times k}
    \end{equation}
    Considering the fact that
    $\spmqty{ C_{11} \\ C_{21}} \in \mathbb{R}^{{n}\times{k}}$ and
    $N' := \pmqty{N'_1 & N'_2} \in \mathbb{R}^{{(n-k)}\times{n}}$ are both full full-rank matrices,
    this implies that
    \begin{equation}
        N'_1 C_{12} + N'_2 C_{22} =
        \pmqty{N'_{1} & N'_{2}} \cdot \pmqty{ C_{12} \\ C_{22}} = 0_{(n-k)\times(n-k)}
    \end{equation}
    Finally, we can conclude that
    $N'$ is indeed a contravariant annihilator
    of $\mathcal C_n$.
\end{proof}
\color{black}
\end{comment}

\begin{cpropw}[Controllability staircase form]{}[breakable=false]\label{}
    We construct the following transformation matrix $T^{-1} = S = \pmqty{v_1, ... , v_k , w_{k+1} , ... , w_{n}}$,
    where $[v] = [v_1, ..., v_k]$ is the orthonormal (ON) basis of $X_c = \rm{Im}\qty(\mathcal C_n)$ and $[w] = [w_{k+1},...,w_n]$ is the ON basis of $X_{\overline c} = \rm{Im}\qty(\mathcal C_n)^\perp = \rm{Ker}\qty(\mathcal C_n^T)$.
    Then the transformed matrices will have the form: \\
    \begin{subequations}
        \label{eq:staircase}
        \begin{minipage}{0.49\textwidth}
            \begin{align}
                \label{eq:staircase_A}
                &\bar A = T A T^{-1} = \pmqty{\bar A_{11} & \bar A_{12} \\ 0_{(n-k)\times k} & \bar A_{22}}
            \end{align}
        \end{minipage}
        \begin{minipage}{0.50\textwidth}
            \begin{align}
                \label{eq:staircase_B}
                &\bar B = T B = \pmqty{\bar B_1 \\ 0_{(n-k)\times1}}
            \end{align}
        \end{minipage}
    \end{subequations}
    \begin{center}\TODO{Using SVD: $\mathcal C_n = U_c \Sigma_c V_c^T$, $S := U_c$}\end{center}
\end{cpropw}
\begin{proof} (For simplicity, only for SISO)
    Since $X_c$ and $X_{\overline c}$ are orthogonal complement of each other $\qty(\text{i.e. } X_c \otimes X_{\overline c} = \mathbb{R}^{n})$, $[v,w]$ is an ON basis of $\mathbb{R}^{n}$. In other words: $S$ is an orthogonal matrix with the well-known properties:
    \begin{align}
        \begin{aligned}
            S^T S = I_n ~~~ \implies ~~~ S^{-1} = S^T = \pmqty{V^T \\ W^T}, ~~~ \text{where } V = \pmqty{v_1 , ... , v_k} \text{ and } W = \pmqty{w_{k+1} , ... , w_n}
        \end{aligned}
    \end{align}
    Furthermore, $V^T W = 0_{k \times (n-k)}$ and $W^T V = 0_{(n-k) \times k}$ \refstepcounter{equation} (\theequation). Then the transformed matrix $\bar A$ will be:
    \begin{align}
        \begin{aligned}
            \bar A = T A T^{-1} = S^T A S = \pmqty{V^T \\ W^T} A \pmqty{V & W} = \pmqty{V^T A V & V^T A W \\ W^T A V & W^T A W}.
        \end{aligned}
    \end{align}
    The columns of $V$ are elements of $X_c$, therefore, the columns of $A V$ are also elements of $X_c$. The columns of $W$ are the basis vectors of $X_{\overline c} = X_c^\perp$, therefore, $W^T A V = 0_{(n-k) \times k}$.
    The transformed matrix $\bar B$ will be:
    \begin{align}
        \begin{aligned}
            \bar B = T B = S^T B = \pmqty{V^T \\ W^T } B = \pmqty{V^T B \\ W^T B}.
        \end{aligned}
    \end{align}
    Since $B \in X_c$, $w_j \in X_c^\perp$, $W^T B = 0_{(n-k) \times 1}$, $j = \overline{k+1,n}$.
\end{proof}
\bigbreak

% \begin{cpropw}[Controllability staircase form]{}\label{}
%     If $\rank(\mathcal C_n) = k < n$ than
%     \begin{equation}
%         T^{-1} = S := \pqty{v_1, .. , v_k , w_{k+1},.., w_n},
%     \end{equation}
%     where $v_i$ are the basis vectors of the image space of $\mathcal C_n$,
%     and $w_j$ are the basis vectors of the null space of $\mathcal C_n$.
%     Using this state transformation, we obtain the controllability staircase form
%     \eqref{eq:staircase}.
% \end{cpropw}
% \begin{proof}
%     We have already proven by choosing $v_i = A^{i-1} B$.
% \end{proof}
% \bigbreak

\subsection{Observability staircase form}
\begin{cpropw}[Observability staircase form]{}[breakable=false]\label{}
    We construct the following transformation matrix $T^{-1} = S = \pmqty{v_1, ... , v_k , w_{k+1} , ... , w_{n}}$,
    where $[v] = [v_1, ..., v_k]$ is the orthonormal (ON) basis of $X_o = \rm{Ker}\qty(\mathcal O_n)^\perp = \rm{Im}\qty(\mathcal O_n^T)$ and $[w] = [w_{k+1},...,w_n]$ is the ON basis of $X_{\overline o} = \rm{Ker}\qty(\mathcal O_n)$.
    Then the transformed matrices will have the form: \\
    \begin{subequations}
        \label{eq:staircase}
        \begin{minipage}{0.49\textwidth}
            \begin{align}
                \label{eq:staircase_A}
                &\bar A = T A T^{-1} = \pmqty{\bar A_{11} & 0_{k \times (n-k)} \\ \bar A_{21} & \bar A_{22}}
            \end{align}
        \end{minipage}
        \begin{minipage}{0.50\textwidth}
            \begin{align}
                \label{eq:staircase_B}
                &\bar C = C T^{-1} = \pmqty{\bar C_1 & 0_{1\times(n-k)}}
            \end{align}
        \end{minipage}
    \end{subequations}
    \begin{center}\TODO{Using SVD: $\mathcal O_n = U_o \Sigma_o V_o^T$, $S := V_o$}\end{center}
\end{cpropw}
\begin{proof} (For simplicity, only for SISO)
    Since $X_o$ and $X_{\overline o}$ are orthogonal complement of each other $\qty(\text{i.e. } X_o \otimes X_{\overline o} = \mathbb{R}^{n})$, $[v,w]$ is an ON basis of $\mathbb{R}^{n}$. In other words: $S$ is an orthogonal matrix with the well-known properties:
    \begin{align}
        \begin{aligned}
            S^T S = I_n ~~~ \implies ~~~ S^{-1} = S^T = \pmqty{V^T \\ W^T}, ~~~ \text{where } V = \pmqty{v_1 , ... , v_k} \text{ and } W = \pmqty{w_{k+1} , ... , w_n}
        \end{aligned}
    \end{align}
    Furthermore, $V^T W = 0_{k \times (n-k)}$ and $W^T V = 0_{(n-k) \times k}$ \refstepcounter{equation} (\theequation).
    The transformed matrix $\bar A$ will be:
    \begin{align}
        \begin{aligned}
            \bar A = T A T^{-1} = S^T A S = \pmqty{V^T \\ W^T} A \pmqty{V & W} = \pmqty{V^T A V & V^T A W \\ W^T A V & W^T A W}.
        \end{aligned}
    \end{align}
    The columns of $V$ are elements of $X_o$, therefore, the columns of $A^T V$ are also elements of $X_o$. The columns of $W$ are the basis vectors of $X_{\overline c} = X_c^\perp$, therefore, $(A^T V)^T W = V^T A W = 0_{k \times (n-k)}$.
    The transformed matrix $\bar C$ will be:
    \begin{align}
        \begin{aligned}
            \bar C = C T^{-1} = C S = C \pmqty{V & W } = \pmqty{C V & C W}.
        \end{aligned}
    \end{align}
    Since $C^T \in X_o$, $w_j \in X_o^\perp$, $C W^T = 0_{1 \times (n-k)}$, $j = \overline{k+1,n}$.
\end{proof}

\begin{cpropw}*{}\label{pr:unobservable_mode}
    If $(A,C)$ has unobservable mode (i.e. is unobservable), there exists $x \in \mathbb{R}^{n}$, such that $A x = \lambda x$ and $C x = 0$.
    Consequently, $\lambda$ is a ``decoupling zero'' of $(A,B,C,D)$, since
    \begin{align}
        \begin{aligned}
            M = \pmqty{ A - \lambda I & B \\ C & 0 } \text{ is singular, }
        \end{aligned}
    \end{align}
    namely there exists $\xi = \pmqty{x \\ 0} \not= 0$ such that $M \xi = 0$.
    Or in other words, the kernel space of $M$ is not empty, meaning that $M$ is singular.
\end{cpropw}

\begin{cprop}*{}\label{pr:input_decoupling_zeros}
    The input decoupling zeros are equal to the eigenvalues of the uncontrollable subsystem.
\end{cprop}
\begin{proof}
    We assume that $(A,B)$ is uncontrollable:
    \begin{align}
        \begin{aligned}
            \mathcal C_n = \pmqty{B & A B & ... & A^{n-1} B} \in \mathbb{R}^{{n}\times{mn}}
        \end{aligned}
    \end{align}
    is rank deficient, that implies a nonempty kernel space $\rm{Ker}\qty(\mathcal C_n^T) \subset \mathbb{R}^{n}$, namely, there exists $x \in \mathbb{R}^{n}$ such that $\mathcal C_n^T x = 0$. Alternatively, we have that
    \begin{align}
        \begin{dcases}
            B^T x = 0 \\
            B^T A^T x = 0 \\
            \cdots \\
            B^T \qty(A^T)^{n-1} x = 0
        \end{dcases}
    \end{align}
\end{proof}

\subsection{Kalman decomposition}
We produce a controllability staircase form decomposition on the system, than on both subsystems (controllable and uncontrollable) we produce an observability staircase form decomposition.

% \end{multicols}

\end{document}

