## Vasicek model

We derive the Vasicek term structure model formulae.

### Term Structure and Bond price dynamics

The short rate under the Vasicek model was shown to be:

$$r_{t} = r_{s}e^{-\kappa \left( t-s\right)}+ \theta \left( 1-e^{-\kappa \left( t-s \right) }\right) +\sigma\int_{s}^{t} {e^{-k \left( t- u \right) } d w_{u}}$$

Now integrating the short rate from s to T, we get

$$\int_{s}^{T}{r_{t} dt}= r_{s} \int_{s}^{T}{e^{-\kappa \left( t- s \right) } dt} + \theta \int_{s}^{T} {\left( 1 - e^{-\kappa \left( t-s \right) } \right) dt} + \sigma \int_{s}^{T}{{\int_{s}^{t} {e^{-\kappa \left(t-u \right)} d w_{u}}} dt}$$ $$= r_{s} \left( \frac{e^{-\kappa \left( T- s \right)}-1}{-\kappa} \right) + \theta \left[ \int_{s}^{T}{dt} - \int_{s}^{T}{e^{-\kappa \left( t-s \right)}dt} \right] + \sigma \int_{s}^{T}{{\int_{u}^{T} {e^{-\kappa \left(t-u \right)} dt}} d w_{u}}$$ $$= r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) + \theta \left[ \left( T-s \right) - \frac{1}{-\kappa}\left( e^{-\kappa \left( T-s \right)} - 1\right) \right] + \frac{\sigma}{-\kappa} \int_{s}^{T}{ \left({e^{-\kappa \left(T-u \right)}}-1 \right) d w_{u}}$$ $$= r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) + \theta \left[ \left( T-s \right) - \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa} \right] + \frac{\sigma}{\kappa} \int_{s}^{T}{ \left(1-{e^{-\kappa \left(T-u \right)}} \right) d w_{u}}$$

Which is Gaussian with mean and variance given by:

$$E \left[ \int_{s}^{T}{r_{t} dt} \right]= r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) + \theta \left[ \left( T-s \right) - \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa} \right]$$ $$V \left[ \int_{s}^{T}{r_{t} dt} \right]=V \left[ \frac{\sigma}{\kappa} \int_{s}^{T}{ \left( 1- e^{-k \left( T- u \right)} \right) d w_{u}} \right]$$ $$=\frac{{\sigma}^2}{{\kappa}^2} \int_{s}^{T}{ \left( 1- e^{-k \left( T- u \right)} \right)^{2} du}$$ $$=\frac{{\sigma}^2}{{\kappa}^2} \int_{s}^{T}{ \left( 1+e^{-2 k \left( T- u \right)}-2 e^{-k \left( T- u \right)} \right) du}$$ $$= \frac{{\sigma}^2}{{\kappa}^2} \int_{s}^{T}{du}+\frac{{\sigma}^2}{{\kappa}^2} \int_{s}^{T}{ e^{-2 k \left( T- u \right)} du}-\frac{2{\sigma}^2}{{\kappa}^2} \int_{s}^{T}{ e^{-k \left( T- u \right)} du}$$ $$= \frac{{\sigma}^2 \left( T-s \right)}{{\kappa}^2} + \frac{{\sigma}^2}{2{\kappa}^3} \left( 1-e^{-2 \kappa \left( T-s \right)} \right) -\frac{2{\sigma}^2}{{\kappa}^3} \left( 1-e^{-\kappa \left( T-s \right)}\right)$$ $$= \frac{{\sigma}^2}{2{\kappa}^3} \left( 2 \kappa \left( T-s \right)+ 1-e^{-2 \kappa \left( T-s \right)} -4 + 4 e^{-\kappa \left( T-s \right)} \right)$$ $$= \frac{{\sigma}^2}{2{\kappa}^3} \left( 2 \kappa \left( T-s \right) -3 -e^{-2 \kappa \left( T-s \right)} + 4 e^{-\kappa \left( T-s \right)} \right)$$

Hence the bond price at time s can be represented as:

$$P \left( s, T\right)=E \left[ e^{-\int_{s}^{T}{r_{t} dt}}\right]= e^{-E \left[ \int_{s}^{T}{r_{t} dt} \right]+\frac{1}{2}V \left[ \int_{s}^{T}{r_{t} dt} \right] }$$ $$=e^{ -r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) - \theta \left[ \left( T-s \right) - \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa} \right] + \frac{{\sigma}^2}{4{\kappa}^3} \left( 2 \kappa \left( T-s \right) -3 -e^{-2 \kappa \left( T-s \right)} + 4 e^{-\kappa \left( T-s \right)} \right) }$$ $$=e^{ -r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) - \theta \left[ \left( T-s \right) - \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa} \right] + \frac{{\sigma}^2}{2{\kappa}^2} \left[ \left( T-s \right) - \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa} \right] + \frac{{\sigma}^2}{4{\kappa}^3} \left( -1 -e^{-2 \kappa \left( T-s \right)} + 2 e^{-\kappa \left( T-s \right)} \right) }$$ $$=e^{ -r_{s} \left( \frac{1- e^{-\kappa \left( T- s \right)}}{\kappa} \right) + \left( \theta -\frac{{\sigma}^2}{2{\kappa}^2} \right) \left[ \frac{1-e^{-\kappa \left( T-s \right)} }{\kappa}-\left( T-s \right) \right] -\frac{{\sigma}^2}{4{\kappa}} {\left[ \frac{1 -e^{-\kappa \left(T-s\right)}}{\kappa} \right] }^2 }$$