Let $dX_t = rdt+dW_t$ with $r$ constant, and $X_0=x$. Let $\tau_a$ be the hitting time of $X_t$ hitting $a$ for $a>0$. I want to compute $P(\tau_a<\infty|X_0=x)$ where $x<a$ using PDE method.
Let $g(t,X_t)=E[1_{\{\tau_a<\infty\}}|X_t]$, then $g$ is a martingale due to tower property. By Ito's lemma, we have $$ dg(t,X_t)=g_tdt+g_x(rdt+dW_t)+\frac{1}{2}g_{xx}dt $$ Since $g_t=0$ and $g(t,X_t)=g(X_t)$ is a martingale, we have \begin{cases} rg_x+\frac{1}{2}g_{xx}=0\\ g(a)=1 \end{cases} Solve it I get $$ g(x)=-\frac{1}{2r}e^{-2rx}C_1+C_2 $$ where $C_1$ and $C_2$ are two constants.$g(a)=1$ gives $C_1=2r(C_2-1)e^{2ra}$, so $$ g(x)=(1-C_2)e^{-2r(x-a)}+C_2 $$ I have trouble determining $C_2$. Assume I already know the fact that, if $r>0$, $g(x)=1$, it gives me $C_2=1$ which seems very correct. But how about the case $r<0$? And, what if I do not know that fact, how to determine $C_2$? Thank you for any help!