## 5 Weighted Least-Squares Approach to State Estimation
### Contemporaneous Form
The solution, \(\hat{\mathcal{X}}\), to this problem has to fulfil the equation  
\[\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{Y}=\mathcal{A}^{\mathsf{T}} \mathcal{R}^{-1}\mathcal{A}\,\hat{\mathcal{X}} \tag{65}\]  
If the matrix product \(\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{A}\) has full rank, the estimated solution is given by  
\[\hat{\mathcal{X}}=\big{(}\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{A} \big{)}^{-1}\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{Y} \tag{66}\]  
The covariance matrix of the estimated solution \(\hat{\mathcal{X}}\) is given by  
\[\mathcal{P}(\hat{\mathcal{X}})=\big{(}\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1 }\mathcal{A}\big{)}^{-1} \tag{67}\]  
By comparing with Equation (43), the following correspondences can be found:  
\[\mathcal{V}=\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{Y}\quad\text{ and}\quad\mathcal{M}=\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{A}\]  
By evaluating the matrix product \(\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{A}\), using Equation (7), it can easily be confirmed that a symmetric one-block-banded matrix is produced, with a shape given by Equation (44) and blocks given by  
\[\mathsf{M}_{t} = \begin{cases}\mathbf{\Omega}_{t}-\mathbf{\Sigma}_{t}\mathsf{C} _{t}-(\mathbf{\Sigma}_{t}\mathsf{C}_{t})^{\mathsf{T}}+C_{t}^{\mathsf{T}} \mathbf{\Psi}_{t}\mathsf{C}_{t}+\mathbf{A}_{t+1}^{\mathsf{T}}\mathbf{\Omega}_{ t+1}\mathbf{A}_{t+1}&\text{if }\,t=1,\ldots,N-1\\ \mathbf{\Omega}_{t}-\mathbf{\Sigma}_{t}\mathsf{C}_{t}-(\mathbf{\Sigma}_{t} \mathsf{C}_{t})^{\mathsf{T}}+C_{t}^{\mathsf{T}}\mathbf{\Psi}_{t}\mathsf{C}_{ t}&\text{if }\,t=N\end{cases}  \tag{68}\] \[\mathsf{W}_{t} =\mathbf{A}_{t}^{\mathsf{T}}\mathbf{\Sigma}_{t}\mathsf{C}_{t}- \mathbf{A}_{t}^{\mathsf{T}}\mathbf{\Omega}_{t}\quad,\quad t=2,\ldots,N \tag{69}\]  
such that the algorithm in Equations (50)-(55) can be applied to solve Equation (65). The vector \(\mathcal{A}^{\mathsf{T}}\mathcal{R}^{-1}\mathcal{Y}\), corresponding to the \"given-data\" vector, \(\mathcal{V}\), in Equation (43), consists of stacked \(m\)-dimensional subvectors, given by  
\[\mathbf{v}_{t}= \begin{cases}(C_{t}^{\mathsf{T}}\mathbf{\Psi}_{1}-\mathbf{ \Sigma}_{1})\mathbf{y}_{1}+\mathbf{A}_{2}^{\mathsf{T}}\mathbf{\Sigma}_{2} \mathbf{y}_{2}-(C_{t}^{\mathsf{T}}\mathbf{\Sigma}_{1}^{\mathsf{T}}-\mathbf{ \Omega}_{1})\mathbf{x}_{1|0}&\text{if }\,t=1\\ (C_{t}^{\mathsf{T}}\mathbf{\Psi}_{t}-\mathbf{\Sigma}_{t})\mathbf{y}_{t}+ \mathbf{A}_{t+1}^{\mathsf{T}}\mathbf{\Sigma}_{t+1}\mathbf{y}_{t+1}&\text{if }\,t=2,\ldots,N-1\\ (C_{t}^{\mathsf{T}}\mathbf{\Psi}_{N}-\mathbf{\Sigma}_{N})\mathbf{y}_{N}&\text{ if }\,t=N\end{cases}  \tag{70}\]By inserting Equations (68) and (69) into Equation (52), it follows, for \(t=1,\ldots,N-1\), that  
\[ \begin{split}\mathsf{Z}_{t}=\mathbf{\Omega}_{t}-\mathbf{\Sigma}_{t}\mathsf{C }_{t}-\left(\mathbf{\Sigma}_{t}\mathsf{C}_{t}\right)^{\mathsf{T}}+\mathsf{C}_{t}^{ \mathsf{T}}\mathbf{\Psi}_{t}\mathsf{C}_{t}&+\mathsf{A}_{t+1}^{ \mathsf{T}}\mathbf{\Omega}_{t+1}\mathsf{A}_{t+1}\\ &-\left(\mathsf{A}_{t}^{\mathsf{T}}\mathbf{\Sigma}_{t}\mathsf{C}_{t}- \mathsf{A}_{t}^{\mathsf{T}}\mathbf{\Omega}_{t}\right)^{\mathsf{T}}\mathsf{Z}_{t-1}^ {-1}\left(\mathsf{A}_{t}^{\mathsf{T}}\mathbf{\Sigma}_{t}\mathsf{C}_{t}-\mathsf{A}_ {t}^{\mathsf{T}}\mathbf{\Omega}_{t}\right)\end{split}  \tag{71}\]  
By inserting Equations (69) and (70) into Equation (53), it follows, for \(t=2,\ldots,N-1\), that  
\[ \begin{split}\mathbf{z}_{t}=\left(\mathsf{C}_{t}^{\mathsf{T}} \mathbf{\
abla}_{t}-\mathbf{\Sigma}_{t}\right)\mathbf{y}_{t}+\mathsf{A}_{t+1}^{ \mathsf{T}}\mathbf{\Sigma}_{t+1}\mathbf{y}_{t+1}-\left(\mathsf{A}_{t}^{\mathsf{T}} \mathbf{\Sigma}_{t}\mathsf{C}_{t}-\mathsf{A}_{t}^{\mathsf{T}}\mathbf{\Omega}_{t} \right)^{\mathsf{T}}\mathsf{Z}_{t-1}^{-1}\mathbf{z}_{t-1}\end{split}