Minimizing $a^TPa$ (for arbitrary $a$) vs minimizing trace$(P)$. Context: I am reading "Introduction to stochastic control theory"
by Karl Johan Åström. There he develops a Kalman filter with the goal of "minimizing $a^TPa$ for arbitrary vector $a$", where $P$ is the resulting covariance matrix of the filter. Surprisingly, the result doesn't depend on the vector $a$. Moreover, I have seen other papers/notes in which they develop the exact same result, but by minimizing trace$(P)$ instead, without mentioning any "arbitrary vector $a$".
Question: This confuses me. Is minimizing $a^TPa$ (for arbitrary $a$) somehow the same as minimizing trace$(P)$? What does "arbitrary $a$" mean anyway in this context?

Yes, minimizing $\text{trace}(P) = \sum_i P_{ii}$ is the same as minimizing $a^TPa$ for an arbitrary vector $a \neq 0$ because $P$ is symmetric (it is a covariance matrix) and so it can be diagonalized. That is, there exist matrices $D, V$ such that $P = VDV^T$, where $D = \text{diag}(d_1, \ldots, d_n)$. Since the trace operator is invariant under a change of basis and $a^TPa = a^TVDV^Ta=b^TDb=\sum_i b_i^2d_i$, minimizing the last term is the same as minimizing the trace because $b_i^2 > 0$.
