How to arrive at this solution to this PDE? This sort of problem is well documented, but, I can not see how to get this solution;
The problem is:
$$\frac{\partial c}{\partial t}=D\frac{\partial^2 c}{\partial x^2}, 0 < x < \infty, t > 0$$
with boundary conditions $c(0,t)= C_0, c(x,0) = 0$ and possibly $\lim_{x \rightarrow \infty}c(x,t) = 0$ as the capillary that the model is modelling is infinitely long. 
whose solution is 
$$c(x,t)  = 2C_0\bigg( 1-\frac{1}{\sqrt{2\pi}}\int^z_{-\infty}\exp(-\frac{s^2}{2})  ds \bigg), z = \frac{x}{\sqrt{2Dt}}$$
Now I have let $c(x,t) = X(x)T(t)$ and then obtained
$$\frac{T'}{DT} = - s^2 = \frac{X''}{X}$$
we have 
$\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}$
so
$$ u(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$$
but my initial conditions give, first
$$\int_0^\infty C_2(s)e^{-Dts^2}ds = C_0$$
then changing variables $s = \sqrt{\frac{r}{D}}$
$$\int_0^\infty \frac{1}{2}\sqrt{\frac{D}{r}}C_2(r)e^{-tr}ds = C_0$$
$$ L[ \frac{1}{2}\sqrt{\frac{D}{r}}C_2(r)] = C_0$$
the inverse Laplace transformation of the right and side is a multiple of the delta function.... I feel like I have taken the wrong way. 
 A: Of course use separation of variables:
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_0$ :
$\int_0^\infty C_2(s)e^{-kts^2}~ds=C_0$
$C_2(s)=C_0\delta(s)$
$\therefore c(x,t)=\int_0^\infty C_1(s)e^{-Dts^2}\sin xs~ds+\int_0^\infty C_0\delta(s)e^{-Dts^2}\cos xs~ds=\int_0^\infty C_1(s)e^{-Dts^2}\sin xs~ds+C_0$
$c(x,0)=0$ :
$\int_0^\infty C_1(s)\sin xs~ds+C_0=0$
$\mathcal{F}_{s,s\to x}\{C_1(s)\}=-C_0$
$C_1(s)=\mathcal{F}^{-1}_{s,x\to s}\{-C_0\}=-\dfrac{2C_0}{\pi s}$
$\therefore c(x,t)=C_0-\dfrac{2C_0}{\pi}\int_0^\infty\dfrac{e^{-Dts^2}\sin xs}{s}~ds=C_0~\text{erfc}\left(\dfrac{x}{\sqrt{4Dt}}\right)$
It luckily satisflies $\lim\limits_{x\to\infty}c(x,t)=0$ .
$\therefore c(x,t)=C_0~\text{erfc}\left(\dfrac{x}{\sqrt{4Dt}}\right)$
