Consider the following PDE on $[0, T) \times \mathbf{R}$: $$ u_t + \frac{1}{2\lambda} u_x^2 + \frac{\sigma^2}{2}u_{xx} = 0, \;\;\; u(T, x) = -(x-\alpha)^2 $$
$u$ is a function of $t, x$.
I know that I should be able to find the solution by setting $u(t, x) = a(t) + b(t)x + c(t)x^2$. Using the terminal condition, we can get $$ a(T) = -\alpha^2, \;\;\; b(T) = 2\alpha, \;\;\; c(T) = -1. $$
Also, \begin{align*} u_t &= a'(t) + b'(t)x + c'(t)x^2 \\ u_x &= b(t) + 2c(t)x \;\; \implies u_x^2 = (b(t) + 2c(t)x)^2 \\ u_{xx} &= 2c(t) \end{align*}
Substituting into the PDE: $$ a'(t) + b'(t)x + c'(t)x^2 + \frac{1}{2\lambda} (b(t) + 2c(t)x)^2 + \sigma^2 c(t) = 0 $$
My attempt was to set $x=0$ to get: $a'(t) + \frac{1}{2\lambda} b^2(t) + \sigma^2 c(t) = 0$. Then, I thought I could get another equation with $x=1$. I thought that I could use a system of such derived ODEs to solve for $u$. However, I don't see this going anywhere, and I think there is a better way to do it. Would anyone be able to guide me on this? Thanks very much for reading.
Expand out the equation you already have then collect like-terms in $x$ to obtain $$0=\big(a'(t)+\frac1{2\lambda}b(t)^2+\sigma^2c(t)\big)+\bigg(b'(t)+\frac{2bc}{\lambda}\bigg) x + \bigg(c'(t) + \frac{2c^2}{\lambda} \bigg) x^2 .$$ Since $x$ and $t$ are independent and this holds for all $x$ you must have the coefficients of $1$, $x$, and $x^2$ are zero. Hence, we have the system of ODEs $$\begin{cases} 0=a'(t)+\frac1{2\lambda}b(t)^2+\sigma^2c(t) \\ 0=b'(t)+\frac{2bc}{\lambda} \\ 0= c'(t) + \frac{2c^2}{\lambda} . \end{cases} $$ We can solve the last equation (using the boundary conditions) to get $$c(t) = \frac\lambda{2T-2t+\lambda}. $$ Substituting this into the second equation we can then solve that to get $$b(t) = -\frac{2 \alpha \lambda }{-\lambda +2 t-2 T} .$$ Finally, you can solve for $a$. The answer is pretty messy: $$a(t) = \frac1{2 (\lambda -2 t+2 T)}\big (-2 \alpha ^2 \lambda +\lambda ^2 \sigma ^2 \log (\lambda )-2 \lambda \sigma ^2 t \log (\lambda )-\lambda ^2 \sigma ^2 \log (\lambda -2 t+2 T)+2 \lambda \sigma ^2 t \log (\lambda -2 t+2 T)-2 \lambda \sigma ^2 T \log (\lambda -2 t+2 T)+2 \lambda \sigma ^2 T \log (\lambda ) \big) $$