Math questions in Kalman filter equation derivation I am interested in data analysis. While my working data (actually it's shopping mall's daily sale) is accumlating, I wish to find some statistical laws underlying business phenomena. I left school for more than 10 years, and I am working in a business enviroment, I have no choice but to study by myself from level 0.
I am actually learning state space method following the book of Durbin & Koopman, and I can understand basic process underlying Kalman Filter, that is, the process starts from an initial state, and then go to prediction and updating, and so on. But it is very difficult for me to understand the math derivation.
In section 4.3 of the book, the linear model is stated as:
$$y_t = Z_t\alpha_t + \varepsilon_t$$
$$\alpha_{t+1} = T_t\alpha_t + R_t\eta_t$$ 
with $\varepsilon_t\sim N(0,H_t)$ and $\eta_t\sim N(0,Q_t)$. Further assumption is $\alpha_1\sim N(a_1,P_1)$, and $a_1$,$P_1$ are known.
Let $Y_{t-1}$ denote ($y_1,...y_{t-1}$) for $t=2,...,n$, thus:
$$v_t=y_t-E(y_t|Y_{t-1})=y_t-Z_ta_t$$
is the 1-step ahead predicted error of $y_t$ given $Y_{t-1}$. The author says that when $Y_{t-1}$ and $v_t$ are fixed then $Y_t$ is fixed and vice versa. Thus $E(\alpha_t|Y_t)=E(\alpha_t|Y_{t-1},v_t)$, and $E(v_t|Y_{t-1})=0$.
My questions are in the following text of that section, which are:


*

*Why $E(v_t)=0$? Is it calculated by the law of iterated
expectations? $$E(v_t)=E(E(v_t|Y_{t-1}))=E(0)=0$$

*Why $Cov(y_j,v_t)=E(y_jE(v_t|Y_{t-1})^\prime)$ for $j=1,...,t-1$? 
Why the conditional mean appears in equation? As what I know, by the definition of covariance, it should be calculated straightly without using conditional mean: 
$$Cov(y_j,v_t) = E(y_jv_t^\prime)-E(y_j)E(v_t)^\prime =
E(y_jv_t^\prime)$$

*The updated state $a_{t|t} =
E(\alpha_t|Y_t)=E(\alpha_t|Y_{t-1},v_t)$, and the result is shown
out in the book as: $$a_{t|t} = E(\alpha_t|Y_{t-1}) +
Cov(\alpha_t,v_t)[Var(v_t)]^{-1}v_t$$ How can I get this equation? I
know how to calculate the conditional distribution $X|Y$ for a joint
normally distribution $(X,Y)$ accorrding to Wikipedia. In my case,
the conditional mean of $\alpha_t$ given $Y_{t-1}$ and $v_t$ is a
little confused. Since there are 2 conditions: $Y_{t-1}$ and $v_t$.
Consider partitioning $Y_{t-1}$ and $v_t$ into a random vector $A =
(Y_{t-1}^\prime,v_t^\prime)^\prime$, thus my result is: $$a_{t|t} =
E(\alpha_t|Y_{t-1},v_t)=E(\alpha_t) +
Cov(\alpha_t,A)[Var(A)]^{-1}(A-E(A))$$ It is not the same as the
equation given by the book. Sad.
 A: 
  
*
  
*Why $E(v_t)=0$? Is it calculated by the law of iterated expectations?
  $E(v_t)=E(E(v_t|Y_{t−1}))=E(0)=0$

That works, given the result that $E(v_t|Y_{t−1}) = 0$. Alternatively, you could do it directly:
$E(v_t) = E( y_t - E(y_t | Y_{t-1})) = E(y_t) - E(E(y_t | Y_{t-1})) =  E(y_t) - E(y_t) = 0$


  
*Why $Cov(y_j,v_t)=E(y_j E(v_t|Y_{t−1})')$ for $j=1,\dots,t−1$? Why the conditional mean appears in equation?
  

You're right, but Durbin and Koopman often use the  Cov and Var notation implicitly with reference to a particular conditional joint distribution. For example, later on that same page they explicitly state that after they use $Cov(\alpha_t, v_t)$ and $Var(v_t)$ with reference to the joint distribution of $\alpha_t$ and $v_t$ conditional on $Y_{t-1}$.


  
*The updated state $a_{t|t}= E(\alpha_t|Y_t)=E(\alpha_t|Y_{t−1},v_t)$, and the result is shown out in the book as:
  $$a_{t|t}=E(\alpha_t|Y_{t−1})+Cov(\alpha_t,v_t)[Var(v_t)]^{-1} v_t$$

Here, $\alpha_t$ and $v_t$ are conditionally jointly Gaussian given $Y_{t-1}$, so as the book notes, you can apply lemma 1 from section 4.2. To start with:
$$\begin{bmatrix}
\alpha_t \\ v_t
\end{bmatrix} \mid Y_{t-1} \sim N \left (
\begin{bmatrix}
E(\alpha_t \mid Y_{t-1}) \\
E(v_t \mid Y_{t-1})
\end{bmatrix},
\begin{bmatrix}
Var(\alpha_t) & Cov(\alpha_t, v_t) \\
Cov(\alpha_t, v_t) & Var(v_t)\\
\end{bmatrix}
\right )$$
(where the note I just made about the joint conditional distribution that Cov and Var refer to still stands). Then applying the lemma is straightforward.
