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} ?$$

  • $\begingroup$ What do you mean "differentiated"? If the diffusion coefficient $D(c)$ is a constant then the second expression is a solution of the diffusion equation with some simple boundary & initial conditions, which you can check by substituting it in. Are you asking how the diffusion equation is solved in the first place? $\endgroup$
    – Michael
    Commented Mar 2, 2013 at 10:51
  • $\begingroup$ Also there are some changes in notation from the first line to the second: $C\rightarrow c$, $D(c)\rightarrow d$, $x\rightarrow z$. What source(s) are you using? $\endgroup$
    – Michael
    Commented Mar 2, 2013 at 10:53
  • $\begingroup$ @MichaelBrown yes D(c) should be assumed as a constant. I am asking to how can i get the second expression as a solution to first equation. $\endgroup$
    – user21535
    Commented Mar 2, 2013 at 10:57
  • $\begingroup$ @MichaelBrown sorry for the notation faults. x=z C=c and D(c)=d in the equations. $\endgroup$
    – user21535
    Commented Mar 2, 2013 at 10:59
  • $\begingroup$ Ok. I've fixed up the question a bit (note that this site supports MathJax for equation rendering). So what have you tried so far? $\endgroup$
    – Michael
    Commented Mar 2, 2013 at 11:16

4 Answers 4


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}}. $$

  • $\begingroup$ I have been living with a doubt ever since I used the Fourier transform (FT) to solve the diffusion equation. The PDE is first-order in time and second-order in space. As you correctly pointed out, we indeed need to specify two boundary conditions 𝐶(𝑥,𝑡)→0, 𝑥→±∞ along with one initial condition. Now, in solving the equation using the FT, where do we use the boundary conditions? It would be nice if you could please help me. Thanks in advance. $\endgroup$
    – ddas
    Commented Feb 19, 2022 at 13:31

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.

  • $\begingroup$ +1: Good stuff. Just to expand a bit for the OP's sake: scaling solutions are only applicable to some equations, but these include quite important equations, even nonlinear ones. When scaling works it can give great insight to the underlying phenomena. Fourier/Laplace transform techniques are broadly applicable to linear equations but do not necessarily give insightful solutions or rapid convergence. When in doubt both techniques are worth trying. $\endgroup$
    – Michael
    Commented Mar 2, 2013 at 12:48
  • $\begingroup$ Thanks for having shared the link! I came across this concepts the first time in Batterman's book, but couldn't understand It formally. This for sure helps. i still have to try to understand more of this self similar methods and if are related (and how) to the renormalization group ideas. (I realized Only now how old this answer Is) $\endgroup$
    – Ratman
    Commented Jan 13, 2021 at 23:36

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.


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.