Find the solutions of the ODE from SDE

Consider the SDE $$dS_t = rS_t dt + \sigma S_t dB_t \ \ \ \text{where} \ r \ \text{and} \ \sigma \ \text{are constants}$$

a.) Find the ODE for the function $V(x)$ such that $e^{-rt}V(S_t)$ is martingale.

b.) Find all the solutions to the ODE in (a).

Attempted solution for a.) $V(t,S_t)$ is martingale if and only if $V(t,x)$ satisfies $$\partial_t V(t,x) + \partial_x V(t,x)\mu(t,x) + \frac{1}{2}\partial_{xx}V(t,x)\sigma^2(t,x) = 0$$ hence set $V(t,x) = V(x)e^{-rt}$ in the equation above, we then have $$V(x)\partial_t e^{-rt} + e^{-rt}\partial_x V(x)\mu + {\color{red}{\frac{1}{2}}} e^{-rt}\partial_{xx}V(x)\sigma^2 = 0$$ where $\mu = r S_t$ and $\sigma = \sigma S_t$. Therefore the ODE for the function $V(x)$ is $$-rV(x)e^{-rt} + re^{-rt}S_t\frac{d V}{dx} + {\color{red}{\frac{1}{2}}}\sigma^2e^{-rt}S_t^2\frac{d^2 V}{dx^2} = 0$$

Attempted solution for b.) We have a second order constant coefficent linear differential equation of the form $$aV^{''} + bV' + cV = 0$$ where $a = \sigma^2 S_t^{2}$, $b = rS_t$, and $c = -r$. Thus the solution to this ode is $$V = \begin{cases} Ae^{m_1x} + Be^{m_2x}, & \text{if} \ am^2 + bm + c = 0 \ \text{has distinct real roots}\\ e^{ax}( C cos(\beta x) + Dsin(\beta x), & \text{if} \ am^2 + bm + c = 0 \ \text{has roots equal to} \alpha\pm \beta i \\ (Ax + B)e^{mx}, & \text{if} \ am^2 + bm + c = 0 \ \text{has 1 repeated root} \end{cases}$$

Not sure is this is correct any suggestions is greatly appreciated.

• Have you tried the Feynman-Kac formula? en.m.wikipedia.org/wiki/Feynman–Kac_formula Commented Apr 1, 2016 at 7:30
• As I commented in your other question, the ODE, or PDE, is confusing: the variable $S_t$ should be replaced by $x$, for a real differential equation. As for your solution, that only works for constant coefficients, however, your equation has variable coefficients. In fact, it is not easy to solve this equation. In particular, certain transformation may needed to convert it to an ODE with constant coefficients. Commented Apr 1, 2016 at 18:05
• What kind of technique you have learnt to solve such equation, in particular, in your current course? Commented Apr 1, 2016 at 18:20
• We have not learned any techniques sometimes he posts questions that are harder then he expects I have only had an undergrad ODE course Commented Apr 2, 2016 at 1:07

I will consider (b) only. From part (a), the ODE is of the form \begin{align*} -r V(x) +rx\frac{dV(x)}{dx} + \frac{1}{2}\sigma^2 x^2 \frac{d^2V(x)}{dx^2} = 0.\tag{1} \end{align*} Let $x=e^y$. Then, \begin{align*} \frac{dV(x)}{dx} &= \frac{dV(e^y)}{dy}\frac{dy}{dx}\\ &=\frac{1}{x}\frac{dV(e^y)}{dy},\\ \frac{d^2V(x)}{dx^2} &= -\frac{1}{x^2}\frac{dV(e^y)}{dy} + \frac{d^2V(e^y)}{dy^2}\frac{1}{x^2}. \end{align*} Moreover, Equation (1) is now of the form \begin{align*} -r V(e^y) +\Big(r-\frac{1}{2}\sigma^2\Big)\frac{dV(e^y)}{dy} + \frac{1}{2}\sigma^2 \frac{d^2V(e^y)}{dy^2} = 0.\tag{2} \end{align*} The technique you have shown in your question can now be used to solve this equation. Specifically, \begin{align*} V(e^y)= Ae^{y}+Be^{-\frac{2r}{\sigma^2} y}. \end{align*} That is, \begin{align*} V(x)= Ax+Bx^{-\frac{2r}{\sigma^2}}, \end{align*} where $A$ and $B$ are constants.