# Differentiate under expectation sign.

Let $$f(x)$$ be the probability density function of a $$\text{Uniform}(0,1)$$ distribution. Let $$Z\sim\text{Normal}(0,1)$$ and $$g(x)=E[f(x+Z)]$$. If one plots $$g(x)$$ in a computer, one observes like an asymetric bell shape.

We have that $$f'=0$$ exists except at two points, $$0$$ and $$1$$. But the probability that $$x+Z$$ belongs to $$\{0,1\}$$ is $$0$$. My question is why $$g'(x)=E[f'(x+Z)]=0$$ is not true.

I think that one can use the dominated convergence theorem: fixed $$x\in\mathbb{R}$$, $$f(x+Z)$$ is differentiable at $$x$$ almost surely and $$|f'(x+Z)|\leq 1$$ almost surely. So the expectation and the differentiation should commute. What is wrong with this reasoning?

Edit: I write the use of the dominated convergence theorem more in detail: by definition of derivative, $$\lim_{h\rightarrow0} \frac{f(x+h+Z)-f(x+Z)}{h}=f'(x+Z).$$ By the mean value theorem, $$\left|\frac{f(x+h+Z)-f(x+Z)}{h}\right|=|f'(x+\xi_h+Z)|\leq 1,$$ where $$|\xi_h|<|h|$$ and $$E[1]=1<\infty$$ (thus integrable). Then one uses the dominated convergence theorem, by interchanging the limit and the expectation. What is wrong here?

• What, exactly, is your dominating function? – kimchi lover Apr 17 at 12:57
• @kimchilover By definition of derivative, $$\lim_{h\rightarrow0} \frac{f(x+h+Z)-f(x+Z)}{h}=f'(x+Z).$$ By the mean value theorem, $$\left|\frac{f(x+h+Z)-f(x+Z)}{h}\right|=|f'(x+\xi_h+Z)|\leq 1,$$ where $|\xi_h|<|h|$. Then one uses the dominated convergence theorem, by interchanging the limit and the expectation. What is wrong here? – jxm Apr 17 at 12:59
• The mean value theorem is for differentiable functions, not almost-everywhere-differentiable functions. – Robert Israel Apr 17 at 13:02

$$g'(x) = \lim_{h \to 0} \dfrac{g(x+h)-g(x)}{h} = \lim_{h \to 0} \mathbb E\left[ \frac{f(x+h+Z)-f(x+Z)}{h} \right]$$

For $$h > 0$$, $$f(x+h+Z)-f(x+Z) = \cases{1 & if -x-h < Z < -x\cr -1 & if 1-x-h < Z < 1-x\cr 0 & otherwise}$$ so $$g'(x) = \lim_{h \to 0} h^{-1} (\mathbb P(-x-h where $$\varphi$$ is the density of $$Z$$.

• My main doubt is the following. Fix $x\in\mathbb{R}$. As $Z$ is absolutely continuous, there is $\tilde{\Omega}$ with $P(\tilde{\Omega})=1$ such that $x+Z(\omega)\neq 0,1$ for all $\omega\in\tilde{\Omega}$. Imagine that $x+Z(\omega)\in (0,1)$. Then we are in an open set $(0,1)$ where $g$ is differentiable. The same if $x+Z(\omega)\in (1,\infty)$ and $x+Z(\omega)\in (-\infty,0)$. Why is it not possible to apply the mean value theorem? – jxm Apr 17 at 13:10

The dishonest way to see why $$g'(0)\ne0$$ is to note that $$f'(x)=\delta(x)-\delta(x-1)$$ where $$\delta$$ is the Dirac delta function.

An honest way to use the DCT here is to dominate the difference quotients. Which will be hard in your case, but possibly doable.

An way of sidestepping this problem is to rewrite your integral $$g(x)=\int _{\mathbb R}f(x+z)\varphi(z)dz$$ as $$g(x)=\int _{\mathbb R}f(z)\varphi(z-x)dz=\int_0^1\varphi(z-x)dz.$$ (Where $$\varphi$$ is the stadard Gaussian density function, of course.) Now the difference quotient bounds are much easier to work with.

• The difference quotients can be studied through the mean value theorem, therefore it suffices to bound the derivative. I do not want to know other reasonings. I want to know what is wrong in my use of the dominated convergence theorem. – jxm Apr 17 at 12:55
• WHat's wrong with your use of the DCT is that you have not used the DCT: you have not stated what the dominator is, let alone proven it. – kimchi lover Apr 17 at 12:59