# Reachability and Observability ## Reachability While in the non linear world, we can solve a `system` ***numerically***, through an `iterative-approach`: $$ \begin{align*} \dot{x}(t) &= f(x(t), u(t)) && t \in \R \\ x(k+1) &= f(x(k), u(k)) && t \in \N \end{align*} $$ In the linear world, we can do this ***analitically***: > [!TIP] > We usually consider $x(0) = 0$ $$ \begin{align*} x(1) &= Ax(0) + Bu(0) \\ x(2) &= Ax(1) + Bu(1) &&= A^{2}x(0) + ABu(0) + Bu(1) \\ x(3) &= Ax(2) + Bu(2) &&= A^{3}x(0) + A^{2}Bu(0) + ABu(1) + Bu(2) \\ \dots \\ x(k) &= Ax(k-1) + Bu(k-1) &&= \underbrace{A^{k}x(0)}_\text{Free Dynamic} + \underbrace{A^{k-1}Bu(0) + \dots + ABu(k-2) + Bu(k-1) } _\text{Forced Dynamic} \\[40pts] x(k) &= \begin{bmatrix} B & AB & \dots & A^{k-2}B & A^{k-1}B \end{bmatrix} \begin{bmatrix} u(k-1) \\ u(k-2) \\ \dots \\ u(1) \\ u(0) \end{bmatrix} \end{align*} $$ Now, there's a relation between the determinant and the matrix containing $A$ and $B$: $$ \begin{align*} &p_c(s) = det(sI -A) = s^n + a_{n-1} s^{n-1} + a_{n-2}s^{n - 2} + \dots + a_1s + a_0 = 0 \\[10pt] &\text{Apply Caley-Hamilton theorem:} \\ &p_c(A) = A^{n} + a_{n-1}A^{n_1} + \dots + a_1A + a_0 = 0\\[10pt] &\text{Remember $G(s)$ formula and multiply $p_c(A)$ for $B$:} \\ &p_c(A)B = A^{n}B + a_{n-1}A^{n_1}B + \dots + a_1AB + a_0B = 0 \rightarrow \\ &p_c(A)B = a_{n-1}A^{n_1}B + \dots + a_1AB + a_0B = -A^{n}B \end{align*} $$ All of these makes us conclude something about the Kallman Controllability Matrix: $$ K_c = \begin{bmatrix} B & AB & \dots & A^{k-2}B & A^{k-1}B \end{bmatrix} $$ Moreover, $x(n) \in range(K_c)$ and $range(K_c)$ is said `reachable space`.\ In particular if $rank(K_c) = n \rightarrow range(K_c) = \R^{n}$ this is `fully reachable` or `controllable` > [!TIP] > Some others use `non-singularity` instead of the $range()$ definition > [!NOTE] > On the Franklin Powell there's another definition to $K_c$ that > comes from the fact that we needed to find a way to transform > ***any*** `realization` into the > [`Control Canonical Form`](./CANONICAL-FORMS.md/#control-canonical-form) > ## Observability This is the capability of being able to deduce the `initial state` by just observing the `output`. Let's focus on the $y(t)$ part: $$ y(t) = \underbrace{Cx(t)}_\text{Free Output} + \underbrace{Du(t)}_\text{Forced Output} $$ Assume that $u(t) = 0$: $$ \begin{align*} & y(0) = Cx(0) && x(0) = x(0) \\ & y(1) = Cx(1) && x(1) = Ax(0) && \text{Since $u(t) = 0 \rightarrow Bu(t) = 0$} \\ & y(2) = Cx(2) && x(2) = A^2x(0) \\ & \vdots && \vdots \\ &y(n) = Cx(n) && x(n) = A^nx(0) \rightarrow \\ \rightarrow &y(n) = CA^nx(0) \end{align*} $$ Now we have that: $$ \begin{align*} \vec{y} = &\begin{bmatrix} C \\ CA \\ \vdots \\ CA^{n} \end{bmatrix} x(0) \rightarrow \\ \rightarrow x(0) = &\begin{bmatrix} C \\ CA \\ \vdots \\ CA^{n} \end{bmatrix}^{-1}\vec{y} \rightarrow \\ \rightarrow x(0) = & \frac{Adj(K_o)}{det(K_o)} \vec{y} \end{align*} $$ For the same reasons as before, we can use Caley-Hamilton here too, also, we can see that if $K_o$ is `singular`, there can't be an inverse. As before, $K_o$ is such a matrix that allows us to see if there exists a [`Canonical Observable Form`](CANONICAL-FORMS.md/#observable-canonical-form) The `non-observable-space` is equal to: $$ X_{no} = Kern(K_o) : \left\{ K_ox = 0 | x \in X\right\} $$ ## Decomposition of these spaces The space of possible points is $X$ and is equal to $X = X_r \bigoplus X_{r}^{\perp} = X_r \bigoplus X_{nr}$ Analogously we can do the same with the observable spaces $X = X_no \bigoplus X_{no}^{\perp} = X_no \bigoplus X_{o}$