Solving the diffusion equation I am trying to clarify the relation between random walk and diffusion, and the source book proposes the following which I can't get. Starting from the diffusion equation
$$ \frac{\partial C}{\partial t} = D \frac{\partial^2 C}{\partial x^2}, $$
how can this be solved to get
$$ C = \frac{A}{\sqrt{t}} \mathrm{e}^{-x^2 / 4 D t} ?$$
 A: Another technique of solving this would be through self-similarity as explained here: 1D Heat equation: method of self-similar solutions. The only thing you need to recognize is that the math for heat and concentration is the same here.
A: The diffusion equation is a partial differential equation. The unknown quantity is a function $C(x,t)$. To complete the problem statement you need to specify an initial condition (at $t=0$) and boundary conditions. I'm guessing that your boundary conditions are at infinity, so we take
$$ C(x,t) \rightarrow 0,\ x\rightarrow \pm \infty. $$
We take a delta function initial condition:
$$ C(x, 0) = \delta(x). $$
The equation can be solved by using the Fourier transform:
$$ C(x, t) = \int_{-\infty}^{\infty} \frac{\mathrm{d}k}{2\pi}\ \mathrm{e}^{i k x} C_k(t). $$
The inverse transform is
$$ C_k(t) = \int_{-\infty}^{\infty} \mathrm{d}x\ \mathrm{e}^{-i k x} C(x, t). $$
So the transform of the initial condition is
$$ C_k(0) = 1. $$
Substituting $C(x,t)$ in the diffusion equation gives
$$ \int_{-\infty}^{\infty} \frac{\mathrm{d}k}{2\pi}\ \mathrm{e}^{i k x} \left(
\dot{C}_k(t) + D k^2 C_k(t) \right) = 0.$$
This simplifies to
$$ \dot{C}_k(t) + D k^2 C_k(t) = 0, $$
with the solution
$$ C_k(t) = C_k(0) \mathrm{e}^{- D k^2 t} = \mathrm{e}^{- D k^2 t}. $$
Putting it all together
$$ C(x, t) = \int_{-\infty}^{\infty} \frac{\mathrm{d}k}{2\pi}\ \mathrm{e}^{i k x} \mathrm{e}^{- D k^2 t}, $$
and all that's left is to do the $k$ integral. Note that the $k$ integral is a Gaussian so, with a little massaging, you can do it with the formula
$$ \int_{-\infty}^\infty \mathrm{d}y\ \mathrm{e}^{-y^2} = \sqrt{\pi}. $$
You should get
$$ C(x,t) = \frac{1}{\sqrt{4 \pi D t}} \mathrm{e}^{-\frac{x^2}{4 D t}}. $$
A: The other respondents have answered with math, so I'm going to try and express what they've said in words.
The solution you've written is called the impulse response. It shows what happens if you suddenly deposit a concentrated amount of heat at a single point. The heat spreads out into a Gaussian distribution which gets wider as it gets smaller. The product of the height and the width is a constant, because there is a constant quantity of heat. The width grows with the square root of time, just like the average displacement of the random walk.
You can do the same thing with Fourier Transforms if you know that the transform of a Gaussian is a Gaussian, except with reciprocal relations of width and height. You also have to know that under the diffusion equation, sine waves remain sine waves for all time, except they shrink; and the faster they wave, the faster they shrink. The rate of shrinking is quadratic in wave number, so $\sin(2x)$ shrinks four times as fast as $\sin(x)$.
(Like the Gaussian, the total quantity of heat is a constant, except for the sine waves that constant is zero because the positive heat is balanced by the negative heat.)
With Fourier Transforms, you take your initial spike function (the concentrated limit of a delta function) and transform it to a constant function. This tells you the spike is made up of a distribution of sine waves equally distributed according to wave number from zero to infinity. These all shrink according to the square of the wave number. So after a time $T$ the function $\sin(x)$ has shrunk by $T^2$, and the function $\sin(2x)$ has shrunk by $4T^2$. If you draw a graph of all possible sine waves showing how much they've shrunk at time $T$, you will see that it's a Gaussian function. This is what the spike looks like in the frequency domain...to see what it looks like in the space domain, you have to take the Inverse Fourier Transform...which happens to be the same as taking a Fourier Transform. Since the Fourier Transform of a Gaussian is just a Gaussian, you have now shown that the spike in the space domain spreads out as a Gaussian.
With a little more work you can convince yourself that the rate of spreading does in fact go as the square root of time, as implied by your original equation.
A: As others have pointed out the connection of the diffusion equation with Gaussian distribution, I want to add the physical intuition of the diffusion equation. Think of cream mixing in coffee. Thick concentrated cream can be considered as a delta function. After a few spoon strokes, cream passes through various stages of stretching and folding and finally smeared out due to diffusion. The role of diffusion is to wipe out the concentration gradients. 
