Let E = mc² = hf for a photon, where f is frequency, and "m" is the mass "equivalent" of the photon given they have no "rest mass". (It is important to recognise that stopping a photon to measure its mass eliminates it -so it has no "at rest" mass - crucial in Special Relativity where, to travel at the speed of light, mass would otherwise become infinite.)

Having "rigged" this mass problem,

p = momentum = mc (mass x velocity) = hf/c = E/c = h/l

The experiment shows that X-Rays and electrons behave exactly like ball bearings colliding on a table top using the same 2D vector diagrams. They enter the graphite at one wavelength and leave at a longer wavelength as they have transfered both momentum and kinetic energy to an electron. Momentum and energy are conserved in the collision if we accept the equation above for momentum of light.

When the photon enters at l0 and leaves at l1, its energy has changed from E0 to E1 and momentum from E0/c to E1/c with a change in direction of q. The electron gains Ek = E0 - E1

See for a diagram and more details

http://www.launc.tased.edu.au/online/sciences/physics/compton.html

The Compton Effect ( a different explanation)

Convincing evidence that light is made up of particles (photons), and that photons have momentum, can be seen when a photon with energy hf collides with a stationary electron. Some of the energy and momentum is transferred to the electron (this is known as the Compton effect), but both energy and momentum are conserved in this elastic collision. After the collision the photon has energy hf' and the electron has acquired a kinetic energy K.

Conservation of energy: hf = hf' + K

Combining this with the momentum conservation equations, it can be shown that the wavelength of the outgoing photon is related to the wavelength of the incident photon by the equation:

Δλ = λ' - λ = (h/m

_{e}c)(1 - cosq)

The combination of factors h/m

_{e}c = 2.43 x 10

^{-12}m, where m

_{e}is the mass of the electron, is known as the Compton wavelength. The collision causes the photon wavelength to increase by somewhere between 0 (for a scattering angle of 0°) and twice the Compton wavelength (for a scattering angle of 180°).

Source:

http://physics.bu.edu/~duffy/semester2/c35_compton.html

It has problems and examples and demonstration also.