# Expected time spent in the set

An exercise 2.14 from Bernt Øksendal's "Stochastic Differential Equations":

Let $B_t$ be $n$-dimensional Brownian motion and let $K\subset \mathbb R^n$ have zero $n$-dimensional Lebesgue measure. Prove that the expected total length of time that $B_t$ spends in $K$ is zero.

My confusion comes from the fact that the I don't know how to define "total length of time" which the process $B_t$ spends in $K$ in a formal way. I was thinking to use $$T(\omega) = \int\limits_0^\infty 1\{B_t(\omega)\in K\}\;\mathrm dt \quad (1)$$ so finding $\mathsf E T$ can be reduced to $$\mathsf E T = \int\limits_0^\infty\mathsf P\{B_t\in K\}\;\mathrm dt$$ and checking conditions for Fubini's theorem - but I am not sure that the formula $(1)$ is correct (at least in the sense that the integral is well-defined), and I wonder how such formula should be rigorously derived to describe "total time spent in the set $K$".

Edited: A related article on wikipedia misses formality.

-
@ Ilya : Expression (1) seems to perfectly make sense to me as long as you can show for fixed $\omega$ the measurability of $f(t)(\omega)=1\{B_t\in K\}(\omega)$ with respect to the completed Borel Sigma algebra with respect to Lebesgue measure over $\mathbb{R}^n$. Actually, joint measurability is what you really need to allow you to use Fubini's theorem as the function is positive and bounded. Best regards –  TheBridge Feb 22 '12 at 13:18
@TheBridge: I expected the joint measurability :) Thanks for the comment, I saw formula $(1)$ in a couple of places like Wiki article I linked and some books - but never a rigorous treatment of this notion. –  Ilya Feb 22 '12 at 13:24
@ Ilya : Btw at fixed $\omega$ the $\mathcal{B}(\mathbb{R}^+)$-mesurability of the set $B_.^{-1}(K)=\{t\in \mathbb{R}^+ s.t. B_t\in K\}$ is given by the continuity of $B_.$ (continuity entails $(\mathcal{B}(\mathbb{R}^+),\mathcal{B}(\mathbb{R}^n))$-measurability). This doesn't show the joint measurability needed for Fubini in the second part of your question, but this assures that your expression makes sense on an $\omega$ by $\omega$ basis. –  TheBridge Feb 24 '12 at 17:16