The MFM technique involves scanning a magnetized tip over the surface of a sample. The tip, typically coated with a magnetic material, interacts with the magnetic domains of the sample. The tip experiences forces due to magnetic interactions, and these forces cause deflections in the cantilever. These deflections are detected and measured using a laser beam and a photodetector system. The data collected is then used to create detailed images of the magnetic field distribution on the sample surface.