Black-Scholes PDE to heat equation, nonconstant coefficients Can someone provide me with details or a reference on how to transform the Black-Scholes PDE with nonconstant coefficients (i.e. $r=r\left(S,t\right)$, $\sigma=\sigma\left(S,t\right)$) to the heat equation?
 A: The link I gave doesn't really give a solution by the method of characteristics (or a similarity solution), instead I will provide a "wish washy" solution - not in the sense that any of it is wrong, it just needs a lot of explanation to explain why it is correct. The solution is long enough without this explanation so we will be assuming quite a bit!
You requested non-coefficients of the form $r \equiv r(S,t), \, \sigma \equiv \sigma(S,t)$ where $S$ is the share price of an asset and $t$ is the usual time. Instead I will solve the problem for $r \equiv r(t), \, \sigma \equiv \sigma(t)$ for two reasons


*

*I have not solved what you have fully requested for yet (it may be harder or easier, I do not know yet).

*These two functions look at the interest rate and volatility rate of an option, respectively. These are certainly not deterministic and are almost always unknown but we can say that they should depend on time alone. 
This makes sense as you judge how volatile and likely to go crazy and jump (and such) an option is by its time frame in say, the last three or four years, not by its share price. 
You can ask a better question by taking $r$ and $\sigma$ to both be stochastic processes, so a collection of random variables. Then you can involve some parameters $S$ and $t$ in a desired underlying continuous distribution. It is not too hard to see that we have a different type of dependence when we look at $S$ and $t$ if we set up our problem like this.
We will get the solution first by defining the Black-Scholes partial different equation by the linear operator $L[C]$ for a function $C(S,t)$ that is twice smooth in $S$ and once smooth in $t$. We have $\sigma(t)$ and $r(t)$ to be functions of time $t$ and our linear operator $L$ is defined by
\begin{equation*} L[C] := \frac{1}{2} \sigma^2(t) S^2 C_{SS} + r(t) S C_{S} -r C + C_{t} \end{equation*}
For convenience we will write the partial derivatives in the form of $\frac{\partial}{\partial{t}} C = C_{t}$ and such.
We will use several transforms to solve the problem.
First transform 
We will introduce a dummy time variable $t'$ by the relation $t=T-t'$ where $T$ is the time of expiry of the option or can just be seen as a constant.
We have $C_{t} = -C_{t'}$ and the BS-pde becomes 
$\frac{1}{2} \sigma^2(T-t')S^2 C_{SS}(S,T-t') + r(T-t')SC_{S}(S,T-t') - r(T-t')C(s,T-t')-C_{t'}=0$
Second transform
We will now transform the share price and option value and take a shift $T-t' \mapsto t'$ by the transform 
$S = Ee^{x}$ and $C(S,t)=Ev(x,t')$,
where $E$ is the price at expiry of the option and note that we have 
$x=\ln(\frac{S}{E})$
$C(S,t) = C(Ee^x,T-t') = Ev(x,t')$.
Similarly we can transform the functions $r$ and $\sigma$ by 
$r(T-t') \mapsto r(t')$ 
$\sigma(T-t') \mapsto \sigma(t')$.
We have the partial derivatives to be 
$C_{S} = C_{x}x_{S} = \frac{1}{S}C_x$ and $C_{SS} = \frac{-1}{S^2}C_{x} + \frac{1}{S^2}C_{xx}$ 
$C_{S} = \frac{E}{S}v_{x}$ and $C_{SS} = -\frac{E}{S^2}v_{x} + \frac{E}{S^2}v_{xx}$
Then the BS pde becomes (when simplified)
$v_{t'} = \frac{1}{2} \sigma^2{t'} + \lbrace r(t') + \frac{1}{2} \sigma^2(t') \rbrace v_{x} - r(t')v $
Third transform
We now introduce a weighted time and begin to remove this dummy time variable $t'.
Define the time variable $\tau$ by $\tau(t') = \int_{0}^{t'} \frac{1}{2} \sigma^2(s) ds$.
Then this can be expressed as $d\tau = \frac{1}{2} \sigma^2(t') dt'$. Then our partial derivative of $v$ with respect to $t'$ can be expressed as (by the chain rule, which we have used many times so far) 
$v_{t'} = \frac{1}{2}\sigma^2(t') v_{\tau}$.
Then our BS pde becomes (when rearranged slightly)
$v_{\tau} = v_{xx} + \lbrace \frac{2r(t')}{\sigma^2(t')} -1 \rbrace v_{x} - \frac{2r(t')}{\sigma^2(t')}v$.
Fourth transform
Here comes the wish washy part. Of the previous equation we will have the non-constant coefficents of $v_x$ and $v$ to be replaced by functions depending on $\tau$, not on $t'$.
So we have a function $a(\tau)$ and $b(\tau)$ defined by 
$a(\tau) = \frac{2r(t')}{\sigma^2(t')} -1$ and $b(\tau) = \frac{2r(t')}{\sigma^2(t')}$.
This is valid and is dependent on $\tau$ as we can take the inverse of the transformation from $\tau$ to $t'$, i.e. the inverse of $\tau \mapsto \tau(t')$. If we define a function $F$ similarly to how we originally defined $\tau$, i.e.
$F(t') = \int_{0}^{t'} \frac{1}{2} \sigma^2{s} \, ds$
such that the variable $\tau$ in terms of $t'$ is given by $\tau = F(t')$, then we must compute the inverse $F^{-1}$ such that $t' = F^{-1}(\tau)$. 
Then $r(t')$ can be expressed as $r(t') = r[F^{-1}(\tau)] = r(\tau)$. So we define the functions $a$ and $b$ of the variable $\tau$ with
$a(\tau) = \frac{2r(\tau)}{\sigma^2(\tau)} -1$,
$b(\tau) = \frac{2r(\tau)}{\sigma^2(\tau)}$
Then we have the BS pde to just be 
$v_{\tau} = v_{xx} + a(\tau)v_{x} - b(\tau)v$.
Now this can be solved by a similarity solution.
Fifth transform
Forget the term $v_{xx}$ for a second and just try to solve the pde $v_{\tau} = a(\tau)v_{x} - b(\tau)v$.
A solution is given by the function $v(x,\tau) = F[x+A(\tau)]e^{-B(\tau)}$ with the functions $A$ and $B$ defined by $A'(\tau) = a(\tau)$ and $B'(\tau) = b(\tau)$ and $F$ is an arbitrary function.
This function solves the modified problem. A slight tweak to it solves the full problem and gives us the heat equation.
Sixth transform
Let $x'= x+A(\tau)$.
Define the function $v(x',\tau) = e^{-B(\tau)}U(x,\tau)$. 
Then we just have $v(x,\tau) = e^{-B(\tau)}U(x',\tau)$. 
The partial derivatives with respect to $x$ are given by $v_x = e^{-B(\tau)}U_{x'} and $v_{xx} = e^{-B(\tau)}U_{x'x'}
The partial derivative with respect to $\tau$ is given by 
$v_{\tau} = e^{-B(\tau)} [-B'(\tau)U+A'(\tau)U_{x'}+U_{\tau}] = e^{-B(\tau)}[-b(\tau)U+a(\tau)U_{x'}+U_{\tau}]$.
Then the PDE $v_{\tau} = v_{xx} + a(\tau)v_{x} - b(\tau)v$ turns into $U_{\tau} = U_{x'x'}$ by the last transform.
Additional
Many questions can be asked:


*

*What about the initial boundary conditions? How are they transformed?

*Using the Dirac delta "function" or by a Fourier transform we can find the solution of this heat equation, how does it relate to our problem and to the transforms?

*What special properties do these transforms and functions such as $A(\tau)$ have?


Most of these questions define the excellent book The Mathematics of Financial Derivatives by Wilmott. Certainly this is how I learned how to solve these problems.
