I need to solve the backward equation $u_t - \gamma x u_x + \frac{1}{2} b^2 u_{xx} $ subject to the final condition $ u(x,T) = (x-a)^2 $. Here a and b and $\gamma$ are constants. I am given a strong hint to use the ansatz (assumed form of the solution) $ u(x,t) = B(t)(x - A(t) )^2 + C(t) $, which seems to only make sense.
Upon differentiation and substituting the ansatz into the PDE, I get B'(t) (x - A(t) )^2 + C'(t) + B(t)\left[2(x-A(t))A'(t) - 2\gamma x (x-A(t)) + b^2 \right] = 0 subject to the final conditions $A(T) = a, B(T) = 1$, and $C(T) = 0$. But I'm unable to make sense of this, as I want to take B(t) = 1 for all t and C(t) = 0 for all t, but then I'm left with the last term in square brackets which doesn't seem nice.
Any insight would be greatly appreciated as I seem to be pretty bad at solving random PDEs. Thanks in advance.