# Help with derivation of the Casimir Effect?

I am at the very last part of a relatively long derivation of the Casimir effect, and I just don't understand the final step D:

So far, I have derived the ground state energy to be $$\langle 0| \hat{H} |0\rangle = \delta (0) \int _{-\infty}^{\infty} dp \frac{1}{2} E.$$

And for a massless field using Plank units and using $E=\sqrt{p^2+m^2}$, then $E=p$. Between the two parallel plates, only virtual particles of discrete $p$ can exist which are $p=\frac{h}{\lambda}$ and using $\hbar=1$ and $\lambda=\frac{2d}{n}$ where $d$ is the distance between the parallel plates. This means that the summation becomes $\frac{\pi}{2d} \sum\limits_{n=1}^{\infty}n$which I find by assuming $$\sum\limits_{n=1}^{\infty}n=\sum\limits_{n=1}^{\infty}ne^{-an}=-\frac{d}{da}\sum\limits_{n=0}^{\infty}e^{-an}.$$ Which gave the sum to infinity of $\frac{e^a}{(e^a-1)^2}$

Using the Taylor expansions, the first two terms of this result are $\frac{1}{a^2}-\frac{1}{12}$ and subsequent terms are irrelevant because I take $a\rightarrow 0$ for the sum to become the sum of all natural numbers. Placing $\frac{a\pi}{d}$ for $a$, this gives the sum $\frac{\pi}{d}\sum\limits_{n=1}^{\infty}n$. So when I put this result back in, I get that the energy density of the vacuum (assuming that $\delta(0)$ corresponds to the volume of space, is $$\frac{d}{2\pi a^2}-\frac{\pi}{24d}.$$

Okay, so this is the part that I don't get. To eliminate the infinity, I considered adding a third plate and moving it away to infinity, so the lengths are as shown:

           L (from first to third plate)
|___|____|
d  L-d


Now here I want to find the relative energy density between the plates, take the derivative with respect to d to find the force, and move L away to infinity to remove the infinities. My problem is that, looking back over my notes, I have added the energy densities between the first and second plate and second and third plate to give

$$E(d)=\frac{d}{2\pi a^2} -\frac{\pi}{24d} +\frac{L-d}{2\pi a^2}-\frac{\pi}{24(L-d)}$$

which works out because then using $F=-E'(d)$ gives the force being $$-\left(\frac{\pi}{24d^2} +\frac{\pi}{24(L-d)}\right)$$ which works out perfectly to give the force being $\frac{\pi}{24d^2}$ when you move the third plate to infinity away.

But I just can't figure out why I added the energy densities in my notes?