The Univariate Kalman Filter
Consider a linear dynamical system observed in Gaussian noise:
st+1=ast+wtot=cst+vtwt∼N(0,σ2w)vt∼N(0,σ2v)b0=N(ˆs0,Σ0)st∼btwith state and observation spaces S=O=R, discrete time t=0,1,..., and coefficients a,c∈R. We assume: (i) that vt and vk for any t and k are independent; (ii) wt and wk for any t and k are independent; (iii) (vt)t≥0 and (wt)t=≥0 are independent processes; and (iv) s0 is independent of vt and wt for any t.
The optimal filtering recursion is:
bt+1(st+1)=z(ot+1∣st+1)∫Xp(st+1∣st)bt(st)dst∫Sz(ot+1∣st+1)∫Sp(st+1∣st)b(st)dstdst+1and the optimal filtered state estimate at time t+1 is
ˆst+1|t+1=E[st+1∣y1:t+1]=∫Ssbt+1(s)dsThe univariate Kalman filter is defined as
bt=N(ˆst|t,Σt|t)ˆst|t=ˆst|t−1+bt(ot−cˆst|t−1)Σt|t=Σt|t−1−cbtΣt|t−1bt=cΣt|t−1c2Σt|t−1+σ2vˆst|t−1=aˆst−1|t−1Σt|t−1=a2Σt−1|t−1+σ2wwhere bt is the posterior at time t and
ˆst|tis the state estimate at time t.
To show that the above equations are correct, I derive the Kalman from the Bayesian recursion above. I start by noting some properties of the system.
Lemma 1: At any time t≥0, st and ot are Gaussian random variables.
Proof:
By definition,
s1=as0+w0s2=as1+w1=a(as0+w0)+w1=a2s0+aw0+w1s3=as2+w2=a(a2s0+aw0+w1)+w2=a3s0+a2w0+aw1+w2⋮st=ats0+t−1∑k=0at−k−1wkHence, st is a linear combination of the random variables s0,w0,w1,...,wt−1. Since all of these variables are individually Gaussian and independent, they are jointly Gaussian. As Gaussians are closed under linear transformations, it follows that st is Gaussian.
Now consider the measurement ot, by definition:
ot=cst+vtSince, st is Gaussian and vt is Gaussian, ot is a linear combination of two Gaussians, and is thus also Gaussian.
Using the above lemma, the system can also be written in terms of transition and observation kernels rather than a difference equation:
st+1∼p(st+1∣st)=1σw√2πexp(−12(st+1−astσw)2)ot∼z(ot∣st)=1σv√2πexp(−12(ot−cstσv)2) Q.E.D
Another important property of the system is the following.
Lemma: st and ot at any time t≥0 are jointly Gaussian.
Proof:
By Lemma 1 we know that
st=ats0+t−1∑k=0at−k−1wkot=c(ats0+t−1∑k=0at−k−1wk)+vtSince the random variables (s0,w0,w1,...,wt,v0,v1,...,vt) are jointly Gaussian (see Lemma 1), st and ot are both linear combinations of a set of jointly Gaussian random variables. Let x=(s0,w0,w1,...,wt,v0,v1,...,vt) and let n,m denote the coefficients of the linear combinations for st and ot respectively. Since nTx and mTx are Gaussians, any linear combination of nTx and mTx is a Gaussian. Now consider the vector (nTx,mTx). Since any linear combination of it components is a Gaussian, (nTx,mTx) is by definition a multivariate Gaussian. Q.E.D.
Derivation of the univariate Kalman filter
We derive the Kalman filter equations using mathematical induction. We start with t=1. Using Lemmas 1–2 we obtain
[s0o0]∼N([ˆs0cˆs0],[Σ0cΣ0cΣ0cΣ0+σ2v])[s1o0]∼N([aˆs0cˆs0],[a2Σ0+σ2wacΣ0acΣ0c2Σ0σ2v])[o1o0]∼N([acˆs0cˆs0],[c2(a2Σ0+σ2w)+σ2vac2Σ0ac2Σ0c2Σ0σ2v])We know from probability calculus that the conditional of a multivariate Gaussian is also Gaussian. In particular, applying standard Gaussian transformation rules, we obtain
p(s1∣o0)=N(ˆs1|0,Σ1|0)p(o1∣o0)=N(cˆs1|0,c2Σ1|0+σ2v)where
ˆs1|0=aˆx0+acΣ0c2Σ0+σ2v(o0−cˆs0)=aˆx0|0Σ1|0=a2Σ0+σ2w−(acΣ0)2c2Σ0+σ2v=a2Σ0|0+σ2wand the expectation and variance are
E[o1∣o0]=acˆs0+ac2Σ0c2Σ0+σ2v(o0−cˆs0)=cˆs1,0Var(o1∣o0)=c2(a2Σ0+σ2w)+σ2w−(ac2Σ0)2c2P0+σ2v=c2Σ1|0+σ2wFurthermore
[s1o1]∣o0∼N([ˆs1|0cˆs1|0],[Σ1|0cΣ1|0cΣ1|0c2Σ1|0+σ2v])This means that
p(s1∣o0,o1)=N(ˆs1|1,Σ1|1)where
ˆs1|1=ˆs1|0+cΣ1|0c2Σ1|0+σ2v(o1−cˆx1|0)Σ1|1=Σ1|0−(cΣ1|0)2c2Σ1|0+σ2vThis proves the inductive base case. Now assume by induction that the Kalman filter equations hold for t=k−1. Applying the exact same calculations as above, we obtain
p(sk∣o0:k−1)=N(ˆsk|k−1,Σk|k−1)p(sk∣o0:k−1)=N(cˆsk|k−1,c2Σk|k−1+σ2v)where
ˆsk|k−1=aˆsk−1|k−1and
Σk|k−1=a2Σk−1|k−1+σ2w.Further
[skok]∣o0:k−1∼N([ˆsk|k−1cˆsk|k−1],[Σk|k−1cΣk|k−1cΣk|k−1c2Σk|k−1+σ2v])which means that
p(xk∣o0:k)=N(ˆsk|k,Σk|k),where
ˆsk|k=ˆsk|k−1+bk(ok−cˆsk|k−1)Σk|k=Σk|k−1−cbkΣk|k−1bk=cΣk|k−1c2Σk|k−1+σ2vWhich are exactly the Kalman equations. This completes the induction step. Q.E.D.