If a single particle sits on an infinite line and undergoes a 1-D random walk, the probability density of its spatio-temporal evolution is captured by a 1-D gaussian distribution.

\begin{align} P(x,t)&=\frac{1}{\sqrt{4 \pi D t}}e^{-\frac{(x-x_0)^2}{4Dt}} \end{align}

However, suppose there are impassable boundaries on the line; on one side, or on both sides. Are there any boundary conditions for which there exists a closed form probability density function for how this particle will behave over time? Any references to such solutions would be extraordinarily helpful.

EDIT. Attempting to generalize Emilio's result below for an arbitrary initial particle position $-L/2 < x_0 < L/2$.

I had to work it out by example. I found the following "images" were required to account for reflections of an off-center particle at position $x_0$: for the first and second reflections on both sides the new gaussians had to be centered on ($-2L+x_0$, $-L-x_0$, $x_0$, $L-x_0$, $2L+x_0$). From the pattern I think the full solution can be expressed, for all integers $n$, as:

\begin{align} P(x,t)&=\frac{1}{\sqrt{4 \pi D t}}\sum_{n=-\infty}^\infty e^{-\frac{(x-nL-(-1)^nx_0)^2}{4Dt}} \end{align}

where the old $x_0$ is now defined as $nL+(-1)^{n}x_0$

  • $\begingroup$ what type of steps are you taking? Also, what do you mean be "impassible"? Do you mean you reject any step that takes you over the boundary? $\endgroup$
    – Mike Flynn
    Commented Jul 19, 2013 at 17:47
  • $\begingroup$ Periodic boundary conditions spring to mind. $\endgroup$
    – Johannes
    Commented Jul 19, 2013 at 17:58
  • $\begingroup$ General word of advice: "closed form" isn't terribly well defined. What people generally mean is "in terms of nice functions that I like and understand" but this is clearly subjective. There are many solutions to physically-inspired math problems are perfectly well-behaved and analytic, but that no one has bothered assigning abbreviations to like $\mathrm{e}$, $\sin$ or $J_0$. These functions are still manipulable and easily calculable to arbitrary precision. $\endgroup$
    – user10851
    Commented Jul 19, 2013 at 18:00
  • 4
    $\begingroup$ Why is there a closevote on this? It is a perfectly legitimate, well defined and well formulated question. $\endgroup$
    – Dilaton
    Commented Jul 19, 2013 at 19:19
  • $\begingroup$ @MikeFlynn exactly. There are multiple ways to impose a boundary condition where particles are not permitted to pass beyond, and I'm interested for now in any of those conditions. $\endgroup$
    – vector07
    Commented Jul 21, 2013 at 5:34

2 Answers 2


This can probably be solved by the method of images, depending on your precise formulation of the problem. The main idea would be to place image particles at the initial time at positions given by treating your impassable boundaries as mirrors; this makes the probability flow at the boundary zero.

To give a more precise formulation, suppose your problem is $$ \frac{\partial P}{\partial t}=D\frac{\partial^2P}{\partial x^2}\text{ under }\frac{\partial P}{\partial x}(-L/2,t)=0=\frac{\partial P}{\partial x}(L/2,t)\text{ and }P(x,0)=\delta(x), $$ where I've initially placed the particle in the middle of the barriers for simplicity but this can be altered. The solution is then given, by linearity, by your expression, added up for $x_0=nL$ for all integers $n$: $$ P(x,t)=\frac{1}{\sqrt{4 \pi D t}}\sum_{n=-\infty}^\infty e^{-\frac{(x-nL)^2}{4Dt}}. $$ This can be solved exactly in terms of Jacobi theta functions, which makes the calculations and graphing a lot faster, but does not necessarily (at a first go) make this easier to work with: $$ P(x,t)=\frac{1}{L}\vartheta _3\left(\frac{\pi x}{L},e^{-\frac{4 D \pi ^2 t}{L^2}}\right). $$ (For asymetrically placed initial particles, you would have two series of gaussians separated by $2L$, so therefore two theta functions.)

I'm not sure this is very useful by itself, but the method of images is very powerful.

  • $\begingroup$ There was also good fun in taking $P\mapsto\psi$ to be a wavefunction. This forces you to re-normalize, and the dependence of this factor on $D$, if I remember correctly, are a nice exercise for someone with much too much time on their hands. $\endgroup$ Commented Jul 19, 2013 at 18:25
  • 1
    $\begingroup$ Just a comment on series solutions: I think your example converges pretty quickly, but with different boundary conditions the convergence can be very slow. It is worth trying the Poisson summation theorem in these cases. In the linked case Poisson summation unexpectedly collapsed a numerically awful series (thousands of terms needed) to a very simple analytic solution. $\endgroup$
    – Michael
    Commented Jul 20, 2013 at 9:58
  • $\begingroup$ Interesting, I need to digest this. What exactly does a mirror boundary imply? Is it equivalent to saying that for a specific particle trajectory, a particle that might have traveled distance $x_a+x_b$, where $x_a$ is the distance to the boundary, and $x_b$ is the distance it might have traveled past the boundary, instead travels distance $x_a-x_b$? $\endgroup$
    – vector07
    Commented Jul 21, 2013 at 5:45
  • $\begingroup$ @vector07 Yeah, that's about it. You "fold back" all trajectories at the boundary, which means the boundary has probability 1 of reflecting. For every trajectory that travels $x_a-x_b$ there are then equally many that go left as well as right, so that mid-interval points still have probability 1/2 for right and left. $\endgroup$ Commented Jul 21, 2013 at 13:21
  • $\begingroup$ It is easier, though, to re-think the "folding back" as adding another mirrored copy of your trajectory tree behind the "mirror" at the boundary. $\endgroup$ Commented Jul 21, 2013 at 13:22

Your solution is in fact a particular solution of the 1-Dimensional heat equation, $\frac{\partial P}{\partial t} = D \frac{\partial^2 P}{\partial x^2}$,with initial condition $P(x,0) = \delta (x-x_0)$

A traditionnal way to solve this equation is to use Fourier Series

See some solutions in 1-D, like homogeneous equations or inhomogeneous equations, or other examples


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.