How do I solve $ \frac{\partial{C(x,t)}}{\partial{t}} = D\frac{\partial^2C(x,t)}{\partial{x^2}}$? How do I solve
$$ \frac{\partial{C(x,t)}}{\partial{t}} = D\frac{\partial^2C(x,t)}{\partial{x^2}}\tag1 $$
for $C(x,t)$, given the initial value:
$$ C(x,0) = 0 \tag2$$
and the boundary conditions:
$$ C(0,t) = C_s\tag3$$
$$ C(x,t)  \rightarrow 0, x \rightarrow \infty\tag4 $$
Many thanks.
 A: Let $C(x,t)=X(x)T(t)$ ,
Then $X(x)T'(t)=DX''(x)T(t)$
$\dfrac{T'(t)}{DT(t)}=\dfrac{X''(x)}{X(x)}=-s^2$
$\begin{cases}\dfrac{T'(t)}{T(t)}=-Ds^2\\X''(x)+s^2X(x)=0\end{cases}$
$\begin{cases}T(t)=c_3(s)e^{-Dts^2}\\X(x)=\begin{cases}c_1(s)\sin xs+c_2(s)\cos xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$
$\therefore C(x,t)=\int_0^\infty C_1(s)e^{-Dts^2}\sin xs~ds+\int_0^\infty C_2(s)e^{-Dts^2}\cos xs~ds$
$C(0,t)=C_s$ :
$\int_0^\infty C_2(s)e^{-Dts^2}~ds=C_s$
$C_2(s)=C_s\delta(s)$
$\therefore C(x,t)=\int_0^\infty C_1(s)e^{-Dts^2}\sin xs~ds+\int_0^\infty C_s\delta(s)e^{-Dts^2}\cos xs~ds=\int_0^\infty C_1(s)e^{-Dts^2}\sin xs~ds+C_s$
$C(x,0)=0$ :
$\int_0^\infty C_1(s)\sin xs~ds+C_s=0$
$\int_0^\infty C_1(s)\sin xs~ds=-C_s$
$C_1(s)=-\dfrac{2C_s}{\pi s}$
$\therefore C(x,t)=-\int_0^\infty\dfrac{2C_s}{\pi s}e^{-Dts^2}\sin xs~ds+C_s=C_s\text{erfc}\bigg(\dfrac{x}{2\sqrt{Dt}}\biggr)$
Luckily it satisfies $C(\infty,t)=0$
$\therefore C(x,t)=C_s\text{erfc}\biggl(\dfrac{x}{2\sqrt{Dt}}\biggr)$
