## Vasicek model

We derive the Vasicek term structure model formulae.

### Alternative Derivation of Bond price formula

Now we present an alternative way of deriving the bond price formula. We assume that the price of a T-maturity zero coupon bond at time t given current rate of $$r_{t}$$ can be represented as:

$$P \left( t, T \right)= A \left( t, T \right) e^{ -r_{t} B \left(t, T \right) }$$ $$dP \left( t, T\right)= \frac {\partial P}{\partial t}dt + \frac {\partial P}{\partial r}dr + \frac{1}{2} \frac{\partial^2 P}{\partial r^2}{dr^2}$$

Now:

$$\frac {\partial P}{\partial t}= \frac {\partial }{\partial t} \left( A e^{ -r B}\right)=e^{ -r B}\frac {\partial A}{\partial t} + A e^{ -r B}\frac {\partial}{\partial t} \left( -r B \right)$$ $$= e^{ -r B}\frac {\partial A}{\partial t} -r A e^{ -r B}\frac {\partial B}{\partial t}=\frac{P}{A} \frac {\partial A}{\partial t} -r P\frac {\partial B}{\partial t}$$ $$\frac {\partial P}{\partial r}= \frac {\partial }{\partial r} \left( A e^{ -r B}\right)= A e^{ -r B}\frac {\partial}{\partial r} \left( -r B \right)=-P B$$ $$\frac {\partial^2 P}{\partial r^2}= \frac {\partial }{\partial r} \left( -P B\right)= -B\frac {\partial}{\partial r} \left( P \right)=P B^2$$

Thus:

$$dP \left( t, T\right)= \frac {\partial P}{\partial t}dt + \frac {\partial P}{\partial r}dr + \frac{1}{2} \frac{\partial^2 P}{\partial r^2}{dr^2}$$ $$dP \left( t, T\right)= \left( \frac{P}{A} \frac {\partial A}{\partial t} -r P\frac {\partial B}{\partial t} \right) dt + \left( -P B \right) dr + \frac{1}{2} \left( P B^2 \right) {dr^2}$$ $$\frac{dP}{P}= \left( \frac{1}{A} \frac {\partial A}{\partial t} -r \frac {\partial B}{\partial t} \right) dt - B dr + \frac{1}{2} B^2 {dr^2}$$ $$\frac{dP}{P}= \left(\frac{1}{A} \frac {\partial A}{\partial t} -r \frac {\partial B}{\partial t} \right) dt - B \left( \kappa \theta dt -\kappa r dt + \sigma d w_{t} \right) + \frac{1}{2} B^2 {\sigma}^2 dt$$ $$\frac{dP}{P}= \left(\frac{1}{A} \frac {\partial A}{\partial t} -r \frac {\partial B}{\partial t} - \kappa \theta B + \kappa r B+ \frac{1}{2} B^2 {\sigma}^2\right) dt - \sigma B d w_{t}$$

The expected return of this under the risk neutral measure must be equal to the risk free rate:

$$\frac{1}{A} \frac {\partial A}{\partial t} -r \frac {\partial B}{\partial t} - \kappa \theta B + \kappa r B + \frac{1}{2} B^2 {\sigma}^2=r$$ $$\frac{1}{A} \frac {\partial A}{\partial t} - \kappa \theta B + \frac{1}{2} B^2 {\sigma}^2=r \left( 1+ \frac {\partial B}{\partial t} -\kappa B \right)$$

As this equality holds for all values of r, which does not appear on the left hand side, we infer that

$$\frac{1}{A} \frac {\partial A}{\partial t} - \kappa \theta B + \frac{1}{2} B^2 {\sigma}^2=0$$ $$1+ \frac {\partial B}{\partial t} -\kappa B=0$$

And given that the price of a zero coupon bond at maturity P(T,T)=1, the function $$P=A e^{-r B}$$ implies B(T,T)=0 and A(T,T)=1. Now, multiplying the second equation by the integrating factor, rearranging, and then integrating from t to T, we get

$$1+ \frac {\partial B}{\partial t}-\kappa B =0$$ $$e^{-\kappa t}+ e^{-\kappa t} \frac {\partial B}{\partial t}-e^{-\kappa t} \kappa B =0$$ $$e^{-\kappa t} \frac {\partial B}{\partial t}-e^{-\kappa t} \kappa B =-e^{-\kappa t}$$ $$d \left( e^{-\kappa t} B\left( t,T \right) \right)=- e^{-\kappa t} dt$$ $$\int_{t}^{T}{d \left( e^{-\kappa t} B\left( t,T \right) \right) } =-\int_{t}^{T}{e^{-\kappa u} du}$$ $$e^{-\kappa T} B \left( T,T \right)-e^{-\kappa t} B \left( t,T \right) =\frac{1}{\kappa} \left( e^{-\kappa T}-e^{-\kappa t}\right)$$ $$B \left( t,T \right) = \frac{1}{\kappa} \left( 1-e^{-\kappa \left( T-t \right)}\right)$$

Substituting into the second equation and integrating, we get:

$$\frac{1}{A} \frac {\partial A}{\partial t} - \kappa \theta B + \frac{1}{2} B^2 {\sigma}^2=0$$ $$\frac{1}{A} \frac {\partial A}{\partial t} - \kappa \theta \frac{1}{\kappa} \left( 1-e^{-\kappa \left( T-t \right)}\right) + \frac{{\sigma}^2}{2 {\kappa}^2} \left( 1-e^{-\kappa \left( T-t \right)}\right)^2 =0$$ $$\frac{1}{A} \frac {\partial A}{\partial t} - \theta \left( 1-e^{-\kappa \left( T-t \right)}\right) + \frac{{\sigma}^2}{2 {\kappa}^2} \left( 1+e^{-2\kappa \left( T-t \right)}-2 e^{-\kappa \left( T-t \right)}\right)$$ $$\frac{1}{A} \frac {\partial A}{\partial t} = \theta \left( 1-e^{-\kappa \left( T-t \right)}\right) - \frac{{\sigma}^2}{2 {\kappa}^2} \left( 1+e^{-2\kappa \left( T-t \right)}-2 e^{-\kappa \left( T-t \right)}\right)$$ $$\int_{t}^{T}{ \frac {d A \left( u,T \right)}{A \left( u,T \right)} } = \theta \int_{t}^{T}{ \left( 1-e^{-\kappa \left( T-u \right)}\right) du} - \frac{{\sigma}^2}{2 {\kappa}^2} \int_{t}^{T}{\left( 1+e^{-2\kappa \left( T-u \right)}-2 e^{-\kappa \left( T-u \right)}\right) du}$$ $$ln {A \left( T,T \right) } - ln {A \left( t,T \right) }= \theta \left( T-t \right) -\theta \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} - \frac{{\sigma}^2}{2 {\kappa}^2}\left( \left( T-t\right) +\frac{1-e^{-2\kappa \left( T-t \right)}}{2 \kappa} - 2 \frac{1-e^{-\kappa \left( T-t \right)}}{\kappa} \right)$$ $$- ln {A \left( t,T \right) }= \theta \left( T-t \right) -\theta \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} - \frac{{\sigma}^2}{4 {\kappa}^3}\left( 2 \kappa \left( T-t\right) + 1-e^{-2\kappa \left( T-t \right)} - 4 + 4 e^{-\kappa \left( T-t \right)} \right)$$ $$- ln {A \left( t,T \right) }= \theta \left( \left( T-t \right)-\frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} \right) - \frac{{\sigma}^2}{4 {\kappa}^3}\left( 2 \kappa \left( T-t\right) - \left(1+ e^{-2\kappa \left( T-t \right)}-2 e^{-\kappa \left( T-t \right)} \right) - 2 + 2 e^{-\kappa \left( T-t \right)} \right)$$ $$- ln {A \left( t,T \right) }= \theta \left( \left( T-t \right)-\frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} \right) - \frac{{\sigma}^2}{2 {\kappa}^2}\left( \left( T-t\right) - \frac{1 - e^{-\kappa \left( T-t \right)}}{k} \right) +\frac{{\sigma}^2}{4 {\kappa}^3} \left(1- e^{-\kappa \left( T-t \right)} \right)^2$$ $$ln {A \left( t,T \right) }= \left( \theta-\frac{{\sigma}^2}{2 {\kappa}^2} \right) \left( \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} -\left( T-t \right) \right) -\frac{{\sigma}^2}{4 {\kappa}} \left( \frac{1- e^{-\kappa \left( T-t \right)}}{\kappa} \right)^2$$ $$A \left( t,T \right) =e^{\left( \theta-\frac{{\sigma}^2}{2 {\kappa}^2} \right) \left( \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} -\left( T-t \right) \right) -\frac{{\sigma}^2}{4 {\kappa}} \left( \frac{1- e^{-\kappa \left( T-t \right)}}{\kappa} \right)^2 }$$

Thus:

$$P \left( t, T \right)= A \left( t, T \right) e^{ -r_{t} B \left(t, T \right) }$$ $$P \left( t, T \right)= e^{\left( \theta-\frac{{\sigma}^2}{2 {\kappa}^2} \right) \left( \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} -\left( T-t \right) \right) -\frac{{\sigma}^2}{4 {\kappa}} \left( \frac{1- e^{-\kappa \left( T-t \right)}}{\kappa} \right)^2 } e^{ -r_{t} \frac {\left( 1-e^{-\kappa \left( T-t \right)}\right)}{{\kappa}} }$$ $$P \left( t, T \right)= e^{-r_{t} \frac {\left( 1-e^{-\kappa \left( T-t \right)}\right)}{{\kappa}}+\left( \theta-\frac{{\sigma}^2}{2 {\kappa}^2} \right) \left( \frac{1-e^{-\kappa \left( T-u \right)}}{\kappa} -\left( T-t \right) \right) -\frac{{\sigma}^2}{4 {\kappa}} \left( \frac{1- e^{-\kappa \left( T-t \right)}}{\kappa} \right)^2 }$$