## 3 Distributed Cubature Kalman Filter
### Distributed Bayesian Filter  
The global posterior distribution can be given as:  
\[p(x_{k}|z_{k}) =\frac{1}{\tilde{c}}p(x_{k}|z_{k-1})p(y_{k}|x_{k}) \tag{14}\] \[=\frac{1}{\tilde{c}}p(x_{k}|z_{k-1})\prod_{i=1}^{N}p(z_{ijk}|x_{k}). \tag{15}\]  
Notice that the predictive distribution is \(p(x_{k}|z_{k-1})=\mathbb{N}(\tilde{x}_{k},\tilde{P}_{k})\), and the likelihood function is \(p(z_{i,k}|x_{k})=\mathbb{N}(z_{i,k}-h_{i}(x_{k})|R_{i,k})\). Therefore, under the assumption of Gaussian noises, we can obtain the log posterior distribution as follows,  
\[\log p(x_{k}|z_{k})= \log\frac{1}{\tilde{c}}+\log p(x_{k}|z_{k-1})+\sum_{i=1}^{N}\log p (z_{i,k}|x_{k}) \tag{16}\] \[= \log\frac{1}{\tilde{c}}+\log\frac{1}{\sqrt{(2\pi)^{n}|\tilde{P}_ {k}|}}+\sum_{i=1}^{N}\log\frac{1}{\sqrt{(2\pi)^{m_{i}}|R_{i,k}|}}\] \[-\frac{1}{2}(x_{k}-\tilde{x}_{k})^{\top}\tilde{P}_{k}^{-1}(x_{k} -\tilde{x}_{k})-\frac{1}{2}\sum_{i=1}^{N}(z_{i,k}-h_{i}(x_{k}))^{\top}R_{i,k}^ {-1}(z_{i,k}-h_{i}(x_{k})). \tag{17}\]  
Rearranging the items of Equation (17), we obtain:  
\[\log p(x_{k}|z_{k})=\tilde{C}+\frac{1}{N}\sum_{i=1}^{N}\left\{-\frac{1}{2}(x_ {k}-\tilde{x}_{k})^{\top}\tilde{P}_{k}^{-1}(x_{k}-\tilde{x}_{k})-\frac{1}{2}N (z_{i,k}-h_{i}(x_{k}))^{\top}R_{i,k}^{-1}(z_{i,k}-h_{i}(x_{k}))\right\} \tag{18}\]  
where \(\tilde{C}\) is a constant term that does not effect the estimate of \(x_{k}\). By the maximum a posteriori method, our problem becomes:  
\[\max_{x_{k}}\ \ F_{k}(x_{k})=\frac{1}{N}\sum_{i=1}^{N}-f_{i,k}(x_{k}) \tag{19}\]  
where \(f_{i,k}=\frac{1}{2}(x_{k}-\tilde{x}_{k})^{\top}\tilde{P}_{k}^{-1}(x_{k}- \tilde{x}_{k})+\frac{1}{2}N(z_{i,k}-h_{i}(x_{k}))^{\top}R_{i,k}^{-1}(z_{i,k}- h_{i}(x_{k}))\). Notice that Problem (19) is equivalent to \(\min_{x_{k}}\ \frac{1}{N}\sum_{i=1}^{N}f_{i,k}(x_{k})\). Although the global cost function \(F_{k}(x_{k})\) over the whole network can be decomposed, we cannot independently minimize the local cost function \(f_{i,k}(x_{k})\) at each node to reach a global optimum. A key point is that the global cost function \(-F_{k}(x_{k})\) of the full measurements over the whole network is definitely larger than or equal to the average local cost function \(f_{i,k}(x_{k})\) over all nodes. Namely,  
\[ \begin{array}{ll}\min_{x_{k}}\ -F_{k}(x_{k})&=-F_{k}(x_{k}^{*})\\ &=\frac{1}{N}\sum_{i=1}^{N}f_{i,k}(x_{k}^{*})\\ &\geq\frac{1}{N}\sum_{i=1}^{N}f_{i,k}(x_{i,k}^{*})\\ &=\frac{1}{N}\sum_{i=1}^{N}\min_{x_{k}}f_{i,k}(x_{k}),\end{array}  \tag{20}\]  
where \(x_{k}^{*}\) is the optimal distribution minimizing \(-F(x_{k})\) and \(x_{k}^{*}\) is the one minimizing \(f_{i,k}(x_{k})\). The equality in the second line holds if and only if \(x_{k}^{*}\) is also the optimal solution for all the local cost functions \(f_{i,k}(x_{k})\), which is not always the case. Therefore, we cannot find the optimal solution by individually minimizing the local cost function at each sensor. However, from (20), we can see that the global optimal solution over the whole network can be approximated by the average local optimal solution of each sensor. Therefore, we can construct a distributed approach to solve the problem based on average consensus. Taking the derivative of \(f_{i,k}\) with respect to \(x_{k}\), we have:  
\[\triangledown_{x_{k}}f_{i,k}\approx \tilde{P}_{k}^{-1}(x_{k}-\tilde{x}_{k})+NH_{i,k}^{\top}R_{i,k}\left[ h_{i}(\tilde{x}_{k})-z_{i,k}+H_{i,k}x_{k}-H_{i,k}\tilde{x}_{k}\right] \tag{21}\] \[= (\tilde{P}_{k}^{-1}+NH_{i,k}^{\top}R_{i,k}^{-1}H_{i,k})(x_{k}- \tilde{x}_{k})+NH_{i,k}^{\top}R_{i,k}^{-1}\left[h_{i}(\tilde{x}_{k})-z_{i,k} \right]. \tag{22}\]  
Here, we use the fact \(h_{i}(x_{k})\approx h_{i}(\tilde{x})+H_{i,k}(x_{k}-\tilde{x}_{k})\) with \(H_{i,k}=\frac{\partial h_{i}(x_{k})}{\partial x_{k}}|_{x_{k}=\tilde{x}_{k}}\). Denote \(\tilde{x}_{i,k}\) as the optimal solution with respect to problem \(\min_{x_{k}}\ f_{i,k}\).