# Diffusion equation & separation of variables

1. Mar 26, 2006

hi
i have been trying to solve the diffusion equation using separation of variables. i know the answer should turn out something like the normal probability density function but its just turns into a mess when i try it.
i am given the following information:
$$\frac{\partial p}{\partial t}=D\frac{\partial^2 p}{\partial x^2}$$
where $$p=p(x,t)$$
$$p(0,0)=1$$
$$p(L,t)=0$$
$$p(-L,t)=0$$
where D is a constant (its not specified whether its negative or positive). it would be safe to say the sign for D which gives the easiest solution is the right one.
now this is what i did
$$p(x,t)=T(t)X(x)$$
$$X\frac{dT}{dt}=DT\frac{d^2 X}{dx^2}$$
which gives 2 equations, namely
$$\frac{1}{DT}\frac{dT}{dt}=\lambda$$ (1) and
$$\frac{1}{X}\frac{d^2X}{dx^2}=\lambda$$ (2)
solving (1) and applying the initial conditions and boundary conditions i get
$$T(t)=\exp(D\lambda t)$$
for (2) i assumed $$\lambda>0$$ to get
$$X(x)=a \exp(\sqrt{\lambda}x)+b \exp(-\sqrt{\lambda}x)$$
then finally you plug all back in to $$p(x,t)=T(t)X(x)$$
now i'm not sure where to go here, or how to apply the initial and boundary conditions and nor can i see how this would end up being something like a normal pdf (with an exp(-x^2) in there somwhere)

Last edited: Mar 26, 2006
2. Mar 26, 2006

### HallsofIvy

Staff Emeritus
Okay, why did you assume $\lambda$ is positive? What happens if it is negative? Also "p(0,0)= 1" is not sufficient. Initial values for partial differential equations are typically functions: what is p(x,0)? Unless there is a $$e^{-x^2}$$ in the initial condition you will not get one in the solution to the differential equation!

The general solution will be a sum of the separate solutions:
$$\Sigma X(x)T(t)$$

3. Mar 26, 2006

i assumed lambda to be positive so that the solution to (2) was an exponential (if its negative then i think the solution involves sin and cos, further i would not know what the solution is if lambda can be positive and negative). i am doing stuff to do with the distribution of random walking particles over a period of time, its behaviour is said to display a normal distribution. i thought i needed a function like p(x,0) but it was not given. could you explain why p(0,0)=1 is not sufficient? is the equation not solvable given the information in the first post?

cheers

Last edited: Mar 26, 2006
4. Mar 27, 2006

### J77

Firstly, on the positive assumption of $\lambda$...

In this problem, it's usual to take your $\lambda$ (seperation constant) as $-\lambda$ and $D$ as, say, $\alpha^2$, then you reqns become:

$\dot{T}+\lambda\alpha^2=0$

and

$\ddot{X}+\lambda\alpha^2X=0$

You should now see that the different signs of (this new) $\lambda$ give constant, normal or hyberbolic trig fn answers.

For you initial condition - you need to specify $p(x,0)=f(x)$ - I guess you want $f(x)=0$ which is fine but you should probably state $0\le x\le L$

Last edited: Mar 27, 2006