# Preliminaries of KF – Optimal Gain to minimize estimation error covariance

In the last post, we present an observer for a noisy system. We already know the estimator should be unbiased and minimum-variance. In this post, we shall show a how to choose the gain to achieve minimum variance. I think my derivation is quite clear and this is a quite good memo. Note the optimal gain and corresponding estimator presented here is still not Kalman Filter. We shall present the derivation of KF in the future.

**Noisy system:**

**Estimator:**

**State estimation error:**

**Question****:** how to find to make minimum? Note the gain is varying with .

**Answer****: **I present the solution first and then give the derivation. The optimal gain is

Note: is the covariance matrix of the state estimation error; is the covariance matrix of the output estimation error!!! where . It is easy to prove .

**Proof:** The idea is easy, but notations may be complex.

**1.** .

**2.** Becasue are uncorrlated, i.e.,

and . Therefore, we have

so that

.

**3.** Completion of squares:

Rewrite

Then

where . Hence we have

**4.** Therefore, we claim and the optimal is

.

**PS**: Note the above equation is also applicable to time variant systems. That is if we change to , the results are the same.