Brownian Motion Hitting Time A grocer receives revenue at rate $q$ and pays refunds at rate $r$. Let $u=q-r$ and $u>0$. Let the grocer's cash position at time $t$ be given by: $X_t=x_0+\mu t + \sigma B_t$ where $B_t$ is Brownian motion, constants $\sigma,x_0 >0 $ and $x_0$ is the grocer's starting cash balance.
Let $X_{\tau}$ be the time the grocer's cash balance reaches $0$. What is the probability of reaching $0$? What is $E[\tau]$?

The grocer's cash position can be modeled as Brownian motion with drift coefficient $\mu$. This reminds me of the gambler's ruin problem, but with drift. How can we find the hitting time of the zero cash balance?
 A: We write $Y_t = X_t - x_0$, so that $Y_t \sim N(\mu  t, \sigma^2t)$ and $Y_0 = 0$. Then, by properties of Brownian motion,
\begin{equation}
M_t = \exp\left(\lambda Y_t - \left(\frac{\lambda^2 \sigma^2}{2}+\lambda \mu\right)t\right)
\end{equation}
is a continuous martingale for any $\lambda$. Letting $\lambda = -2\mu/\sigma^2$, we are only left with the term with $Y_t$ in the exponent. Moreover,  we define for $a>0$ the stopping time: $\tau = \inf\{ t \geq 0:Y_t \geq a \text{ or } Y_t \leq -x_0\}$ (this is a stopping time as a hitting time of a closed set by a continuous stochastic process). Then $M_{t \wedge  \tau}$ is a bounded martingale, hence is uniformly integrable, and we may apply the optional stopping theorem. In particular:
\begin{equation}
\mathbb{E}[M_\tau]  = \mathbb{E}[M_0]=1.
\end{equation}
So letting $p$ be the probability that $Y_{\tau}=-x_0$, by the  law of total expectation we deduce
\begin{equation}
pe^{\frac{2 \mu  x_0}{\sigma^2}}+(1-p)e^{-\frac{2 \mu a}{\sigma^2}} =1.
\end{equation}
Rearranging and letting $a \to \infty$, $p=e^{-\frac{2 \mu  x_0}{\sigma^2}}$ is the required probability of going bankrupt. Since for $x_0 > 0$ there is a strictly positive probability of never going bankrupt, the  expected time until bankruptcy is infinite.  
The result corresponds well to  our intuition of what should happen. The larger our $x_0$, the lower our probability of ever hitting zero because we're already rich. A big upward trend of $\mu$ due to an influx of earnings  also contributes to the same effect, whereas larger oscillations help attain more extreme values, increasing the likelihood of the process hitting zero.
