# Derivation and expectation interchange

I would like to know when it is allowed to interchange derivation and expectation. Suppose $$X$$ is some r.v whose dynamic is controlled by some parameter $$\sigma$$ and suppose $$h$$ is some smooth function of two variables. Is the following true: $$\frac{\partial \mathbb{E}\left[h(X,\sigma)\right]}{\partial \sigma} =\mathbb{E}\left[\frac{\partial h(X,\sigma)}{\partial \sigma} \right]$$

I think it's wrong (the expectation operator depends on $$\sigma$$ through the dynamics of $$X$$). If $$d\mathbb{P}_X(x)=p_{X,\sigma}(x)dx$$, then we would have $$\frac{\partial \mathbb{E}\left[h(X,\sigma)\right]}{\partial \sigma} =\int \frac{\partial}{\partial \sigma}\left[h(X,\sigma)p_{X,\sigma}(x)\right]dx$$ which is in general different from $$\mathbb{E}\left[\frac{\partial h(X,\sigma)}{\partial \sigma} \right] =\int \frac{\partial h(X,\sigma)}{\partial \sigma}p_{X,\sigma}(x)dx$$

Could somebondy confirm my reasoning ?

• I think this is better suited for math SE, but in general derivatives are like a limit operation, so if you can find a sequence of random variables that is bounded that corresponds to the limit in the derivative, then you can interchange the order by monotone convergence or dominated convergence. If you search interchanging derivative and expectation on math SE you will find a lot of results – Slade Apr 14 at 13:49
• You can check out Appendix 5 of Durrett’s Probability Theory and Examples 5th Edition. It‘s free and online. – edwardngtakwa Apr 14 at 16:40
• In fact, I used the dominated convergence to interchange the derivative and the integral sign. My point was that since the density os $X$ may depend on the parameter $\sigma$, then I'll have to use the Leibniz rule for the product, hence ending with a different answer than if I derived under the expectation sign. – Aguelmame Apr 14 at 16:48
• Ah, I see what your question is. I think some of your notations are unclear to me. Assuming, $\sigma$ is random, the joint density of $X$ and $\sigma$ should be a function of two variables and the expectation calculated would be a double integral. And once you begin to use the probability densities, any dependence on the change in the original random variable is no longer going to be meaningful since dummy variables are being used. If $\sigma$ is deterministic then you can hold it constant for calculating the expectation, then take the derivative of the resulting integral as in the link above. – Slade Apr 14 at 17:29
• No, $\sigma$ is not random, it's a parameter. It gives rise to a family of random variables $X_\sigma$. Then, for $h$ given, One gets a mapping $\sigma \mapsto \mathbb{E}\left[h(X_\sigma,\sigma)\right]$. The question I asked is : is the derivative of this mapping given by $\mathbb{E}\left[\frac{\partial h(X_\sigma,\sigma)}{\partial \sigma}\right]$ – Aguelmame Apr 14 at 17:37

Taking the simple case $$h(X,\sigma)= X$$ ( thus no explicit dependence on $$\sigma$$, the RHS is immediately zero. The LHS is not zero if the expectation of $$X$$ depends on $$\sigma$$, which it easily could. For example , $$\ln(X)$$ is normal($$\mu, \sigma$$)gives an expected value of $$\mu + 1/2 \sigma^2$$. So I agree that the statement seems false in general.