Suppose we are given two conducting, cocentric spheres of radius $a_1$ and $a_2$ respectively. The inner sphere with charge $q$, the outer sphere with charge $-q$.
I can calculate the capacitance of this system by calculating the potential difference $U$ between the plates and then use the definition $C = q / U$. This is easy enough and indeed gives me the right result
$$C = \dfrac{4\pi \epsilon_0}{a_1^{-1} - a_2^{-1}}$$
But now I tried to caluclate $C$ by finding out the energy stored in the system in two different ways: First we have the expression $$W_{el} = \frac12 \frac {q^2}C$$ for the energy stored in any capacitor. Now I wanted to compare this to the energy stored in the electric field (since that's where the energy is, right?!) $$E(r) = \begin{cases}\frac1{4\pi \epsilon_0} \frac q{r^2} & a_1 < r < a_2 \\ 0 & \text{otherwise}\end{cases}$$ to derive the above formula for $C$ again. The energy density is $w_{el} = \frac {\epsilon_0} 2 E^2$, therefore the energy stored in the electric field is \begin{eqnarray*} W_{el} &=& \int w_{el} \;\mathrm{d}V \\ &=& 4\pi \int_{a_1}^{a_2} \frac{\epsilon_0}2 \left(\frac1{4\pi \epsilon_0} \frac q{r^2}\right)^2 r \; \mathrm dr \\ &=& \frac1{4\pi \epsilon_0}\frac{q^2}{2} \int_{a_1}^{a_2} \frac{\mathrm d r}{r^3} \\ &=& \frac1{4\pi \epsilon_0}\frac{q^2}{2} \frac14\left(\frac 1{a_1^4} - \frac1{a_2^4} \right) \end{eqnarray*}
Comparing the two expressions gives
$$C = \dfrac{16\pi \epsilon_0}{a_1^{-4} - a_2^{-4}}$$
So my question is: Why is this wrong? Where is the energy in this capacitor stored, if not in the electric field (as it doesn't seem to be - unless I have made a mistake in deriving the result somewhere...)?
Edit: I also noticed, that the second result can be rewritten as
$$C = \dfrac{4\pi \epsilon_0}{a_1^{-1} - a_2^{-1}}\frac 4{a_1^{-3} + a_1^{-2}a_2^{-1} + a_1^{-1}a_2^{-2} + a_2^{-3}}$$
but I don't know whether this has any significance.
Thanks for reading and any help will be greatly appreciated! :)