## 2 Unified Algorithm of Finite Memory Structure Filter and Smoother  
Consider the following linear discrete-time state-space model:  
\[x_{i+1} = Ax_{i}+Bu_{i}+Gw_{i},\] \[z_{i} = Cx_{i}+v_{i}, \tag{1}\]  
where \(x_{i}\ \in\Re^{n}\) is the system state variable, \(u_{i}\ \in\Re^{p}\) is the control input, \(z_{i}\ \in\Re^{q}\) is the sensor measurement output. A couple of noises, the system noise \(w_{i}\ \in\Re^{p}\) and the measurement noise \(v_{i}\ \in\Re^{q}\), are zero-mean white Gaussian. These noises are mutually uncorrelated and their covariances are denoted by positive definite matrices \(Q\) and \(R\), respectively. At the current time \(i\), finite measurements \(Z_{i}\) and inputs \(U_{i}\) on the most recent window \([i-M,i]\) can be expressed by the regression form with the current state \(x_{i}\) as follows:  
\[Z_{i}-\Xi U_{i}\ =\ \Gamma x_{i}+\Lambda W_{i}+V_{i}, \tag{2}\]  
where  
\[Z_{i}\stackrel{{\triangle}}{{=}}\left[ \begin{array}{c}z_{i-M} \\ z_{i-M+1}\\ \vdots\\ z_{i-2}\\ z_{i-1}\end{array} \right],U_{i}\stackrel{{\triangle}}{{=}}\left[ \begin{array}{c}u_{i-M}\\ u_{i-M+1}\\ \vdots\\ u_{i-2}\\ u_{i-1}\end{array} \right],W_{i}\stackrel{{\triangle}}{{=}}\left[ \begin{array}{c}w_{i-M}\\ w_{i-M+1}\\ \vdots\\ w_{i-2}\\ w_{i-1}\end{array} \right],V_{i}\stackrel{{\triangle}}{{=}}\left[ \begin{array}{c}v_{i-M}\\ v_{i-M+1}\\ \vdots\\ v_{i-2}\\ v_{i-1}\end{array} \right], \tag{3}\]  
and matrices \(\Gamma\), \(\Xi\), \(\Lambda\) are defined by  
\[\Gamma \stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}CA^{-M}\\ CA^{-M+1}\\ \vdots\\ CA^{-2}\\ CA^{-1}\end{array} \right],\ \ \Xi\stackrel{{\triangle}}{{=}}-\left[ \begin{array}{cccc}CA^{-1}B&CA^{-2}B&\cdots&CA^{-M}B\\ 0&CA^{-1}B&\cdots&CA^{-M+1}B\\ \vdots&\vdots&\cdots&\vdots\\ 0&0&\cdots&CA^{-2}B\\ 0&0&\cdots&CA^{-1}B\end{array} \right],\] \[\Lambda \stackrel{{\triangle}}{{=}} -\left[ \begin{array}{cccc}CA^{-1}G&CA^{-2}G&\cdots&CA^{-M}G\\ 0&CA^{-1}G&\cdots&CA^{-M+1}G\\ \vdots&\vdots&\cdots&\vdots\\ 0&0&\cdots&CA^{-2}G\\ 0&0&\cdots&CA^{-1}G\end{array} \right]. \tag{4}\]  
Meanwhile, at the lagged time \(i-d\), the lagged state \(x_{i-d}\) can be represented by  
\[x_{i-d} = A^{-d}x_{i}-\tilde{\Xi}U_{i}-\tilde{\Lambda}W_{i}, \tag{5}\]where matrices \(\widehat{\Xi}\) and \(\bar{\Lambda}\) is defined by  
\[\widehat{\Xi} \stackrel{{\triangle}}{{=}} -\bigg{[}\overbrace{0\;0\;\cdots\;0}^{M-d}\;A^{-1}B\;A^{-2}B\; \cdots\;A^{-d}B\bigg{]},\] \[\bar{\Lambda} \stackrel{{\triangle}}{{=}} -\bigg{[}\overbrace{0\;0\;\cdots\;0}^{M-d}\;A^{-1}G\;A^{-2}G\; \cdots\;A^{-d}G\bigg{]}.\]  
From (2) and (5), the current state \(x_{i}\) and the lagged state \(x_{i-d}\) can be represented by the regression form with the augmented state \(X_{i}\) as follows:  
\[\bar{Z}_{i}-\bar{\Xi}U_{i}\;=\;\bar{\Gamma}X_{i}+\bar{\Lambda}W_{i}+\bar{V}_{i}, \tag{6}\]  
where  
\[X_{i} \stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}x_{i}\\ x_{i-d}\end{array} \right],\;\bar{Z}_{i}\stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}Z_{i}\\ 0\end{array} \right],\;\bar{V}_{i}\stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}V_{i}\\ 0\end{array} \right],\] \[\bar{\Gamma} \stackrel{{\triangle}}{{=}} \left[ \begin{array}{cc}\Gamma&0\\ A^{-d}&-1\end{array} \right],\;\bar{\Xi}\stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}\Xi\\ \Xi\end{array} \right]\;\;\bar{\Lambda}\stackrel{{\triangle}}{{=}} \left[ \begin{array}{c}\Lambda\\ \bar{\Lambda}\end{array} \right].\]  
The noise term \(\bar{\Lambda}W_{i}+\bar{V}_{i}\) in (6) is zero-mean white Gaussian and its covariance given by the positive definite matrix \(\Pi\) as follows:  
\[\Pi \stackrel{{\triangle}}{{=}} \bar{\Lambda}\bar{Q}\bar{\Lambda}^{T}+\left[ \begin{array}{cc}R &0\\ 0&0\end{array} \right]=\left[ \begin{array}{cc}\Lambda\bar{Q}\Lambda^{T}+R& \Lambda\bar{Q}\bar{\Lambda}^{T}\\ \bar{\Lambda}\bar{Q}\Lambda^{T}&\bar{\Lambda}\bar{Q}\bar{\Lambda}^{T}\end{array}