# kalman filter: understanding the mathematical part

i am currently reading the Probabilistic robotics book where the filters are discussed. Such filters as kalman filter or particle filters. Now I can understand one thing while reading about the Kalman filter. First I want to say that I could successfully understand about Bayes filtering. I've read some of theory of random processes and I can understand it. Let me give you some details about the problem, if you think it is not sufficient I will give more. Who knows about that book I write here the page: it is about Kalman filter at page 41. Let me not to explaing the whole problem, I hope the reader could be able to understand it as it is related with Kalman filtering. However I will write more if it is needed. 1. The state transition probability $p(x_t|u_t, x_{t-1})$ must be a linear function in its arguments with added Gaussian noise. This is expressed by the following equation: $$x_t = A_t x_{t-1} + B_t u_t + \epsilon_t (1)$$ $x_t$ and $x_{t-1}$ are state vectors, and $u_t$ is a control vector at time $t$. $\epsilon_t$ is a gaussian noise.

Also it is given the definition of multivariant normal distribution: $$p(x) = det\left(2\pi\Sigma\right)^{-1/2}exp\left(-1/2(x-\mu)^T\Sigma^{-1}(x-\mu)\right) (2)$$ Where the $\mu$ and $\Sigma$ are the mean and covariance. The $x_t$ and $u_t$ are of the form: $$x_t = \left(x_{1,t}, x_{2,t}, ..., x_{n,t}\right)^T$$ $$u_t = \left(u_{1,t}, u_{2,t}, ..., u_{m,t}\right)^T$$ So it is said that in order to obatain the state transition probability $p(x_t|u_t, x_{t-1})$ you need to plugg the equation $(1)$ to the multivariant normal distribution (2).

Ok, I got that, but it is also written there that (here is the problem): The mean of the posterior state is given by: $A_tx_{t-1}+B_tu_t$ and the covariance by $R_t$ What I can't understand is that how does the mean in the multivariant normal distribution equation $(2)$ is calculated to $A_tx_{t-1}+B_tu_t$? The whole formula affter plugging $(1)$ to $(2)$ become: $$p(x_t|u_t, x_{t-1}) = det\left(2\pi R_t\right)^{-1/2}exp\left(-1/2(x_t-A_tx_{t-1}-B_tu_t)^TR_t^{-1}(x_t-A_tx_{t-1}-B_tu_t)\right)$$

I think that the mean of $x_t$ should be calculated like this: $$E{x_t} = E(A_tx_{t-1}+B_tu_t+\epsilon_t)$$ $$E{x_t} = A_tE(x_{t-1})+E(B_tu_t)$$ And I can't understand anyway how does the $Ex_t$ is equal to $A_tx_{t-1}+B_tu_t$ If you see any mistakes in my reasoning please tell me. If you need more details please comment this question for that. Thank you very much! Hope you help!

EDIT 1:

From book it is said that Kalman Filter (KF) is an implementation of Bayes Filter(BF). I understood BF. Actually it calculates belief $bel(x_t)$ at time $t$ from belief at time $t-1$. BF algorithm:

For all $x_t$:


$\hat{bel}(x_t) = \int{p(x_t|u_t, x_{t-1})bel(x_{t-1})dx_{t-1}}$

$bel(x_t) = \etap(z_t|x_t)\hat{bel}(x_t)$

end for
return $bel(x_t)$


So about KF: $$\hat{bel}(x_t) = \int{p(x_t|x_{t-1}, u_t)bel(x_{t-1})dx_{t-1}}$$ where $bel(x_{t-1})$ is represented by mean $\mu_{t-1}$ and covariance $\Sigma_{t-1}$ The state transition probability $p(x_t|x_{t-1}, u_t)$ is given as a normal distribution over $x_t$ with mean $A_tx_{t-1}+B_tu_t$ and covariance $R_t$.

If $x_t$ can't be observed directly, so then what is $E(x_t)$?

Do you really mean $Ex_t$? That's the unconditional mean without looking at any of the data, which is a constant. Normally, the Kalman filter tells you how to compute the conditional mean based on the data you have at a particular moment in time.

I'm not familiar with the book, but I assume that you mean what the Wikipedia page calls the predicted state estimate.

You don't say anything about measurement error. Do you observe $x_t$ exactly? By assumption, since you choose $u_t$ you know it at time $t-1$. Then the formula is just telling you that $$E(x_t | u_t, x_{t-1}) = A E(x_{t-1} | u_t, x_{t-1}) + B E(u_t | u_t, x_{t-1}) + E(\epsilon_t | u_t, x_{t-1}).$$ Since $E(x_{t-1} | u_t, x_{t-1}) = x_{t-1}$ and $E(u_t | u_t, x_{t-1}) = u_t$, and the noise is independent, then $$E(x_t | u_t, x_{t-1}) = A x_{t-1} + B u_t.$$

If you don't observe $x_t$ exactly, then you observe it with some error, given by $$z_t = H_t x_t + \nu_t,$$ where $z_t$ is your observation at time $t$ and $\nu_t$ is again Gaussian white noise, independent of everything else.

Now, at time $t-1$ you only know $z_1, \ldots, z_{t-1}$, so the best you can do is $$E(x_t | u_t, z_1, \ldots, z_{t-1}),$$ which I'll write as $$E_{t-1} (x_t),$$ since it's the conditional mean given all information at time $t-1$ (including $u_t$, which you choose at time $t-1$.

Using the definition, $$E_{t-1}(x_t) = A E_{t-1}(x_{t-1}) + B E_{t-1}(u_t) + E_{t-1}(\epsilon_t),$$ but the most this simplifies is to $$E_{t-1}(x_t) = A E_{t-1}(x_{t-1}) + B u_t.$$ With measurement error, the Kalman filter by design just works by calculating the two conditional means $E_{t-1}(x_t)$ and $E_{t-1}(x_{t-1})$, and no other conditional or unconditional means.

• Thank you for your answer. I have some question about what you've written above. Since $E(x_t|u_t, x_{t-1}) = x_{t-1}$ and $E(u_t|u_t,x_{t-1}) = u_t$, and the noise is independent, then $$E(x_t|u_t, x_{t-1}) = E(x_{t-1})+Bu_t$$ Shouldn't it be like this: $$E(x_t|u_t, x_{t-1}) = Ax_{t-1} + Bu_t$$ ? And I also added some details in edit to my post. – maximus Sep 18 '10 at 10:22
• You're completely right. I fixed the typo. – arsmath Sep 20 '10 at 14:21