Deriving an equation and boundary condition from an SDE 
Let $\dot{X_{t}} = b(X_{t}) + \sigma(X_{t})\dot{W_{t}}$ be a
  stochastic differential equation, where $W_{t}$ is a Wiener process.
  Also, let $X_{0} = x \in \mathbb{R}$.
Define $$u(x) = \mathbb{E}_{x} \int_{0}^{\tau} f(X_{s}) \mathop{ds},$$
where $\tau = \min\{t \mid X_{t} \not \in G\},$ where $G = (M, N)
\subseteq \mathbb{R}$. 
Derive an equation and boundary conditions for $u(x)$

There is a similar problem provided here on problem #6 (iii): http://math.stanford.edu/~ryzhik/STANFORD/STANF227-10/hwk3-10.pdf.
The solution is here: http://math.stanford.edu/~ryzhik/STANFORD/STANF227-10/hwk3-sol.pdf. 
However, I do not fully understand everything that they are doing. I learned about a differential operator $L$, and I believe that there is a way to solve this problem using that differential operator $L$. I was wondering if someone can please help me do this. 
From my understanding, my stochastic differential equation will become something like $Lu(x) = -f(x)$ with boundary condition $u(M) = u(N) = 0$. 
Then I think I would need to apply Ito's Lemma from there; however I do not really know how to do this, since I am new to stochastic processes.
 A: Solution for a more specific $b(x)$ and $\sigma(x)$ is given in the provided links. The idea is to assume a non-random function $u(x)$ of the stochastic process on which stopping criteria is applied and write down the dynamic of the function using Ito's lemma. Next step is to identify ODE/PDE for the problem which will lead to your desired result.
To put this into equations, let $v(x)$ be the non-random function of the stochastic process $X_t$ on which the stopping criteria is being applied. Then using Ito's lemma, 
\begin{equation}
dv = v_xdX_t + \frac{1}{2} v_{xx}d[X,X]_t \\
= v_x\left( b(X_t)dt+σ(X_t)dW_t \right) + \frac{1}{2}v_{xx}\sigma(X_t)^2 dt \\
= (v_x b(X_t) + \frac{1}{2}v_{xx}\sigma(X_t)^2)dt + v_xσ(X_t)dW_t
\end{equation}
At this stage we integrate the above SDE between $t=0$ and $t=\tau$ where $\tau$ is the stopping time. 
\begin{equation}
v(X(\tau)) - v(X(0)) = \int_0^{\tau}\left(v_x b(X_t) + \frac{1}{2}v_{xx}\sigma(X_t)^2\right)dt + \int_0^{\tau}v_xσ(X_t)dW_t
\end{equation}
Here we decide on boundary conditions and ODE satisfied by the function $v(x)$. Now $X(\tau)$ is either $M$ or $N$ which is the boundary of $G$, and the expression inside the integral that we are looking for is $f(X_t)$. Thus we choose boundary conditions on $v(x)$ as $v(M)= v(N) = 0$ and ODE to be following, 
\begin{equation}
v_x(x)b(x) + \frac{1}{2}v_{xx}(x)\sigma(x)^2 = -f(x)
\end{equation}
We get, 
\begin{equation}
\int_0^{\tau}f(X_t)dt = v(X(0)) + \int_0^{\tau}v_xσ(X_t)dW_t
\end{equation}
Under the assumption that the Ito integral has finite variance and stopping time is finite a.s., we can take expectation on both sides and get
\begin{equation}
u(x) = \mathbb{E}\int_0^{\tau}f(X_t)dt = v(X(0))
\end{equation}
Which shows that the function $u(x)$ can be chosen identical as function $v(x)$ and we will simply replace $v(x)$ by $u(x)$ in the ODE and boundary condition and we would have our results.
Other variants I have seen and also shown in the document shared in the question involved finding $\mathbb{E}(\tau)$ or $\mathbb{P}(X_{\tau} = M)$, etc. which can be solved with appropriate choice of ODE and boundary conditions.
