I'm reading on Dynkin's formula. Given a stationary diffusion process $X(t)$ in the form $$dX(t) = \mu(X(t))dt +\sigma(X(t))dW$$ , as a generalization of the 2nd fundamental theorem of Calculus $F(b)-F(a)=\int_a^b f(x)dx$, we have Dynkin's formula $$\mathbb E^{X(t)=x}f(X(T))=f(x) + \mathbb E^{X(t)=x} \int_t^T \mathscr Lf(X(s)) ds$$ , where $\mathscr L$ is the infinitesimal generator of $X(t)$, ie $\mathscr L = \mu \frac{\partial}{\partial x} + \frac12 \sigma^2 \frac{\partial^2}{\partial x^2}$.
So far so good.
But then I came into this A celebration of Dynkin’s formula slides of Prof. Tommi Sottinen. It gives an application of Dynkin's formula, which got me totally lost --
Consider the 2nd order ordinary differential equations (ODE) on $u(x)$: $$\mu(x)u'(x)+\frac12 \sigma^2(x) u''(x) = 0, \qquad x\in (a,b)\subset \mathbb R$$ with boundary conditions $u(a)$ and $u(b)$. Let $X$ be the Ito diffusion $$dX=\mu(X) dt+\sigma(X) dW$$ It follows from the Dynkin's formula that $$u(x)=\mathbb E^x u(X(\tau))$$ , where $\tau$ is the first exit time of $X$ from the interval $(a,b)$.
I really couldn't understand this SDE->ODE convertion. Why does it work?
So far my trying to understand it is --
The ODE $\mu(x)u'(x)+\frac12 \sigma^2(x) u''(x) = 0$ is just $$\mathscr Lu(x)=0$$ Substitue with $u(x)=\mathbb E^x u(X(\tau))$ we get $$\mathscr L \mathbb E^x u(X(t)) = 0$$ , which is equivalent to $$\mathbb E^x \mathscr L u(X(t)) = 0$$ , which means $\mathscr Lu(X(t))$ is a martingale.
But how can this be derived from Dynkin's formula?