# Ansatz and HJB equation

Suppose we have an HJB equation of the form $$\frac{\partial v}{\partial t}+\frac{1}{2}\sigma^{2}\frac{\partial^{2}v}{\partial s^{2}}+max_{\delta^{a}}\left\{ \lambda^{a}(\delta^{a})\left[v(t,s,x+s+\delta^{a},q-1)-v(t,s,x,q)\right]\right\}+max_{\delta^{b}}\left\{ \lambda^{b}(\delta^{b})\left[v(t,s,x-s+\delta^{b},q+1)-v(t,s,x,q)\right]\right\}$$ with terminal condition $$v(T,s,x,q)=-e^{-\gamma(x+qs)}$$ We will search a solution of the form $$v(t,s,x,q)=-e^{-\gamma\left(x+\theta(t,s,q)\right)}=f(x,\theta(t,s,q))$$ by direct substitution into HJB equation and application of the chain rule we get $$\frac{\partial f(x,\theta(t,s,q))}{\partial\theta(t,s,q)}\frac{\partial\theta(t,s,q)}{\partial t}+\frac{1}{2}\sigma^{2}\left[\frac{\partial f(x,\theta(t,s,q))}{\partial\theta(t,s,q)}\frac{\partial^{2}\theta(t,s,q)}{\partial s^{2}}+\frac{\partial^{2}f(x,\theta(t,s,q))}{\partial\theta(t,s,q)^{2}}\left(\frac{\partial\theta(t,s,q)}{\partial s}\right)^{2}\right]+max_{\delta^{a}}\left\{ \lambda^{a}(\delta^{a})\left[f(x+s+\delta^{a},\theta(t,s,q-1))-f(x,\theta(t,s,q))\right]\right\} +max_{\delta^{b}}\left\{ \lambda^{b}(\delta^{b})\left[f(x-s+\delta^{b},\theta(t,s,q+1))-f(x,\theta(t,s,q))\right]\right\}$$ taking derivatives of $$f$$ $$\gamma f(x,\theta(t,s,q))\frac{\partial\theta(t,s,q)}{\partial t}+\frac{1}{2}\sigma^{2}\left[\gamma f(x,\theta(t,s,q))\frac{\partial^{2}\theta(t,s,q)}{\partial s^{2}}-\gamma^{2}f(x,\theta(t,s,q))\left(\frac{\partial\theta(t,s,q)}{\partial s}\right)^{2}\right]+max_{\delta^{a}}\left\{ \lambda^{a}(\delta^{a})\left[f(x+s+\delta^{a},\theta(t,s,q-1))-f(x,\theta(t,s,q))\right]\right\}+max_{\delta^{b}}\left\{ \lambda^{b}(\delta^{b})\left[f(x-s+\delta^{b},\theta(t,s,q+1))-f(x,\theta(t,s,q))\right]\right\}$$ dividing by $$\gamma f(x,\theta(t,s,q))$$ $$\frac{\partial\theta(t,s,q)}{\partial t}+\frac{1}{2}\sigma^{2}\left[\frac{\partial^{2}\theta(t,s,q)}{\partial s^{2}}-\gamma\left(\frac{\partial\theta(t,s,q)}{\partial s}\right)^{2}\right]+max_{\delta^{a}}\left\{ \frac{\lambda^{a}(\delta^{a})}{\gamma}\left[e^{-\gamma\left(s+\delta^{a}+\theta(t,s,q-1)-\theta(t,s,q)\right)}-1\right]\right\}+max_{\delta^{b}}\left\{ \frac{\lambda^{b}(\delta^{b})}{\gamma}\left[e^{\gamma\left(s-\delta^{b}-\theta(t,s,q+1)+\theta(t,s,q)\right)}-1\right]\right\}$$ Is this correct? It is claimed that with this ansatz we should instead have $$\frac{\partial\theta(t,s,q)}{\partial t}+\frac{1}{2}\sigma^{2}\left[\frac{\partial^{2}\theta(t,s,q)}{\partial s^{2}}-\gamma\left(\frac{\partial\theta(t,s,q)}{\partial s}\right)^{2}\right]+max_{\delta^{a}}\left\{ \frac{\lambda^{a}(\delta^{a})}{\gamma}\left[1-e^{-\gamma\left(s+\delta^{a}+\theta(t,s,q-1)-\theta(t,s,q)\right)}\right]\right\} +max_{\delta^{b}}\left\{ \frac{\lambda^{b}(\delta^{b})}{\gamma}\left[1-e^{\gamma\left(s-\delta^{b}-\theta(t,s,q+1)+\theta(t,s,q)\right)}\right]\right\}$$ Not really sure why signs are different, but think I am missing something really trivial.

• derivatives had a wrong sign (had to be γ(-f) instead of γf for example)
– sle
Commented Jan 2, 2022 at 12:14