The Riccatti equation for The Cox-Ingerson-Ross Model. (My Question)
I went through the calculations halfway, but I cannot find out how to calculate the following Riccatti equation. Please tell me how to calculate this The Riccatti equation with its computation processes. If you have other solutions, please let me know.


*

*If B(s) satisfies the following O.D.E (The Riccatti equation), 


\begin{eqnarray}
B'(s)   + \beta  B(s)  + \frac{1}{2}  \sigma^2  B(s)^2 =1
\end{eqnarray}


*

*the answer must be below. (Please show the computation processes.)


\begin{eqnarray}
B(s)= \frac{ 2 \left( \exp(\gamma s) -1 \right)  }{2\gamma +(\beta +\gamma)\left( \exp(\gamma s) -1 \right) } \qquad \mbox{with} \  \mbox{   $\gamma=\sqrt{ \beta^2+2\sigma^2}$}
\end{eqnarray} 
(Thank you for your help in advance.)

(Cross-link)
I have posted the same question on https://quant.stackexchange.com/questions/47311/the-riccatti-equation-for-the-cox-ingerson-ross-model

(Original Questions)
(1) Write down the bond pricing P.D.E for the function
\begin{eqnarray}
P(t, T) = E^{ \mathbb{Q} } \left[ \exp \left( - \int^T_t r_s ds \right) \middle|  r_t=x \right] 
\end{eqnarray} 
(2) and show that in case $\alpha =0 $ the corresponding bind price $P(t, T)$ equals
\begin{eqnarray}
P(t, T) =  \exp \left( - B(T-t) r_s  \right) 
\end{eqnarray} 
where $t \in [0, T] $ and
\begin{eqnarray}
B(x)= \frac{ 2 \left( \exp(\gamma x) -1 \right)  }{2\gamma +(\beta +\gamma)\left( \exp(\gamma x) -1 \right) }
\end{eqnarray} 
with $\gamma=\sqrt{ \beta^2+2\sigma^2}$.

(1) My answer


*

*Since the Cox-Ingerson-Ross Model has the below S.D.E, its corresponding P.D.E (namely the bond pricing P.D.E) comes to the following equation by Feynman-Kac Theorem (or by Exercise 4.1.(1) ). Besides, the terminal condition is $F(T, x)=1$.
\begin{eqnarray}
dr_t= (\alpha - \beta r_t ) dt + \sigma \sqrt{r_t} dB_t
\end{eqnarray}

*which models the variations of the short rate process $r_t$, where $\alpha,  \beta, \sigma $ and $r_0$ are positive parameters. When the model is the Ho-Lee Model, $dr_t = \theta dt + \sigma dB_t$, its P.D.E is below.
\begin{eqnarray}
\partial_t F(t, x) + \theta \partial_x F(t, x) + \frac{1}{2}  \sigma^2 \partial_{xx} F(t, x) -xF(t, x) =0
\end{eqnarray}

*Then the Cox-Ingerson-Ross Model has the following P.D.E.
\begin{eqnarray}
\partial_t F(t, x) +  (\alpha - \beta x ) \partial_x F(t, x) + \frac{1}{2}  \sigma^2 x\partial_{xx} F(t, x) -xF(t, x) =0
\end{eqnarray}

*When $\alpha=0$, $dr_t= - \beta r_t  dt + \sigma \sqrt{r_t} dB_t$, it comes to below.
\begin{eqnarray}
\partial_t F(t, x)  - \beta x \partial_x F(t, x) + \frac{1}{2}  \sigma^2 x\partial_{xx} F(t, x) -xF(t, x) =0
\end{eqnarray}

*Here, if the S.D.E is the Generalized Affine Model, it comes to below 
\begin{eqnarray}
dr_t= \left( \eta_t + \lambda_t  r_t \right) dt + \sqrt{ \delta_t + \gamma_t r_t} dB_t
\end{eqnarray}

*The S.D.E of the Generalized Affine Model yields a bond pricing formula of the form:
\begin{eqnarray}
P(t, T) = \exp \left( A(T-t) +C(T-t)r_t\right)
\end{eqnarray}

*Comparing the conditional bond pricing formula, $P(t, T) =  \exp \left( - B(T-t) r_s  \right) $, to the above formula, one reaches below.
\begin{eqnarray}
&& A(T-t)=0 \\
&&C(T-t)r_t = - B(T-t) r_s 
\end{eqnarray}

*Let $F(t, x)=\exp \left( - B(T-t) x  \right) $.
\begin{eqnarray}
\partial_t F(t, x) &=& B'(T-t) x F(t, x) \\
\partial_x F(t, x) &=& -B(T-t)  F(t, x) \\
\partial_{xx} F(t, x) &=&B(T-t)^2  F(t, x)
\end{eqnarray}

*The P.D.E comes to below.
\begin{eqnarray}
&&\partial_t F(t, x)  - \beta x \partial_x F(t, x) + \frac{1}{2}  \sigma^2 x\partial_{xx} F(t, x) -xF(t, x) \\
&&\qquad \qquad = B'(T-t) x F(t, x) - \beta x (-B(T-t)  F(t, x)) \nonumber \\
&& \qquad \qquad\qquad  + \frac{1}{2}  \sigma^2 x B(T-t)^2  F(t, x) -xF(t, x)\\
&& \qquad \qquad = B'(T-t) x F(t, x) + \beta x B(T-t)  F(t, x) \nonumber \\
&& \qquad \qquad\qquad  + \frac{1}{2}  \sigma^2 x B(T-t)^2  F(t, x) -xF(t, x)\\
&& \qquad \qquad\qquad  =0
\end{eqnarray}
$\square$
(2) My Answer


*

*Since $F(t, x) \neq 0$ and $x \neq 0$, the above equation comes to below. 
\begin{eqnarray}
&& B'(T-t) x F(t, x) + \beta x B(T-t)  F(t, x) \nonumber \\
&&  \qquad\qquad \qquad\qquad  + \frac{1}{2}  \sigma^2 x B(T-t)^2  F(t, x) -xF(t, x)\\
&& \qquad \qquad = B'(T-t) x  + \beta x B(T-t)  + \frac{1}{2}  \sigma^2 x B(T-t)^2   -x \\
&& \qquad \qquad = B'(T-t)   + \beta  B(T-t)  + \frac{1}{2}  \sigma^2  B(T-t)^2   -1 \\
&&\qquad \qquad =0
\end{eqnarray}

*Let $T-t=s$, one reaches the following equation.
\begin{eqnarray}
B'(s)   + \beta  B(s)  + \frac{1}{2}  \sigma^2  B(s)^2 =1
\end{eqnarray}

*One finds out it is the Riccatti equation because of $A(s)=0$.  
(Thank you for your help in advance.)
$\square$
 A: SOLVING YOUR ODE :
$$B'(s)   + \beta  B(s)  + \frac{1}{2}  \sigma^2  B(s)^2 =1$$
Of course this is a Riccati ODE. But this is also a separable ODE.
$$\frac{B'}{1-\beta  B  - \frac{1}{2}  \sigma^2  B^2}=1$$
$$\int \frac{dB}{1-\beta  B  - \frac{1}{2}  \sigma^2  B^2}=\int ds =s+c$$
$$s+c=\frac{2}{\sqrt{\beta+2\sigma^2}}\tanh^{-1}\left(\frac{\sigma^2B+\beta}{\sqrt{\beta+2\sigma^2}} \right)$$
Inverting for $B$ leads to :
$$B=\frac{1}{\sigma^2}\left(\sqrt{\beta+2\sigma^2}\tanh\left(\frac{\sqrt{\beta+2\sigma^2}}{2}(s+c) \right)-\beta \right)$$
$$B(s)=\frac{1}{\sigma^2}\left(\gamma\tanh\left(\gamma(s+c) \right)-\beta \right)$$
We cannot compare to the equation that you found because a constant of integration is missing into it.
Your result is :
$$B(s)= \frac{ 2 \left( \exp(\gamma s) -1 \right)  }{2\gamma +(\beta +\gamma)\left( \exp(\gamma s) -1 \right) }$$
It is exactly the same as the above result $B=\frac{1}{\sigma^2}\left(\gamma\tanh\left(\gamma(s+c) \right)-\beta \right)$ only if 
$$c=\frac{1}{\gamma}\ln\left(\frac{\gamma+b}{\gamma-b} \right)$$
But this cannot be prouved without a boundary condition which should be joint to your ODE.
NOTE :
If the boundary condition is $B(0)=0$ the value of $c$ is as above and your result is exactly the same as my result.
A: I solved by myself. The following is this solution.


*

*Let $T-t=s$, one reaches the following equation.
\begin{eqnarray}
B'(s)   + \beta  B(s)  + \frac{1}{2}  \sigma^2  B(s)^2 =1
\end{eqnarray}

*One finds out it is the Riccatti equation because of $A(s)=0$. Therefore, one reaches the following equation. 
\begin{eqnarray}
B' = - \frac{1}{2}  \sigma^2  B^2 - \beta  B +1
\end{eqnarray}

*Since this is the Riccatti equation, one finds out the special solution. Let $B'=0$. Then, one reaches the following equations.
\begin{eqnarray}
&& - \frac{1}{2}  \sigma^2  B^2 - \beta  B +1 =0 \\
&& \sigma^2  B^2 + 2 \beta  B - 2 =0 \\
&& B = \frac{-\beta \pm \sqrt{ \beta^2 + 2 \sigma^2} }{\sigma^2} \\
&& B = \frac{-\beta \pm \gamma}{\sigma^2} 
\end{eqnarray}

*Use $B=(-\beta -\gamma)/\sigma^2$. Let $K=(-\beta -\gamma)/\sigma^2$. Moreover, let $B=u+K$.
\begin{eqnarray}
B^2 &=& u^2 + 2 K u + K^2 \\
B'&=&u'\\
&=& - \frac{1}{2}  \sigma^2  B^2 - \beta  B +1 \\
&=& - \frac{1}{2}  \sigma^2 ( u^2 + 2 K u + K^2 )  - \beta (u+K) +1\\
&=& - \frac{1}{2}  \sigma^2  u^2 - \sigma^2 K u -  \beta  u  + \left( - \frac{1}{2}  \sigma^2  K^2 - \beta  K +1\right) \\
&=& - \frac{1}{2}  \sigma^2  u^2 - \sigma^2 K u -  \beta  u + 0 \\
&=& - \frac{1}{2}  \sigma^2  u^2 - \sigma^2 K u -  \beta  u  \\
u' &=&  - \frac{1}{2}  \sigma^2  u^2 - \sigma^2 K u -  \beta  u  
\end{eqnarray}

*Let $u=1/z$. Besides, $u'=-z'/z^2$.
\begin{eqnarray}
u' &=&  - \frac{1}{2}  \sigma^2  u^2 - \sigma^2 K u -  \beta  u \\
-\frac{z'}{z^2} &=& - \frac{1}{2}  \sigma^2 \frac{1}{z^2} - (  \sigma^2 K  +  \beta ) \frac{1}{z} \\
z' &=&  \frac{\sigma^2}{2} +  (  \sigma^2 K  +  \beta ) z
\end{eqnarray}

*Let $M=\sigma^2/2$ and $N= (  \sigma^2 K +  \beta ) $. Therefore, with Integral constant $C$,
\begin{eqnarray}
z&=& C e^{Nt} - \frac{M}{N} \\
z&=& \frac{1}{u} 
= \frac{1}{B-K}
= C e^{Nt} - \frac{M}{N} 
=\frac{C N e^{Nt} - M}{N} \\
B&=&\frac{N}{C N e^{Nt} - M} +K %= \frac{N}{C N e^{Nt} - M} + \frac{C N e^{Nt} - KM}{C N e^{Nt} - M} 
= \frac{C N K e^{Nt} - KM +N}{C N e^{Nt} - M} 
\end{eqnarray}

*Let $t=0$, since $B=0$.
\begin{eqnarray}
&& \frac{C N K e^{0} - KM +N}{C N e^{0} - M} = 0 \\
&& \frac{C N K  - KM +N}{C N  - M} = 0
\end{eqnarray}

*Here, one reaches the following condition.
\begin{eqnarray}
C &\neq& \frac{M}{N} =  \frac{\sigma^2/2}{\sigma^2 K + \beta}=  \frac{\sigma^2/2}{ -\beta - \sqrt{ \beta^2 + 2 \sigma^2}+ \beta} = -\frac{\sigma^2}{2 \gamma}
\end{eqnarray}

*One computes the numerator while paying attention to the above conditions. 
\begin{eqnarray}
C &=& \frac{KM-N}{KN} 
\end{eqnarray}

*One reaches the following equations.
\begin{eqnarray}
K&=& \frac{- \beta - \gamma}{\sigma^2} \\
M&=& \frac{\sigma^2}{2} \\
KM&=&  \frac{- \beta - \gamma}{2} \\
N&=& \sigma^2 K +\beta =  \beta - \gamma + \beta= - \gamma
\end{eqnarray}

*Substitute the above results into $C$.
\begin{eqnarray}
C &=& \frac{KM-N}{KN} = \frac{\frac{-\beta - \gamma}{2}+ \frac{2}{2} \gamma}{  \frac{- \beta - \gamma}{\sigma^2} ( - \gamma) } 
=  \frac{ \frac{-\beta + \gamma}{2}}{ \gamma \frac{ \beta + \gamma}{\sigma^2} }
= - \frac{ (\beta - \gamma) \sigma^2 }{ \gamma (  \beta + \gamma ) 2 } \\
CN&=&\frac{ \beta - \gamma }{   \beta + \gamma  } \frac{ \sigma^2 }{2} \\
CNK&=& \frac{ \beta - \gamma }{   \beta + \gamma  } \frac{ \sigma^2 }{2} \left(\frac{- \beta - \gamma}{\sigma^2}  \right) = - \frac{\beta - \gamma}{2}
\end{eqnarray}

*Substitute the above results into $B$.
\begin{eqnarray}
B&=& \frac{C N K e^{Nt} - KM +N}{C N e^{Nt} - M} = \frac{ - \frac{\beta - \gamma}{2} e^{- \gamma t} + \frac{ \beta + \gamma}{2} - \gamma }{ \frac{ \beta - \gamma }{   \beta + \gamma  } \frac{ \sigma^2 }{2} e^{- \gamma t} -  \frac{\sigma^2}{2}  } \\
&=&  \frac{ - \frac{\beta - \gamma}{2} e^{- \gamma t} + \frac{ \beta - \gamma}{2}  }{ \frac{ \beta - \gamma }{   \beta + \gamma  } \frac{ \sigma^2 }{2} e^{- \gamma t} -  \frac{\sigma^2}{2}  }
= \frac{ - \left( \frac{\beta - \gamma}{2} \right) \left( e^{- \gamma t} -1\right) }{ \frac{\sigma^2}{2} \left( \frac{ \beta - \gamma }{   \beta + \gamma  } e^{- \gamma t} -1 \right)} \\
&=& - \frac{ ( \beta  - \gamma )( \beta  + \gamma ) \left( e^{- \gamma t} -1\right) }{ \sigma^2  \left(  ( \beta  - \gamma ) e^{- \gamma t}  -  ( \beta  + \gamma ) \right)}
=- \frac{ ( \beta^2  - \gamma^2 ) \left( e^{- \gamma t} -1\right) }{ \sigma^2  \left(  ( \beta  - \gamma ) e^{- \gamma t}  -  ( \beta  + \gamma ) \right)} \\
&=& \frac{ 2\sigma^2  \left( e^{- \gamma t} -1\right)  }{ \sigma^2  \left(  ( \beta  + \gamma ) e^{- \gamma t}  -  ( \beta  + \gamma )  - 2 \gamma e^{- \gamma t} \right)}  \\
&=&  \frac{ 2  \left( e^{- \gamma t} -1\right)  }{    ( \beta  + \gamma ) \left( e^{- \gamma t}  - 1 \right)  - 2 \gamma e^{- \gamma t} } 
= \frac{ 2  \left( 1 - e^{ \gamma t} \right)  }{    ( \beta  + \gamma ) \left( 1  - e^{ \gamma t} \right)  - 2 \gamma } \\
B(t) &=& \frac{ 2 \left( \exp(\gamma t) -1 \right)  }{2\gamma +(\beta +\gamma)\left( \exp(\gamma t) -1 \right) }, \qquad \mbox{ with $\gamma=\sqrt{ \beta^2+2\sigma^2}$.} 
\end{eqnarray}
$\square$ 
