I would like to obtain the solution of the diffusion equation $$ \frac{\partial p(x,t)}{\partial t} = D \frac{\partial^2 p(x,t)}{\partial x^2}$$ for reflecting boundary conditions at $x=-a$ and absorbing ones at $x=b$. These boundary conditions are $$ \frac{\partial p(x,t)}{\partial x}\Bigg|_{x=-a}=0 $$ and $$ p(b,t) =0.$$
Using separation of variables I found $$ p(x,t) = A \sum_{l=1,3,5,\dots} e^{-\lambda_l^2 D t}\Big[\cos(\lambda_l x) + \tan(\lambda_l a)\sin(\lambda_l x)\Big],$$ where $\lambda_l = \pi l/[2(a+b)]$ and $A$ is a coefficient I have not yet been able to determine. Because one boundary is absorbing, the probability distribution is not normalized at all times. It is only normalized when $t=0$. I would like to use this condition to calculate $A$.
Obviously I could set $t=0$ and integrate over $x \in [-a,b]$, but this gives an infinite series I'm unable to sum. I wonder if there is a trick. I know the initial condition is $\delta(x) = p(x,0)$. If I set $$\delta(x) = \frac{1}{2\pi}\sum_{n=-\infty}^\infty e^{i n x} = A \sum_{l=1,3,5,\dots} \Big[\cos(\lambda_l x) + \tan(\lambda_l a)\sin(\lambda_l x)\Big], $$ is there a way to manipulate the RHS to match factors of $e^{inx}$ and thereby solve for $A$?
I have a piece of notes which happens to solve this problem. As we know, the solution to the heat equation is the transition density of a Brownian motion.
When the BM on $[a,b)$ is reflected at $a$ and killed at $b$ its transition density $p(t;x,y)$ is obtained from the known transition density $q(t;x,y)$ of the BM on $(2a-b,b)$ which is killed at $2a-b$ or $b$ as follows:
From [1] p. 105 it follows that
\begin{eqnarray} q(t;x,y)&=&\frac{1}{\sqrt{2\pi t}}\sum_{n=-\infty}^\infty \Bigg(\exp\Bigg(-\frac{(x-y-4n(b-a))^2}{2t}\Bigg)\nonumber\\ &&~~~~~~~~~~~~~~~~-\exp\Bigg(-\frac{(x+y+2b-4a+4n(b-a))^2}{2t}\Bigg)\Bigg)\,. \end{eqnarray} In this equation we don't have a factor $1/2$ because in contrast to [1] we assume that the transition density is w.r.t. the Lebesgue measure, not the speed measure $2dx\,.$ The Brownian motion reflected at $a$ can be written as $a+|W_t-a|$ with a Brownian motion $W$ starting at $x\ge a\,.$ Also, if $W_t$ is killed at $2a-b$ or $b$ the reflected Browninan motion is killed at $b\,.$ The transition density we are looking for is therefore that of $a+|W_t-a|$ which is
\begin{eqnarray}\label{eReflectedKilled} p(t;x,y)&=& \frac{d}{dy}P\Big(a+|W_t-a|\le y\Big) = \frac{d}{dy}P\Big(-y+2a\le W_t\le y\Big)\nonumber\\ &=&\frac{d}{dy}\int_{-y+2a}^{y} q(t;x,z)\,dz=q(t;x,y)+q(t;x,-y+2a)\nonumber\\ &=& \frac{1}{\sqrt{2\pi t}}\sum_{n=-\infty}^\infty \Bigg(\exp\Bigg(-\frac{(x-y-4n(b-a))^2}{2t}\Bigg)\nonumber\\ &&~~~~~~~~~~~~~~~~-\exp\Bigg(-\frac{(x+y+2b-4a+4n(b-a))^2}{2t}\Bigg)\nonumber\\ &&~~~~~~~~~~~~~~~~+\exp\Bigg(-\frac{(x+y-2a-4n(b-a))^2}{2t}\Bigg)\nonumber\\ &&~~~~~~~~~~~~~~~~-\exp\Bigg(-\frac{(x-y+2b-2a+4n(b-a))^2}{2t}\Bigg)\Bigg)\,. \end{eqnarray}
[1] A.N. Borodin, P. Salminen. Handbook of Brownian Motion - Facts and Formulae. Birkhauser Verlag, Basel, Boston, Berlin 1996.