Conditional running maximum of Geometric Brownian Motion (maximum of Brownian Bridge) I would appreciate help proving a formula that I came across on page 774 of these lecture note slides on pricing barrier options :
https://www.csie.ntu.edu.tw/~lyuu/finance1/2015/20150520.pdf
Assume the stock price follows a Geometric Brownian Motion, i.e. $dS_t = \mu S_t dt + \sigma S_t dW_t$ for $t \in [0,T]$, and $W_t$ is a Brownian Motion (seeded at 0) under the measure $\mathbb{P}$. Let $H$ be a barrier satisfying $H > S(0)$ and $H > S(T)$. 
Then the formula i'm trying to prove is : 
$$\mathbb{P} \Big[ \max_{t \in [0,T]} S(t) < H \  | \ S(0) = S_0, S(T) = S_T \Big] = 1 - \exp \Big(-\frac{2\ln(H/S_0)\ln(H/S_T)}{\sigma^2 T} \Big).$$
Using the solution to the SDE, namely $S(t) = S_0 \exp((\mu - \sigma^2/2)t + \sigma W_t)$, we can rewrite this probability as 
$$\mathbb{P} \Big[ \max_{t \in [0,T]} W_t + \theta t < b \  | \ W_0 = 0, W_T + \theta T = a \Big] $$
$$ = \mathbb{E}^{\mathbb{P}} \Big[ \mathbb{1}_{ \{\max_{t \in [0,T]} W_t + \theta t < b \}}  | \ W_0 = 0, W_T + \theta T = a \Big],$$
where $\theta := \mu/\sigma -\sigma/2$, $b:= \ln(H/S_0)/\sigma$ and $a:= \ln(S_T/S_0)/\sigma$. My understanding is that under the measure $\mathbb{P}$, $W_t$ is a Brownian Motion, but $W_t + \theta t$ isn't. So what I would have done is to apply Girsanov's theorem. Setting $\tilde{W}_t := W_t + \theta t$, then we know that $\tilde{W}_t$ is a Brownian Motion (also seeded at 0) under $\tilde{\mathbb{P}}$, satisfying 
$$\frac{d\tilde{\mathbb{P}}}{d\mathbb{P}} = \exp(-\theta W_T -\theta^2 T /2) = \exp(-\theta \tilde{W}_T + \theta^2 T /2).$$
Then our calculation becomes equal to  
$$\mathbb{E}^{\mathbb{\tilde{P}}} \Big[ \frac{d\mathbb{P}}{d\tilde{\mathbb{P}}}  \mathbb{1}_{ \{\max_{t \in [0,T]} \tilde{W}_t < b \}}  | \ \tilde{W}_0 = 0, \tilde{W}_T = a \Big]$$
$$=\exp(\theta a - \theta^2 T /2) \mathbb{E}^{\mathbb{\tilde{P}}} \Big[ \mathbb{1}_{ \{\max_{t \in [0,T]} \tilde{W}_t < b \}}  | \ \tilde{W}_0 = 0, \tilde{W}_T = a \Big]$$
$$=\exp(\theta a - \theta^2 T /2) \mathbb{\tilde{P}} \Big[ \max_{t \in [0,T]} \tilde{W_t} < b \  | \ \tilde{W}_0 = 0, \tilde{W}_T = a \Big].$$ 
The latter probability is "well-known" as the probability of the running maximum of a Brownian Bridge. An online derivation is given in : https://eventuallyalmosteverywhere.wordpress.com/tag/brownian-bridge/
This probability is equal to
$$\mathbb{\tilde{P}} \Big[ \max_{t \in [0,T]} \tilde{W_t} < b \  | \ \tilde{W}_0 = 0, \tilde{W}_T = a \Big] = 1 - \exp \Big( \frac{a^2 - (2b-a)^2}{2T} \Big).$$
Plugging in the values of $a$ and $b$ we find that 
$$\mathbb{\tilde{P}} \Big[ \max_{t \in [0,T]} \tilde{W_t} < b \  | \ \tilde{W}_0 = 0, \tilde{W}_T = a \Big] = 1 - \exp \Big(-\frac{2\ln(H/S_0)\ln(H/S_T)}{\sigma^2 T} \Big) \ !!$$
But this is supposed to be the final answer to my problem, so it appears that the factor $\exp(\theta a - \theta^2 T /2)$ is not supposed to be there....
Any help will be greatly appreciated !
 A: You did not perform the change of measure correctly. You seem to believe that
$$\beta \tilde{\mathbb{P}} = \mathbb{P} \implies \mathbb{E}_{\tilde{\mathbb{P}}}(\beta X \mid A) = \mathbb{E}_{\mathbb{P}}(X  \mid A) \tag{1}$$
but this is actually wrong; if we choose, for instance, $X:=1$, then the right-hand side of $(1)$ equals $1$ but the left-hand side does not - this shows that there is something off. The correct formula reads
$$\beta \tilde{\mathbb{P}} = \mathbb{P} \implies \frac{\mathbb{E}_{\tilde{\mathbb{P}}}(\beta X \mid A)}{\mathbb{E}_{\tilde{\mathbb{P}}}(\beta \mid A)} = \mathbb{E}_{\mathbb{P}}(X  \mid A). \tag{2}$$
Using $(2)$ with $$\beta := \exp(\theta \tilde{W}_T - \theta^2 T/2)$$ we get
$$\mathbb{E}_{\mathbb{P}} \left( 1_{\{\max_{t \leq T} (W_t+\theta t) < b\}} \mid W_0 = 0, W_T+\theta T = a \right) = \frac{\mathbb{E}_{\tilde{\mathbb{P}}}(\beta 1_{\{\sup_{t \leq T} \tilde{W}_t<b\}} \mid \tilde{W}_0 = 0, \tilde{W}_T = a)}{\mathbb{E}_{\tilde{\mathbb{P}}}(\beta \mid \tilde{W}_0=0, \tilde{W}_T = a)},$$
and so, by the definition of $\beta$,
$$\mathbb{E}_{\mathbb{P}} \left( 1_{\{\max_{t \leq T} (W_t+\theta t) < b\}} \mid W_0 = 0, W_T+\theta T = a \right) = \mathbb{E}_{\tilde{\mathbb{P}}}(1_{\{\sup_{t \leq T} \tilde{W}_t<b\}} \mid \tilde{W}_0 = 0, \tilde{W}_T = a).$$
Now you can continue with your computations and you will get the correct result.
