Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been working on this for several days and have been unable to come up with an answer. The problem is very simple to state, but it seems difficult to solve.

A computer draws a number $x$ at random from a uniform distribution between $a$ and $b$. The computer also draws a number $y$ from a normal distribution with mean $m$ and standard deviation $s$. The computer then calculates $z = x + y$. The computer reports $z$ but it does not report $x$ or $y$. Calculate the expected value of $x$ given $z$.

So far, I have noted that the probability distribution function producing $z$ is the convolution of the uniform and normal probability distribution functions producing $x$ and $y$, respectively. And I believe that I need to use Bayes' Theorem to determine the value of $x$ given $z$, but I am stuck soon beyond that point. Any help much appreciated!

share|cite|improve this question
Are the other parameters ($a,b,m,s$) known or assumed to be unknown? – Hans Engler Mar 10 '12 at 19:16
Hans, three parameters are known and fixed (a = 0, b = 1, m = 0) and I need to be able to solve for any given s >= 0. It is OK if the final answer has integrals or derivatives that cannot be simplified further. – mbabramo Mar 10 '12 at 20:48

You don't say explicitly that $X$ and $Y$ are independent random variables but since you use convolution to compute the density of $Z = X+Y$, I expect that you have been told, or are assuming, that $X$ and $Y$ are independent random variables.

Here is one way to approach the problem.

Since $a = 0, b = 1, m = 0$, the joint density of $X$ and $Y$ is $$f_{X.Y}(x,y) = \frac{1}{s\sqrt{2\pi}}\exp(-y^2/2s^2), ~0 \leq x \leq 1, -\infty < y < \infty.$$ From this, figure out the joint density $f_{X,Z}(x,z)$ of $(X, X+Y) = (X,Z)$ using standard methods (Jacobians will be involved) and then $$f_{X|Z}(x|z) = \frac{f_{X,Z}(x,z)}{f_Z(z)} = \frac{f_{X,Z}(x,z)}{\int_{-\infty}^{\infty}f_{X,Z}(x,z)\mathrm dx}.$$ From this, you can calculate $$E[X|Z] = \int_{-\infty}^{\infty} xf_{X|Z}(x|z) \mathrm dx.$$ Alternatively, since conditioned on $X = x$, $Z$ is a Gaussian random variable with mean $x$ and variance $s^2$, $$f_{X|Z}(x|z) = \frac{f_{Z|X}(z|x)f_X(x)}{f_Z(z)} = \frac{1}{f_Z(z)}\cdot\frac{1}{s\sqrt{2\pi}}\exp(-(x-z)^2/2s^2), ~ 0 \leq x \leq 1$$ where now $f_Z(z)$ can be recognized as the constant that makes the function on the right a probability density and easily expressible in terms of the standard Gaussian distribution $\Phi(\cdot)$ or the $\text{erf}$ function. You will need to use the fact that $x\exp(-x^2/2)$ is a perfect integral in computing $E[X|Z]$

share|cite|improve this answer
Thank you for this very helpful exposition. I am still having trouble completing the problem. Would you or anyone else be willing to complete either of the techniques (or both as a way of verifying the answer)? – mbabramo Mar 12 '12 at 21:36
Hint: $$\int_0^1 \frac{1}{s\sqrt{2\pi}}\exp(-(x-z)^2/2s^2) \mathrm dx = \Phi\left(\frac{1-z}{s}\right) - \Phi\left(\frac{-z}{s}\right)$$ (figure out why this is so!) and so you have the value of $f_Z(z)$ (remember that it is just a constant; the RHS is a function of $x$). As I suggested, to find $E[X|Z=z]$, you need to write the integrand as $$x\exp(-(x-z)^2/2s^2) = s^2[(x-z)/s^2]\exp(-(x-z)^2/2s^2) +z\exp(-(x-z)^2/2s^2)$$ and then use the fact that one term is a perfect integral and the other gives a difference of $\Phi(\cdot)$'s upon integration. – Dilip Sarwate Mar 12 '12 at 22:04
I think that one thing I need to do is calculate $f_{z}(z) = f_{x+y}(z)$, and based on the definition of convolution, that produces $$\int_{-\infty}^{\infty}f_{x}(t)f_{y}(z-t)dt = \int_{-\infty}^{\infty}1*\frac{1}{s\sqrt{2\pi}}\exp(-\frac{(z-t)^2}{2s^2})dt$$. Does this seem to be on the right track? – mbabramo Mar 13 '12 at 16:10
Meanwhile, $$E(f_{x|z}) = \int_0^1 xf_{x|z}dx = \int_0^1 \frac{x}{f_{z}(z)}\frac{1}{s\sqrt{2 \pi}}e^{-\frac{(x-z)^2}{2 s^2}}dx$$ so I need to multiply $\frac{1}{f_{z}(z)s\sqrt{2 \pi}}$ by $\int_0^1 x e^{-\frac{(x-z)^2}{2 s^2}} \, dx$. That integral evaluates to $$\frac{1}{2} s \left(\sqrt{2 \pi } z \text{erf}\left(\frac{1-z}{\sqrt{2} s}\right)+\sqrt{2 \pi } z \text{erf}\left(\frac{z}{\sqrt{2} s}\right)+2 s \left(e^{-\frac{z^2}{2 s^2}}-e^{-\frac{(z-1)^2}{2 s^2}}\right)\right),$$ so if that's right, all I need is $f_{z}(z)$. – mbabramo Mar 13 '12 at 16:29
The convolution integral that you need to compute to get $f_Z(z)$ is the area between $0$ and $1$ under a normal density with mean $z$ and standard deviation $s$. It can be expressed in terms of the erf function, but cannot be expressed in terms of "elementary" functions such as exp, sin, cos, log etc – Dilip Sarwate Mar 13 '12 at 19:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.