> [!tldr]
> An (European) **barrier option**, in addition to the usual (European) options structure, has a barrier $B$ that waits for the underlying price $S_{t}$ to hit it.
>
> A **down-and-out** option becomes worthless if $S_{t}$ hits (or dips below) $B$. An **up-and-in** option remains worthless until $S_{t}$ hits (or goes above) $B$.
>
> **Up-and-out** and **down-and-in** options are similarly defined.
Assuming $S_{t}$ is a [[Geometric Brownian Motion]] like the Black-Scholes model, barrier option of price $V(S,t)$ still satisfies the [[Black-Scholes Equation]] $V_{t}+rSV_{S}+\frac{\sigma^{2}S^{2}}{2}V_{SS}-rV=0,$but in additional to the boundary conditions of the European option, it also satisfies $\forall t \le T,~V(B, t)=0.$
## Pricing Barrier Options
One important result for pricing barrier options is that
> [!lemma|*]
> If $U(S,t)$ solves the Black Scholes PDE, so does $\hat{U}(S,t) := \left( \frac{S}{B} \right)^{2\alpha}U\left( \frac{B^{2}}{S};t \right),~ ~ 2\alpha=1-\frac{2(r-D)}{\sigma^{2}},$where any other parameter (e.g. strike) is inherited.
>
> Importantly, *$U-\hat{U}$ is also a solution*.
It is easy to confirm that $U(B,t)=\hat{U}(B,t)$, so $V:= U-\hat{U} \text{ satisfies }V(B,t)=0 ~ ~\forall t \le T.$
Therefore, if $V$ also satisfies the payoff condition, then it is the unique solution to the Black Scholes PDE of the barrier option. *This reduces the pricing problem to choosing the appropriate $U$.*
In general, we consider $U$ that has the correct payoff $U(S,T)$, as usually $\hat{U}\propto U(B^{2} / S, t)$ is out-the-money when $U$ is in-the-money (hence summing them gives the correct payoff).
#### Case of Down-and-Out Calls
If $B < K$, then the payoff is of the form $
V(S,T;K)=(S-K)_{+},$i.e. that of the vanilla call itself; so we may choose $U(S,t)=C(S,t;K)$. It is easy to confirm that $V:= U-\hat{U}$ gives the same payoff ($\hat{U}=0$ whenever $S > B^{2} / K>B$, so always the case).
The harder case is $B > S_{t} > K$. The payoff is now $V(S,T;K)=\begin{cases}
S-K &\text{if }S>B; \\
0 & \text{otherwise.}
\end{cases}$
Using $C(S,t;K)$ as $U$ no longer gives the correct payoff. Instead, we can replicate this with $U(S,t):= C(S,t;B)+(B-K)D(S,t;B),$where $D$ is the digital/binary option (i.e. $0 / 1$ payoff). Now we can confirm that $U-\hat{U}$ gives the correct payoff at $t=T$.