= Solution
Let $\rho=t\wedge\tau_0\wedge\tau_1$ and apply the <Itô formula> to $u(t-s,B_s)$ for $0\leq s\leq\rho$. The <heat equation> cancels the drift, so the stopped process is a bounded <martingale>. The <optional sampling theorem for a supermartingale> gives $u(t,x)=\mathbb E_x[u(t-\rho,B_\rho)]$. On the three mutually exclusive terminal events, the initial and <Dirichlet boundary conditions> identify this value as
$$
u(t,x)=\mathbb E_x\!\left[g(B_t)\mathbf1_{\{t<\tau_0\wedge\tau_1\}}+f_1(t-\tau_0)\mathbf1_{\{\tau_0<t\wedge\tau_1\}}+f_2(t-\tau_1)\mathbf1_{\{\tau_1<t\wedge\tau_0\}}\right].
$$
This is the <probabilistic representation of the heat equation with time-dependent Dirichlet data>.
Back to article page