I am currently studying Quantum Field Theory from the textbook Overview of Quantum Field Theory and I am confused by two formulae presented in chapter 2 (2.39) and (2.40). The first is
$$(1)_{1-particle} = \int \frac{d^3p}{(2\pi)^3}|p\rangle\frac{1}{2E_p}\langle p|.\tag{2.39}$$
The textbook says this is the completeness relation. I sort of see it but I do not understand where the $\frac{1}{2E_p}$ comes from. Can anyone explain?
The second equation is also confusing; can anyone explain why this is true? My guess that it comes from the above completeness relation but I am not sure.
$$\int \frac{d^3p}{(2\pi)^3}\frac{1}{2E_p} = \int \frac{d^4 p}{(2\pi)^4}(2\pi)\delta(p^2 - m^2).\tag{2.40}$$