Sometimes it is shown that in a Compton scattering it is not possible that the photon transfers all it's momentum and energy to the electron, see for example here:
If one assumes complete energy and momentum transfer the corresponding energy equation is:
$$ h\nu + m_0c^2 = 0 + \sqrt{m_0^2 c^4 + p^2c^2} $$
where $\nu$ is the frequency of the incoming photon and $m_0$ the rest mass of the electron and $p$ the momentum of the electron after the scattering.
The momentum equation is:
$$ \frac{h\nu}{c} + 0 = 0 + p $$
Substituting for this for $pc$ in the energy relation gives:
$$ h\nu + m_0 c^2 = \sqrt{m_0^2 c^4 + h^2\nu^2} $$
Squaring both sides results by the binomial formula in $2h\nu m_0 c^2 = 0$ which is a contradiction since $\nu \neq 0$ and $m_0c^2 \neq 0$.
In the photoelectric effect however the photon seems to give all it's momentum and energy to the electron? I guess that the corresponding conservation laws are nevertheless valid because the atom or complete metal will get some energy any momentum, but how can one see this and the difference to the compton effect in formulas?