# Kalman filter, trace of state error covariance matrix, dimensionality problem

One of the derivations of discrete Kalman-filter relies on specifying a $$G_k$$ matrix gain in the measurement update equation

$$\hat{x}_{k}^{+}=\hat{x}_{k}^{-}+G_k\left(y_k-C_k\hat{x}_{k}^{-}\right)$$

which minimizes the trace of the a-posteriori estimated state error covariance matrix, namely:

\begin{align} P_k^+ & = E\left[\left(x_k-\hat{x}_k^+\right)\left(x_k-\hat{x}_k^+\right)^T\right]\\ & =\left(I-G_kC_k\right)P_k^-\left(I-G_kC_k\right)^T+G_kR_kG_k^T \end{align}

$$\frac{\partial Tr\left[P_k^+\right]}{\partial G_k} = - 2 P_k^-C_k^T + 2 G_kC_kP_k^-C_k^T + 2 G_kR_k = 0$$ $$G_k = P_k^-C_k^T \left(C_kP_k^-C_k^T + R_k\right)^{-1}$$

Is trace a valid optimality criterion? The state is comprised of variables with different units, which makes them incompatible for addition. For example, the optimal $$G_k$$ might be skewed towards the diagonal element expressed in micrometer-squared rather than the other state error variance expressed in light-year-squared.

If we apply an invertible state transform $$\xi=Tx$$ to the error covariance matrix to account for the different dimensions and numerical ranges, we get:

\begin{align} TP_k^+T^T & = TE\left[\left(x_k-\hat{x}_k^+\right)\left(x_k-\hat{x}_k^+\right)^T\right]T^T \\ & = E\left[T\left(x_k-\hat{x}_k^+\right)\left(x_k-\hat{x}_k^+\right)^TT^T\right] \\ & = E\left[\left(\xi_k-\hat{\xi}_k^+\right)\left(\xi_k-\hat{\xi}_k^+\right)^T\right] \\ & =T\left(I-G_kC_k\right)P_k^-\left(I-G_kC_k\right)^TT^T+TG_kR_kG_k^TT^T \end{align}

$$\frac{\partial Tr\left[TP_k^+T^T\right]}{\partial G_k} = - 2 T^TTP_k^-C_k^T + 2 T^TTG_kC_kP_k^-C_k^T + 2 T^TTG_kR_k = 0$$

Multiplying with $$\left(T^TT\right)^{-1}$$ from the left we arrive at the same result, which surprised me. I thought that a linear reconfiguration of states would change the optimal $$G_k$$, but this is clearly not the case. How to better cope with this dimensionality problem?