UNIVERSITY OF CALIFORNIA AT BERKELEY
Department of Mechanical Engineering
ME233 Advanced Control Systems IISpring 2016

Homework #2

Assigned: Feb. 17 (Wed)
Due:Feb. 25 (Th)

1. A pair of random variables, X and Y have a joint probability density function (PDF)(1 , 0 ≤ y ≤ 2x and 0 ≤ x ≤ 1
pXY (x, y) =0 , elsewhere(a) Compute the marginal probability density functions
Z ∞Z ∞pXY (x, y)dx, and pX (x) =pXY (x, y)dypY (y) =−∞−∞(b) Compute the marginal mean mX = E{X} =R∞−∞

xpX (x)dx.

(c) Compute the marginal variance of X.
Z ∞(x − mX )2 pX (x)dx
ΛXX =−∞(d) Obtain an expression for the conditional probability density function pX|Y (x|y),i.e. the conditional PDF of X given the outcome Y = y for 0 ≤ y ≤ 2, where
pX|Y (x|y) =pXY (x, y)
pY (y)(e) Determine the conditional mean E{X|Y = y}, i.e. the expected value of X given
the outcome Y = y for 0 ≤ y ≤ 2.
(f) Determine the conditional mean E{X|Y = 0.5}.
(g) Notice that the conditional mean E{X|Y } can be thought of as a function of therandom variable Y . Therefore, it is itself a random variable. Introducing thenotation
Z ∞mX|Y (Y ) = E{X|Y } =xpX|Y (x|Y )dx,−∞

prove that the expected value of the conditional mean mX|Y (Y ) is equal to themarginal mean of X, i.e.
Z ∞Z ∞E{mX|Y (Y )} =mX|Y (y)pY (y)dy = mX =xpX (x)dx.
−∞−∞

Verify this result by computing E{mX|Y (Y )} and comparing it to mX for theexample above.
1

(h) Compute the variance of the conditional mean mX|Y (Y ) for the example above.
Z ∞ΛmX|Y mX|Y =(mX|Y (y) − mX )2 pY (y)dy−∞

You should find that ΛmX|Y mX|Y < ΛXX .
(i) Obtain an expression for the conditional variance of X given YZ ∞2(x − mX|Y (Y ))2 pX|Y (x|Y )dx
ΛX|Y X|Y (Y ) = E{(X − mX|Y (Y )) |Y } =−∞for the example above. Notice that the conditional variance of X given Y ,ΛX|Y X|Y (Y ) is also a random variable.
(j) Finally, compute the expected value of the conditional variance of X given Y ,Z ∞
ΛX|Y X|Y (y)pY (y)dyE{ΛX|Y X|Y (Y )} =−∞for the example above and verify thatΛXX = ΛmX|Y mX|Y + E{ΛX|Y X|Y (Y )}.
2. Consider the stochastic system
Y (k) − 0.5Y (k − 1) = W (k) − 0.3W (k − 1)(1)where W (k) is a wide sense stationary (WSS) zero mean white random sequence withunit variance, i.e.
mW = 0ΛW W (l) = E{W (k + l)W (k)} = δ(l)and δ(l) is the unit pulse function. In this problem, we will compare the theoreticalvalue of the relevant covariances with empirical estimates of those quantities computed
in a simulation. 1(a) Do a numerical simulation (in Matlab, Python, or Julia) of the response of thissystem for one sample sequence w(k) :i. Generate the sample sequence w(k) using w = randn(N,1) or equivalent,
where N is a large number (e.g. 5000).
ii. Generate the sample output sequence y(k) by propagating the system dynamics over time with a for loop.
iii. Generate and plot the estimates of the covariances and cross-covariances
ΛW W (j), ΛW Y (j), ΛY W (j), ΛY Y (j), for j = {−10, −9, · · · , 0, · · · 10}.
1Since you will require an initial condition to perform time simulations, the output of the system given
by Eq. (1) will not, strictly speaking be WSS. However, if the length of the sample sequence is taken to besufficiently long, the relevant quantities will be approximately given by time averages.

2(b) Determine the cross-covariance (cross-correlation) functionΛY W (l) = E{Y (k + l)W (k)}P−land Λ̂Y W (z) = ∞l=−∞ z ΛY W (l). Plot ΛY W (l) for l = {−10, −9, · · · , 0, · · · 10}
and compare the results with those empirically obtained from your simulation.
Notice that ΛY W (l) is a causal sequence, i.e. ΛY W (l) = 0 for l < 0 and all thepoles of Λ̂Y W (z) will be inside the unit circle.
(c) Determine the cross-covariance (cross-correlation) functionΛW Y (l) = E{W (k + l)Y (k)}P−land Λ̂W Y (z) = ∞l=−∞ z ΛW Y (l). Plot ΛW Y (l) for l = {−10, −9, · · · , 0, · · · 10}
and compare the results with those empirically obtained from your simulation.
Notice that ΛW Y (l) is an anti-causal sequence, i.e. ΛW Y (l) = 0 for l > 0 and all
the poles of Λ̂W Y (z) will be outside the unit circle.
(d) Determine the auto-covariance (auto-correlation) function
ΛY Y (l) = E{Y (k + l)Y (k)}P−land Λ̂Y Y (z) = ∞l=−∞ z ΛY Y (l). Plot ΛY Y (l) for l = {−10, −9, · · · , 0, · · · 10}
and compare the results with those empirically obtained from your simulation.
Notice that Λ̂Y Y (z) will have poles both outside and inside the unit circle.
(e) Compute ΛY W (0) utilizing Eq. (1).
Hint: Multiply both sides of Eq. (1) by W (k) and take expectations.
(f) Compute ΛY W (1) utilizing Eq. (1).
Hint: Multiply both sides of Eq. (1) by W (k − 1) and take expectations.
(g) Compute ΛY Y (0) utilizing equation (1).
Hint: From Eq. (1) we have
Y (k) = 0.5Y (k − 1) + W (k) − 0.3W (k − 1) .

(2)

Square both sides of Eq. (2) and take expectations.
3. Let X ∼ N (10, 2), V1 ∼ N (0, 1) and V2 ∼ N (0, 2) be independent random variables.
Assume that you are trying to make a measurement of X with two different instruments.
Let Y = X +V1 be the measurement of X using the first instrument and Z = X +V2 bethe measurement of X using the second instrument, where V1 and V2 are respectively
the measurement noises of the first and second instruments.
(a) Determine mX|Y =9 , i.e. the conditional expectation of X given that the first instrument yielded the measurement Y = 9.
(b) Determine mX|Z=11 , i.e. the conditional expectation of X given that the secondinstrument yielded the measurement Z = 11.
3

(c) Determine mX|(Y =9,Z=11) , i.e. the conditional expectation of X given that the firstand second instruments respectively yielded the measurements Y = 9 and Z = 11.
4. A random variable X is repeatedly measured, but the measurements are noisy. Assume
that the measurement process can be described byY (k) = X + V (k)where X, V (0), V (1), V (2), . . . are jointly Gaussian random variables withE{X 2 } = X0
E{V (k + j)V (k)} = ΣV δ(j)

E{X} = 0
E{V (k)} = 0
E{XV (k)} = 0 .

Let y(k) be the k-th measurement (i.e. outcome of Y (k)) and let ȳ(k) = {y(0), . . . , y(k)}.
(a) Obtain the least squares estimate of X given the k+1 measurements y(0), . . . , y(k)and the corresponding estimation error covariance, i.e. find x̂|ȳ(k) and ΛX̃|ȳ(k) X̃|ȳ(k) .
Hint: You do not need to invert a (k + 1) × (k + 1) matrix to find these quantities.
Instead expressΛȳ(k)ȳ(k) = A + uv T
where A is a matrix that is easy to invert and u and v are vectors. In this case,the matrix inversion lemma says that−1Λ−1−ȳ(k)ȳ(k) = A

1
1 + v T A−1 u

A−1 uv T A−1 .

(b) We now examine the case when X0 → ∞, i.e. when no prior information isavailable on X. Show the following:
1
lim x̂|ȳ(k) =[y(0) + y(1) + · · · + y(k)]X0 →∞k+1ΣVlim ΛX̃ X̃
=.
|ȳ(k) |ȳ(k)X0 →∞k+14