Mean energy of free electrons My textbook states that the mean energy of free electrons within a solid state is given by $$ E_{av} = \frac{U}{N} = \frac{\int_0^{k_f}D(k)E(k)dk}{\int_0^{k_f}D(k)dk} $$ where $D(k)$ is the density of states  and $k_f$ the fermi-wave-vector.
With $D(k) = \frac{m}{\pi^2\hbar^2}k$ and $E(k) = \hbar^2 k^2 /2m $ I receive 
$$ U=\frac{k_f^4}{8\pi^2} \, \,\, \, , \,\,\, N=\frac{m}{2\pi^2\hbar^2}k_f^2$$
thus $U/N = \hbar^2 k_f^2/4m = E_f/2 $ which is obviously wrong.
I don't see my mistake.
If I convert $D(k)$ in $D(E)$ with $E=\hbar^2k^2/2m$ and calculate $$U=\int_0^{E_f}D(E) E\, dE$$ and $$N=\int_0^{E_f}D(E)dE$$ I get the correct solution of $E_{av} = 3/5 E_f$.
What am I doing wrong? I am quite sure that I didn't do the calculations wrong, so the error must be caused by assumptions. 
 A: The expression that you wrote for the density of states is for a free electron gas in 2D. Your answer is right, if you have a 2D free electron gas.  However, for a 3D gas, the density of states per volume is given by $$D(k)=\frac{k^2 }{ \pi^2}$$ 
You get the above expression as follows:
$$D(k)\ dk\times Volume= \underbrace{2}_{\mbox{spin degeneracy}}\times \underbrace{4\pi k^2 dk}_{\mbox{3D volume element in k-space}} \div \underbrace{\left(\frac{2 \pi}{L}\right)^3}_\mbox{Volume occupied by 1 state in k-space}$$
where L is the length of the container.  
Some brief explanation of the origins of the terms:
We multiply by 2 for spins because electrons are spin-1/2 particles and therefore each k-state will have a degeneracy of $2(1/2)+1=2$.
The $4 \pi k^2$ factor is obtained following the same reasoning as you would to find the volume occupied between $r$ and $(r+dr)$, by a sphere.
From periodic boundary conditions, we find that states are uniformly spaced by $\frac{2 \pi}{L}$ in k-space.  Therefore the volume occupied by each k-state is simply the cube of that.
If you use this expression, you will indeed get the mean energy to be $\frac{3E_F}{5}$.
A: I think that finally understood why you are confused.
The density of states which your question gave is for a 2D electron gas, and not a 3D gas.  Therefore, your first answer of $E_F/2$ is correct!
You should get the same result even if you integrate with respect to E rather than k.  The probably got a different answer because of an algebraic mistake.
Here is the calculation:
$$\frac{dN}{dk}=\frac{dN}{dE} \frac{dE}{dk} $$
$$\frac{dE}{dk}=\frac{\hbar^2k}{m}$$
$$\frac{dN}{dk}=\frac{mk}{\pi^2 \hbar^2}$$
$$\implies \frac{dN}{dE}=\frac{m^2}{\hbar^4 \pi^2}=constant$$
$$U=constant \times \frac{E^2}{2}$$
$$N=constant \times E$$
Therefore, $$<E>=\frac{U}{N}=\frac{E_F}{2}$$
A: The density of states for a 3D gas is $\underbrace{2}_{\text{spin degeneracy}} \times \underbrace{4\pi k^2}_{\text{surface of sphere in momentum space}} \underbrace{\frac{V}{\pi^3}}_{\text{volume of single k-state}}$.
