# A Recursive Least-Squares with a Time-Varying Regularization Parameter
## 4 Recursive Least-Squares
### Recursive Least-Squares with Fixed Regularization  
To obtain a recursive formula of the estimate before the update (\(\hat{\mathbf{x}}_{m}\)) and after the update, (\(\hat{\mathbf{x}}_{m+1}\)), we can write  
\[\hat{\mathbf{x}}_{m} =\mathbf{P}_{m}\mathbf{A}_{m}^{T}\mathbf{y}_{m}, \tag{12}\] \[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]  
where  
\[\mathbf{P}_{m} \triangleq(\mathbf{A}_{m}^{T}\mathbf{A}_{m}+\gamma\mathbf{I}_{ n})^{-1}, \tag{14}\] \[\mathbf{P}_{m+1} \triangleq(\mathbf{A}_{m+1}^{T}\mathbf{A}_{m+1}+\gamma\mathbf{I} _{n})^{-1}. \tag{15}\]  
The initial condition is \(\mathbf{P}_{0}=\dfrac{1}{\gamma}\mathbf{I}_{n}\). Note that \(\mathbf{P}_{m}\) can be viewed as the inverse of scaled regularized sample covariance matrix. We can write \(\mathbf{P}_{m+1}\) as follows:  
\[\mathbf{P}_{m+1}=(\mathbf{P}_{m}^{-1}+\mathbf{u}_{m+1}\mathbf{u}_{m+1}^{T})^{ -1}. \tag{16}\]  
Using the matrix inversion lemma (Equation (30.11) in [20]), we obtain  
\[\mathbf{P}_{m+1}=\mathbf{P}_{m}-\dfrac{\mathbf{P}_{m}\mathbf{u}_{m+1}\mathbf{ u}_{m+1}^{T}\mathbf{P}_{m}}{1+\mathbf{u}_{m+1}^{T}\mathbf{P}_{m}\mathbf{u}_{m+1}}. \tag{17}\]  
This recursion updates \(\mathbf{P}_{m}\) to obtain \(\mathbf{P}_{m+1}\). By substituting Equation (17) in Equation (13) and rearranging, the estimate \(\hat{\mathbf{x}}_{m+1}\) can be obtained by updating \(\mathbf{x}_{m}\) as follows [20]:  
\[\hat{\mathbf{x}}_{m+1}=\hat{\mathbf{x}}_{m}+\dfrac{\mathbf{P}_{m}\mathbf{u}_{ m+1}}{1+\mathbf{u}_{m+1}^{T}\mathbf{P}_{m}\mathbf{u}_{m+1}}[d_{m+1}-\mathbf{u}_{m+1}^{ T}\hat{\mathbf{x}}_{m}], \tag{18}\]  
with \(\hat{\mathbf{x}}_{0}=\mathbf{0}\). The RRLS method with fixed regularization is summarized in Algorithm 1. ```
1. Start with \(\hat{\mathbf{x}}_{0}=\mathbf{0}\) and \(\mathbf{P}_{0}=\dfrac{1}{\gamma_{0}}\mathbf{I}\). 2. For each new observed data, \(d_{m+1}\), and new row, \(\mathbf{u}_{m+1}^{T}\) do the following:
3. Calculate: \(\mathbf{P}_{m+1}\) using Equation (17). 4. Calculate: \(\hat{\mathbf{x}}_{m+1}\) using Equation (18). ### The Proposed Regularization Recursive Least-Squares

This section aims to derive a recursive formula of the RRLS estimator that takes into consideration the requirement to also update the regularization parameter. If the regularization parameter before the update is \(\gamma_{m}\) and after the update is \(\gamma_{m+1}\), then Equations (14) and (15) become

\[\mathbf{P}_{m}\triangleq(\mathbf{A}_{m}^{T}\mathbf{A}_{m}+\gamma_{m}\mathbf{I} _{n})^{-1}, \tag{19}\]

and

\[\mathbf{P}_{m+1}\triangleq(\mathbf{A}_{m+1}^{T}\mathbf{A}_{m+1}+\gamma_{m+1} \mathbf{I}_{n})^{-1}, \tag{20}\]

with an initial condition \(\mathbf{P}_{0}=\dfrac{1}{\gamma_{0}}\mathbf{I}_{n}\). Now, \(\mathbf{P}_{m+1}\) becomes

\[\mathbf{P}_{m+1}=(\mathbf{P}_{m}^{-1}+\mathbf{u}_{m+1}\mathbf{u}_{m+1}^{T}+( \gamma_{m+1}-\gamma_{m})\mathbf{I}_{n})^{-1}. \tag{21}\]

Manipulating Equation (21) similar to Equation (17) using the matrix inversion lemma for Equation (21) is not helpful because the presence of \((\gamma_{m+1}-\gamma_{m})\mathbf{I}_{n}\). To obtain a desirable update formula, we rely on the assumption that \((\gamma_{m+1}-\gamma_{m})\) is small compared to \(\mathbf{P}_{m}^{-1}+\mathbf{u}_{m+1}\mathbf{u}_{m+1}^{T}\). Hence, the following approximation can be utilized [26]:

\[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]0

where

\[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]1 \[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]2 (24) \[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]3

With this assumption, the following recursions can be easily derived as:

\[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]4

\[\hat{\mathbf{x}}_{m+1} =\mathbf{P}_{m+1}\mathbf{A}_{m+1}^{T}\mathbf{y}_{m+1}, \tag{13}\]5

**Remark 1**.