I'm studying the following paper on Hull-White model calibration: Hull-White paper
In this paper they study the general form of the HW model with time-dependent mean reversion and volatility: $$dr(t) = (\theta(t) - a(t)r(t))dt + \sigma(t)dW(t)$$ I am trying to prove their formula for the solution $\theta(t)$ which matches a prescribed discount rate at each maturity (on p. 36 of the paper). I have not seen this function derived under such generality.
The solution in the paper is as follows: $$\theta(t) = \frac{\partial}{\partial t} f(0,t) + a(t) f(0,t) + \frac{1}{2} \left(\frac{\partial^2}{\partial t^2} V(0,t) + a(t) \frac{\partial}{\partial t} V(0,t) \right)$$ Where: $$f(0,t) = \text{ instantaneous forward rate at time } t$$ $$V(t,T) = \int_t^T \sigma(u,T)^2 du$$ $$\sigma(u,T) = \sigma(u)B(u,T)$$ $$B(t,T) = E(t) \int_t^T \frac{du}{E(u)}$$ $$E(t) = e^{\int_0^t a(u) du}$$ I imagine one can follow a similar method done in simpler versions of the model and:
Compute $r(t)$ via integration
Compute the bond prices
Take derivative of log of the bond price to compute the forward price
Somehow isolate $\theta(t)$ after possibly taking another derivative of the previous equation?
Update: Here is what I got so far. Apply Itô's Lemma to the function: $$F(r(t), t) = E(t) r(t)$$ We get: $$F_t = a(t) E(t) r(t) \hspace{10pt} F_r = E(t) \hspace{10pt} F_{rr} = 0$$ Resulting in: $$\begin{align*} dF(t) &= F_t dt + F_r dr \\ &= E(t)\theta(t)dt + E(t)\sigma(t)dW(t) \end{align*}$$ Integrating from $t$ to $s$ one gets: $$\begin{align*} F(s) - F(t) &= \int_t^s E(u)\theta(u)du + \int_t^s E(u)\sigma(u)dW(u) \\ E(s)r(s) &= E(t)r(t) + \int_t^s E(u)\theta(u)du + \int_t^s E(u)\sigma(u)dW(u) \\ r(s) &= \frac{E(t)}{E(s)}r(t) + \frac{1}{E(s)}\int_t^s E(u)\theta(u)du + \frac{1}{E(s)}\int_t^s E(u)\sigma(u)dW(u) \end{align*}$$ We now compute the bond prices by integrating this short rate from $t$ to $T$ and applying the definition of the bond price. First we integrate and make use of Fubini's theorem: $$\begin{align*} \int_t^T r(s) ds &= \int_t^T \frac{E(t)}{E(s)}r(t) ds + \int_t^T \int_t^s \frac{E(u)}{E(s)}\theta(u) du ds + \int_t^T \int_t^s \frac{E(u)}{E(s)}\sigma(u) dW(u) ds \\ &= \int_t^T \frac{E(t)}{E(s)}r(t) ds + \int_t^T \int_u^T \frac{E(u)}{E(s)}\theta(u) ds du + \int_t^T \int_u^T \frac{E(u)}{E(s)}\sigma(u) ds dW(u) \\ &= r(t)\underbrace{E(t) \int_t^T \frac{1}{E(s)} ds}_{B(t,T)} + \int_t^T \theta(u) \underbrace{E(u) \int_u^T \frac{1}{E(s)} ds}_{B(u,T)} du + \int_t^T \sigma(u) \underbrace{E(u) \int_u^T \frac{1}{E(s)} ds}_{B(u,T)} dW(u) \\ &= r(t) B(t,T) + \int_t^T \theta(u) B(u,T) du + \int_t^T \sigma(u) B(u,T) dW(u) \end{align*}$$ Now we can compute the bond prices via: $$\begin{align*} P(t,T) &= \mathbb{E}_t \left[e^{-\int_t^T r(s) ds} \right] \\ &= e^{-r(t)B(t,T) - \int_t^T\theta(u)B(u,T)du} \mathbb{E}_t \left[ e^{-\int_t^T \sigma(u) B(u,T) dW(u)} \right] \\ &= e^{-r(t)B(t,T) - \int_t^T\theta(u)B(u,T)du} e^{\frac{1}{2} \int_t^T \sigma(u)^2 B(u,T)^2 du} \end{align*}$$ Here we used that $r(t)$ is known at $t$ and the formula for the expectation for a lognormal variable. We can now take a log and derivative to produce a formula for the instantaneous forward rate: $$\begin{align*} f(0,T) &= - \frac{\partial}{\partial T} \ln P(0,T) \\ &= \frac{\partial}{\partial T} \left[ r(0) B(0,T) + \int_0^T \theta(u) B(u,T) du - \frac{1}{2} \int_0^T \sigma(u)^2 B(u,T)^2 du \right] \end{align*}$$ Here we will use a couple properties of $B(t,T)$ which follow directly from its definition: $$\frac{\partial}{\partial T} B(t,T) = \frac{E(t)}{E(T)} \hspace{5pt} \text{ and } \hspace{5pt} B(T,T) = 0$$ $$\begin{align*} f(0,T) &= r(0) \frac{E(0)}{E(T)} + \int_0^T \theta(u) \frac{E(u)}{E(T)} du - \frac{1}{2} \int_0^T \sigma(u)^2 2B(u,T)\frac{E(u)}{E(T)} du \end{align*}$$ Taking one more derivative with respect to $T$ will result in two instances of $\theta(t)$ in the formula. I don't see a way to isolate this function by itself to recover the formula cited in the paper above.