Conditional Expectation of a Poisson Variable on an Exponential Variable The question is as follows: 
Consider two independent Poisson processes $N^{(1)}(t), t\geq 0$ and 
$N^{(2)}(t), t\geq 0$.
Let $T = \inf\{t:N_t^{(1)} > 0\}$ be the time of the first point in the process, and let $X = N^{(2)}(T^{(1)}_1)$ be the number of points in the second process that occur before the first point in the first process. What are $\mathbb{E}(X\mid T)$ and $\mathbb{E}(X^2\mid T)$?
The definition of condition expectation is that for random variables $X, Y$, $\mathbb{E}(X\mid Y)$ is a $\sigma(Y)$-measurable random variable with 
$$\int_G\mathbb{E}(X\mid Y) \, d\mathbb{P} = \int_G X \, d\mathbb{P} \quad \text{for all } G \in \sigma (Y)$$
Regarding the problem, it is clear that given $T = t$, $X \sim \operatorname{Poisson}(t\lambda)$, where $\lambda$ is the rate of the second process, which means we that expectation and variance are both $t\lambda$ and the desired conditional expectations follow. 
However, these are numbers, not random variables, so I this isn't actually a solution. 
When we are conditioning on a discrete random variable, the approach above suffices, because the $\sigma$-algebra $\sigma (Y)$ is a countable union of preimages, so we have the countable series $\mathbb{E}(X\mid Y) = \sum_y \mathbb{E}(X\mid Y = y)\mathbb{1}_{Y = y}$, and then considering each $\omega \in \Omega$ the result follows. 
However, $T$ in the question is a continuous random variable, so in particular its support is uncountable, so this trick does not work.
I really have no idea how to proceed beyond this, and any help would be much appreciated. 
 A: Let $\lambda_i$ be the rate of the $i$th process, for $i=1,2.$
Note that
$$
\Pr(X=x\mid T=t) = \frac{(\lambda_2 t)^x e^{-\lambda_2 t}}{x!}.
$$
Therefore
$$
\Pr(X=x\mid T) = \frac{(\lambda_2 T)^x e^{-\lambda_2 T}}{x!}.
$$
That is a random variable that is a function of the random variable $T$.
That answers the question as stated, unless further discussion of the justification is needed.
And
$$
\Pr(T>t) = e^{-\lambda_1 t} \text{ for all } t\ge0,
$$
so by differentiation we have
$$
f_T(t) \, dt = e^{-\lambda_1 t} (\lambda_1\, dt) \quad \text{for } t>0.
$$
And then....
\begin{align}
& \Pr(X=x) \\
= {} & \operatorname E(\Pr(X=x\mid T)) = \operatorname E\left( \frac{(\lambda_2 T)^x e^{-\lambda_2 T}}{x!} \right) \\[8pt]
= {} & \int_0^\infty  \frac{(\lambda_2 t)^x e^{-\lambda_2 t}}{x!} e^{-\lambda_1 t} (\lambda_1 \, dt) \\[8pt]
= {} & \frac 1 {x!} \int_0^\infty (\lambda_2 t)^x e^{-(\lambda_1+\lambda_2)t} (\lambda_1\,dt) \\[8pt]
= {} & \frac{\lambda_2^x \lambda_1}{x!} \cdot \frac1{(\lambda_1+\lambda_2)^{x+1}} \int_0^\infty ((\lambda_1+\lambda_2)t)^x e^{-(\lambda_1+\lambda_2)t} ((\lambda_1+\lambda_2)\, dt) \\[8pt]
= {} & \frac{\lambda_2^x \lambda_1}{x!} \cdot \frac1{(\lambda_1+\lambda_2)^{x+1}} \cdot x! \\[8pt]
= {} & \left( \frac{\lambda_2}{\lambda_1+\lambda_2} \right)^x \cdot \frac{\lambda_1}{\lambda_1+\lambda_2} \text{ for } x\in \{0,1,2,3,\ldots\}.
\end{align}
This is a geometric distribution.
A: In applied problems like these, I think a general rule of thumb is that you don't want to think about the measure theoretic foundations unless otherwise prompted. That said, since you're thinking more rigorously, I'll make some notational changes that might clarify what's going on behind the scenes. (This is not what you should do in practice, when it's just easier to fudge notation like the rest of us.) Let $Z$ be a random variable on the probability space $(\Omega, \mathcal{F}, P)$. For the sake of exposition, suppose $Z$ is absolutely continuous with respect to $P$, so that there is a density function $\zeta : \Omega \to \mathbb{R}$ such that expectation against $Z$ can be written as $\int_\Omega E[f(Z)] = f(\omega) \zeta(\omega) \ P(d\omega)$. As a shorthand, we will write expectation against $Z$ as $E_Z[\:\cdot\:]$ as an operator on functions. This will suffice for our uses.
First, let's address some basic points. The interarrival times of a Poisson Process with rate $\lambda$ are i.i.d. exponential. Therefore $T \sim \mathsf{Exponential}(\lambda)$, since $T$ is simply the length of the first interarrival time. We should note that $E_T[t \mapsto t] = \lambda^{-1}$.
Next, for a given $t > 0$, we know that $E[N^{(2)}(t)] = \lambda t$, since $N^{(2)}(t) \sim \mathsf{Poisson}(\lambda t)$.
To compute $E[X | T]$, I recommend the "double expectation" trick. Can we compute $E[X | T=t]$? Of course, since that is just $E[N^{(2)}(t)] = \lambda t$. So, using the double expectation identity $E_T[N^{(2)}(T)] = E_T[t \mapsto E[N^{(2)}(t)]]$, we can evaluate
\begin{align}
E_T[t \mapsto E[N^{(2)}(T)|T=t]] &= E_T[t \mapsto E[N^{(2)}(t)]] \\
&= E_T[t \mapsto \lambda t] \\
&= \lambda E_T[t \mapsto t] \\
&= \lambda \cdot \lambda^{-1} \\
&= 1.
\end{align}
Similarly,
\begin{align}
E_T[t \mapsto E[(N^{(2)}(T))^2|T=t]] &= E_T[t \mapsto (E[N^{(2)}(t))^2]] \\
&= E_T[t \mapsto \lambda t(1+\lambda t)] \\
&= \lambda E_T[t \mapsto t+\lambda t^2] \\
&= \lambda \cdot \int_0^\infty (t + \lambda t^2) \cdot \lambda \exp(-\lambda t) \ dt \\
&= 3.
\end{align}
Like I said, with practical problems it's best to play a bit fast-and-loose with notation. Usually "notationally correct" just gets in the way.
