$M_t = f(B_{t \wedge \tau}) + (t \wedge \tau)$ local martingale, $\textbf{E}^x[\tau] = f(x)?$ Suppose $D \subset \mathbb{R}^d$ is a domain and $f: \overline{D} \to \mathbb{R}$ is a continuous function, $C^2$ in $D$, satisfying$$f(x) = 0\text{ for }x\in \partial D,$$$${1\over2} \Delta f(x) = -1 \text{ for }x \in D.$$Let $B_t$ be standard $d$-dimensional Brownian motion and let $\tau = \text{inf}\{t \ge 0 : B_t \notin D\}.$ I have two questions.


*

*Is$$M_t = f(B_{t \wedge \tau}) + (t \wedge \tau)$$a local martingale?

*If $x \in D$, do we have$$\textbf{E}^x[\tau] = f(x)?$$

 A: Itô's formula asserts that $Y_t = f(B_t) + t$ is a (continuous) local martingale.  Let $\tau_n = \inf\{t : |Y_t| \ge n\}$; then $\tau_n \uparrow \infty$ and $Y_{t \wedge \tau_n}$ are bounded martingales.  Then for each $n$, $M_{t \wedge \tau_n} = Y_{(t \wedge \tau) \wedge \tau_n}$ is a bounded martingale too.  So $M_t$ is a local martingale.
You didn't say $D$ had to be bounded, so take $D = \mathbb{R}^d$, so  that $\partial D = \emptyset$ and $\tau = \infty$, so $E^0 \tau = \infty$. Set $f(x) = -\frac{1}{d} |x|^2$; then $\frac{1}{2}\Delta f = -1$ and $f(0) = 0 \ne \infty$.
If $D$ is bounded then the second claim is true.  In this case $f$ is also bounded so $M_t$ is a martingale.  Thus $$f(x) = E^x M_0 = E^x M_t = E^x f(B_{t \wedge \tau}) + E^x [ t \wedge \tau].$$
Since the Brownian motion will eventually exit $D$ with probability 1, we have $\tau < \infty$ almost surely, so as $t \to \infty$ we have $f(B_{t \wedge \tau}) \to f(B_{\tau}) = 0$ almost surely.  Since $f$ is bounded, by dominated convergence, $E^x f(B_{t \wedge \tau}) \to 0$.  And by monotone convergence, $E^x[\tau \wedge t] \to E^x \tau$.
