The Math behind X-ray Crystallography