# Indication on how to solve the heat equations with nonconstant coefficients

I was just wondering how to start solving a heat equation with non-constant coefficients like

$$u_t-(x^2u_x)_x=0, \quad x\in (1,e), \quad t>0$$ $$u(1,t)=u(e,t)=0, \quad t>0$$ $$u(x,0)=u_0 \quad x\in (1,e)$$

Thanks in advance for any insight.

-
Separation of variables ought to work. Though you may not be able to find a closed form solution for the $X$ equations … – Harald Hanche-Olsen Mar 17 '12 at 14:18
@HaraldHanche-Olsen Separation of variables $u=T(t)\,X(x)$ gives an Euler equation for $X$ that can be solved explicitly. – Julián Aguirre Mar 17 '12 at 17:47
@JuliánAguirre: Oh, of course. (I was distracted, and crossed a neuron or two in the process of responding.) – Harald Hanche-Olsen Mar 17 '12 at 23:44
This question has been solved perfectly. Hope that the asker has been diving enough and accept the answer at an early date. – doraemonpaul Aug 30 '12 at 12:15

The best method of course is to use separation of variables:

Let $u(x,t)=X(x)T(t)$ ,

Then $$X(x)T'(t)-x^2X''(x)T(t)-2xX'(x)T(t)=0$$

$$X(x)T'(t)=(x^2X''(x)+2xX'(x))T(t)$$

$$\dfrac{T'(t)}{T(t)}=\dfrac{x^2X''(x)+2xX'(x)}{X(x)}=-\dfrac{4\pi^2s^2+1}{4}$$

$$\begin{cases}\dfrac{T'(t)}{T(t)}=-\dfrac{4\pi^2s^2+1}{4}\\x^2X''(x)+2xX'(x)+\dfrac{4\pi^2s^2+1}{4}X(x)=0\end{cases}$$

$$\begin{cases}T(t)=c_3(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\\X(x)=\begin{cases}\dfrac{c_1(s)\sin(\pi s\ln x)}{\sqrt{x}}+\dfrac{c_2(s)\cos(\pi s\ln x)}{\sqrt{x}}&\text{when}~s\neq0\\\dfrac{c_1\ln x}{\sqrt{x}}+\dfrac{c_2}{\sqrt{x}}&\text{when}~s=0\end{cases}\end{cases}$$

$$\therefore u(x,t)=\dfrac{C_1e^{-\frac{t}{4}}\ln x}{\sqrt{x}}+\dfrac{C_2e^{-\frac{t}{4}}}{\sqrt{x}}+\sum_{s=0}^\infty\dfrac{C_3(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\sin(\pi s\ln x)}{\sqrt{x}}+\sum_{s=0}^\infty\dfrac{C_4(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\cos(\pi s\ln x)}{\sqrt{x}}$$

$u(1,t)=0$ :

$$C_2e^{-\frac{t}{4}}+\sum_{s=0}^\infty C_4(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}=0$$

$$\sum_{s=0}^\infty C_4(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}=-C_2e^{-\frac{t}{4}}$$

$$C_4(s)=\begin{cases}-C_2&\text{when}~s=0\\0&\text{otherwise}\end{cases}$$

$$\therefore u(x,t)=\dfrac{C_1e^{-\frac{t}{4}}\ln x}{\sqrt{x}}+\dfrac{C_2e^{-\frac{t}{4}}}{\sqrt{x}}+\sum_{s=0}^\infty\dfrac{C_3(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\sin(\pi s\ln x)}{\sqrt{x}}-\dfrac{C_2e^{-\frac{t}{4}}}{\sqrt{x}}=\dfrac{C_1e^{-\frac{t}{4}}\ln x}{\sqrt{x}}+\sum_{s=1}^\infty\dfrac{C_3(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\sin(\pi s\ln x)}{\sqrt{x}}$$

$u(e,t)=0$ :

$$\dfrac{C_1e^{-\frac{t}{4}}}{\sqrt{e}}=0$$

$$C_1=0$$

$$\therefore u(x,t)=\sum_{s=1}^\infty\dfrac{C_3(s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\sin(\pi s\ln x)}{\sqrt{x}}$$

$u(x,0)=u_0$ :

$$\sum_{s=1}^\infty\dfrac{C_3(s)\sin(\pi s\ln x)}{\sqrt{x}}=u_0$$

$$\sum_{s=1}^\infty C_3(s)\sin(\pi s\ln x)=u_0\sqrt{x}$$

$$\sum_{s=1}^\infty C_3(s)\sin(\pi xs)=u_0e^{\frac{x}{2}}$$

$$C_3(s)=2\int_0^1u_0e^{\frac{x}{2}}\sin(\pi sx)~dx=\left[\dfrac{2u_0e^{\frac{x}{2}}\left(\dfrac{1}{2}\sin(\pi sx)-\pi s\cos(\pi sx)\right)}{\dfrac{1}{4}+\pi^2s^2}\right]_0^1=\dfrac{8u_0\pi s(1-e^{\frac{1}{2}}(-1)^s)}{4\pi^2s^2+1}$$

$$\therefore u(x,t)=\sum_{s=1}^\infty\dfrac{8u_0\pi s(1-e^{\frac{1}{2}}(-1)^s)e^{-\frac{t(4\pi^2s^2+1)}{4}}\sin(\pi s\ln x)}{\sqrt{x}(4\pi^2s^2+1)}$$

-