Energy and momentum conservation using Dirac delta function I found in many text of QED dealing with scattering,  the scattering matrix  $S_{fi} \propto$ $\delta^4(p_f -p_i)$. They say that the $\delta$ function ensures the conservation of momentum and energy. But as we know from basic physics rule that energy is always conserved and momentum is conserved in some specialized cases. So we know in advance that at least energy is conserved. Hence in delta function $\delta(E_f -E_i)$ we can directly put $E_i = E_f$ and that will give infinitely large value. So how it conserve the energy. Also we can not not integrate it like $\int dE_f \delta(E_f -E_i)$ as $E_f = E_i$ always. I am just stuck with that please clarify it.
 A: The scattering matrix elements you calculate in QFT have to be integrated over various phase space measures to yield measurable results. In this process all delta functions are expended and you end up with finite results (well, after renormalization) which also respect energy conservation since the delta functions vanish unless their arguments equal zero. The delta functions essentially restrict the region of integration in momentum space to the set of all values that conserve momentum.
See section 4.5 of Peskin & Schroeder for the gory details.
A: Thanks for the answer, In scattering problems
$$\sigma = \int |M^2| d^4 p_f 2\pi \delta^4(p_f -p_i) \delta(p_f^2 -m_0^2)$$
the $d^4p_f$ integration is all over phase space. So  I can  assume that keeping $p_i$ fixed we are integrating all over phase space..
here invariant phase space volume is given by
$$\int d^4p \delta(p^2 -m_0^2)\theta(p_0)  = \int d^4p \frac{(p_0 -E) +(p_0+E)}{2E} \theta(p_0) = \int d^3p dp_0  \frac{(p_0-E)}{2E} =  \int d^3p dp_0  \frac{(p_0-\sqrt{p_x^2+p_y^2 p_z^2 +m^2})}{2E}$$
I have one doubt can i  just perform p_0 integration independently keeping E constant (just like i do assuming p_i constant integrate over p_f)
$$\int dp_0  \frac{(p_0-E)}{2E} = \frac{1}{2E}$$
or constancy of E (or p_x, p_y, p_z) is valid only if I perform integration all over space..
$$\int d^3p dp_0  \frac{(p_0-\sqrt{p_x^2+p_y^2 p_z^2 +m^2})}{2E}$$ for all over space
