# Derivative of conditional expectation

Let $\left( {{X_t}:t \in \left[ 0 \right.\left. {, + \infty } \right\rangle } \right)$ be a continuous time Markov chain on a probability space $\left( {\Omega ,\mathcal{F},\mathbb{P}} \right)$ with a finite state space $S$, defined by jump chain/holding times definition. Suppose $A,B \in \sigma \left( {{X_0}} \right)$ and $f\left( t \right) = \mathbb{E}\left[ {\mathbb{P}\left( {A|{X_t}} \right)|B} \right]$ is a decreasing function. Suppose I want to calculate $f'\left( t \right)$. We can assume that $f'\left( t \right)$ is always finite.

There are two ways to go about this, and the other one is probably wrong, but I want to know why.

1) Since $S$ is finite,

$\mathbb{E}\left[ {\mathbb{P}\left( {A|{X_t}} \right)|B} \right] = \sum\limits_{x \in S} {\mathbb{P}\left( {A|{X_t} = x} \right)\mathbb{P}\left( {{X_t} = x|B} \right)} \Rightarrow f'\left( t \right) = \sum\limits_{x \in S} {\frac{d}{{dt}}\left( {\mathbb{P}\left( {A|{X_t} = x} \right)\mathbb{P}\left( {{X_t} = x|B} \right)} \right)}$.

2) Since ${f'}$ is finite, $\frac{d}{{dt}}\mathbb{E}\left[ {\mathbb{P}\left( {A|{X_t}} \right)|B} \right]$ is finite so $\frac{d}{{dt}}\mathbb{P}\left( {A|{X_t}} \right)$ is finite $\mathbb{P}\left( { \cdot |B} \right)$-almost surely. Lebesgue dominated convergence theorem then implies $f'\left( t \right) = \mathbb{E}\left[ {\frac{d}{{dt}}\mathbb{P}\left( {A|{X_t}} \right)|B} \right] = \sum\limits_{x \in S} {\frac{d}{{dt}}\left( {\mathbb{P}\left( {A|{X_t} = x} \right)} \right)\mathbb{P}\left( {{X_t} = x|B} \right)}$.

Suppose 1) and 2) are both true. That would imply $\sum\limits_{x \in S} {\mathbb{P}\left( {A|{X_t} = x} \right)\frac{d}{{dt}}\left( {\mathbb{P}\left( {{X_t} = x|B} \right)} \right)} = 0$, which I have strong reasons to believe is wrong.

Suppose that my line of reasoning is wrong when I conclude that differentiation and expectation commute. Does 2) hold when they do commute? Under what (usual) applicable assumptions do they commute?

EDIT: The following holds for a discrete random variable $X$: $\mathbb{E}\left[ {g\left( X \right)} \right] = \sum\limits_x {g\left( x \right)\mathbb{P}\left( {g\left( X \right) = g\left( x \right)} \right)} = \sum\limits_x {g\left( x \right)\mathbb{P}\left( {X = x} \right)}$, where the first equality follows from definition, and the second is the law of unconscious statistician.

Let $g\left( x \right) = \frac{d}{{dt}}\mathbb{P}\left( {A|{X^{\left( t \right)}} = x} \right)$, then $\mathbb{E}\left[ {\frac{d}{{dt}}\mathbb{P}\left( {A|{X^{\left( t \right)}}} \right)|B} \right] = \mathbb{E}\left[ {g\left( {{X^{\left( t \right)}}} \right)|B} \right] = \sum\limits_x {g\left( x \right)\mathbb{P}\left( {{X^{\left( t \right)}} = x|B} \right)} = \sum\limits_x {\left( {\frac{d}{{dt}}\mathbb{P}\left( {A|{X^{\left( t \right)}} = x} \right)} \right)\mathbb{P}\left( {{X^{\left( t \right)}} = x|B} \right)}$.

• Your 2. is wrong. How would you justify the second = sign when computing $f'(t)$? – Did Nov 7 '14 at 9:17
• $\sum\limits_{y = g\left( x \right)} {y\mathbb{P}\left( {g\left( X \right) = y} \right)} = \sum\limits_x {g\left( x \right)\mathbb{P}\left( {X = x} \right)}$ – Alen Nov 7 '14 at 9:23
• ?? Please be much more specific (and I am sorry but the formula in your comment is not true). – Did Nov 7 '14 at 9:24
• To begin with, the LHS depends on $x$ while the RHS does not. Anyway this identity, even once corrected, does not obviously provide your 2., does it? – Did Nov 7 '14 at 15:55
• You might be using $$\sum_{y=g(x)}A(y)$$ with in mind something different from what it actually means. (Point already explained.) Hence you should explain what you mean by this notation. (As already said.) Let me add that I have no incentive to force you to see the light if your main concern is to stonewall the approach (2.) against criticisms, although (2.) is at present squarely wrong. – Did Nov 7 '14 at 16:51

The equality $$\mathbb{E}\left[ {\frac{d} {{dt}}\mathbb{P}\left( {A|{X_t}} \right)|B} \right] = \sum\limits_{x \in S} {\mathbb{P}\left( {{X_t} = x|B} \right)\frac{d} {{dt}}\mathbb{P}\left( {A|{X_t} = x} \right)}$$ is wrong since $$\mathbb{P}\left( {A|{X_t}} \right) = \sum\limits_{x \in S} {\mathbb{P}\left( {A|{X_t} = x} \right){1_{\left\{ {{X_t} = x} \right\}}}}$$ so $$\frac{d} {{dt}}\mathbb{P}\left( {A|{X_t}} \right) = \sum\limits_{x \in S} {\frac{d} {{dt}}\left( {\mathbb{P}\left( {A|{X_t} = x} \right){1_{\left\{ {{X_t} = x} \right\}}}} \right)}$$
The random variable ${{1_{\left\{ {{X_t} = x} \right\}}}}$ also depends on $t$, which I've accidentally ignored.