Q:

Barrier Derivative Pricing

Assume constant interest rate $r$ and a stock with current price at $S_0$ that pays no dividend (assume $S_t\ge0$). When the stock price hits the barrier $B$ (where $B<S_0$) you receive \$$1$ and the derivative would terminate. This derivative doesn't have a maturity date. $S_t$ follows geometric Brownian motion with constant volatility $\sigma$.
What is the present value of this derivative?

A:

As is often the case, there are generally two solution strategies here.

(Probabilistic) You explicitly solve for the expected discount factor at the first passage time $\nu$ of $S$ to the level $B$ under the risk-neutral probability measure $\mathbb{P}^*$, i.e.
\begin{equation}
V_0 = \mathbb{E}_{\mathbb{P}^*} \left[ e^{-r \nu} \right].
\end{equation}
(Differential Equation) The option value $V$ satisfies the ODE
\begin{equation}
\frac{1}{2} \sigma^2 S^2 \frac{\mathrm{d} V^2}{\mathrm{d} S^2} + r S \frac{\mathrm{d} V}{\mathrm{d} S} - r V = 0
\end{equation}
subject to the contract-specific boundary conditions.

I will outline the second approach here and refer to e.g. Chapter 9 in Wilmott (2006) for further details. See e.g. this blog post for a solution to the finite-maturity American digital call option valuation problem using the first approach. In order to obtain the solution for the perpetual case, simply take the limit $T \rightarrow \infty$. The solution to the put is fully analogous.
ODE Approach
The ODE can be rearranged to
\begin{equation}
S^2 \frac{\mathrm{d} V^2}{\mathrm{d} S^2} + \lambda S \frac{\mathrm{d} V}{\mathrm{d} S} - \lambda V = 0,
\end{equation}
where $\lambda = 2r / \sigma^2$. This equation is of the Euler-Cauchy type and we thus try the solution
\begin{equation}
V(S) = S^\beta
\end{equation}
and get
\begin{equation}
\beta (\beta - 1) S^\beta + \beta \lambda S^\beta - \lambda S^\beta = 0.
\end{equation}
This equation holds for all values of $S$ if
\begin{equation}
\beta^2 + \beta (\lambda - 1) - \lambda = 0.
\end{equation}
Solving for $\beta$ yields
\begin{equation}
\beta_\pm = \frac{1}{\sigma^2} \left( -\left( r - \frac{1}{2} \sigma^2 \right) \pm \left( r + \frac{1}{2} \sigma^2 \right) \right)
\end{equation}
and we notice that $\beta_+ = 1$ and $\beta_- = -\lambda$. The general solution to the ODE is given by
\begin{equation}
V(S) = c_- S^{-\lambda} + c_+ S,
\end{equation}
where $c_\pm$ depend on the boundary conditions of the contract. In case of a put option we have the upper boundary condition $\lim_{S \rightarrow \infty} V(S) = 0$, which implied that $c_+ = 0$. The value matching condition at the lower boundary is $U(B) = 1$ and we thus obtain $c_- = B^\lambda$. Consequently,
\begin{equation}
V(S) = \left( \frac{S}{B} \right)^{-\lambda}.
\end{equation}
References
Wilmott, Paul (2006) Paul Wilmott on Quantitative Finance, Vol. 1: Wiley, 2nd edition.

