Derivation of the Energy of the Scalar Field I am trying to derive the energy of the scalar field by substituting the field expression:
$$\phi\left(x\right)=\int\frac{d^{3}k}{\left(2\pi\right)^{3}2\omega_{k}}\left[a\left(k\right)e^{-ikx}+a^{\dagger}\left(k\right)e^{ikx}\right]$$
into the Hamiltonian 
$$H=\frac{1}{2}\int\left[\left(\partial_{0}\phi\right)^{2}+\left(\boldsymbol{\nabla}\phi\right)^{2}+m^{2}\phi^{2}\right]d^{3}x.$$
The result is $$H=\int\frac{d^{3}k}{\left(2\pi\right)^{3}2k_{0}}\frac{k_{0}}{2}\left[N\left(k\right)+\frac{1}{2}\right]$$ where $N$ is the number operator.
How can I take the integrals that emerge on this substitution?
The arguments of the exponential functions contain four-vector products whereas the integrals are over spatial dimensions only. Does it mean that the temporal parts should be written as a factor after taking the spatial integrals?
Edit: I have now solved the problem and I am putting my solution for the benefit of other students. Please warn me in case you still detect mistakes in these calculations: page 1 page 2
 A: As awful as it sounds, you'll just have to do a painfully long computation here. Take the derivatives you need to take there (time and space for the first and second term in the integral).
You can then use:


*

*The orthogonality of the Fourier expansion: $\int d^3x~ e^{ipx}e^{-ip'x} = (2\pi)^3 \delta^3(\vec{p}-\vec{p}')$

*The commutation relations for the ladder operators: $[a(p),a(p')]=[{a^\dagger(p)},{a^\dagger(p')}]=0$ and $[a^\dagger(p),a(p')]=(2\pi)^32E_p\delta^3(\vec{p}-\vec{p}')$

*The energy momentum relation: $E_p^2 = \vec{p}^2 +m^2$


Perform the integrations over the single terms of $\phi$ and its derivatives separately and add them up. You will see that you're ending up with some of the ladder operator products vanishing due to the E-p-relation, except those you need to build $N(\vec{p})$ (again, use the E-p-relation when adding them up!). Moreover, there will be a bunch of diverging constants left, all involving some integral over $\delta^3(0)$. Absorb them into $C$. It might seem weird but is common practice in particle physics.
If you perform the calculation cleanly, which is no magic but pure work here, you will end up right with the result you want to get. Good luck!
