It's been a while since I've had to solve the heat equation, and so I am having a slight issue. The question is as follows:
A long, hollow, rigid tube, of length $L$ and constant cross section is initially filled with water. It is placed in a solution of colloidal particles, with number density $n_0$, dissolved in water.
The tube is impermeable to the particles. At time $t = 0$ the end of the tube at $x = 0$ is opened to allow the particles to enter. Solving the diffusion equation using the method of separation of variables (including the solution that corresponds to separation constant zero), or otherwise, show that the number density of colloids in the tube is: $$\frac{n(x,t)}{n_{0}}= 1-\sum_{p=0}^{\infty}\frac{4}{(2p+1)\pi}\sin\left(\frac{(2p+1)\pi x}{2L}\right)\exp\left(-D\left(\frac{(2p+1)\pi}{2L}\right)^{2}t\right)$$
Now, the diffusion equation is as follows:
$$\frac{\partial n}{\partial t}=D\nabla^{2}n$$
But physically we notice that the only variation will be along the $x$-axis, so the equation simplifies to the one-dimensional heat equation:
$$\frac{\partial n}{\partial t}=D\frac{\partial^{2} n}{\partial t^{2}}$$
Using the method of characteristics, we use the ansatz $n(x,t)=\chi(x)\tau(t)$, thus:
$$\chi(x)\frac{\partial \tau}{\partial t}=D\tau(t)\frac{\partial^{2}\chi}{\partial x^{2}}$$
Thus, introducing a separation constant $k$, we have:
$$\frac{1}{\chi(x)}\frac{\partial^{2}\chi}{\partial x^{2}}=-k^{2}$$
And:
$$\frac{1}{\tau(t)}\frac{\partial^{2} \tau}{\partial t^{2}}=-Dk^{2}$$
Which clearly have solutions:
$$\chi(x) = \alpha \sin(kx) + \beta \cos(kx), \quad \tau(t) = \exp\left(-Dk^{2}x\right)$$
We now examine the boundary conditions, which are $n(0,t) = n_{0}$ and $n(L,0) = 0$. However, I have forgotten how to derive the $k_{n}$ from this. Usually I would make an argument for choosing $\alpha = 0$ or $\beta = 0$, and then justify why $k_{n}$ must have a particular value. However, here I am not sure, as $n(0,t) = n_{0}$ would suggest to me that $\alpha = 0$, but then I would have a set of cosine terms.
Can anyone point me in the right direction?
The method of separation of variables is only directly useful for homogenous boundary conditions. In your case you have non-homogenous conditions. At the left hand side - you are fixed at $n_0$ and the right hand side is a bit up to question (at least to me). Judging by the form of the answer that is expected, I think it's reasonable to assume that the RHS satisfy Neumann conditions so the density of particles is uniform at length $L$.
Assuming that, we can still use separation as follows. First we ask what will be the equilibrium distribution of the particles i.e. what is $$n(x) = \lim_{t\to\infty} n(x, t)$$ With the boundary conditions in question the answer is $n(x) = n_0$, a constant across the length.
Now we can convert the original problem into one with homogenous conditions. Define $$\hat{n}(x, t) = n(x, t) - n(x) = n(x, t) - n_0$$
This function $\hat{n}(x, t)$ now has Direchlet bcs at the LHS, Neumann at the RHS, and satisfies the initial conditions: $$\hat{n}(x, 0) = -n_0$$
Now you can proceed as you were to find $\hat{n}$.