In TEM, a high-energy electron beam passes through an ultra-thin sample. The interactions between the electrons and the atoms in the sample create an image or diffraction pattern that can be magnified and recorded. SEM, on the other hand, scans the surface of a sample with a focused electron beam, which causes secondary electrons to be emitted from the sample surface, generating a detailed image of the surface topography.