Muons are generated in the Earth’s upper atmosphere by cosmic rays (high energy protons) colliding with atomic nuclei of molecules in the air.
Muons can also be produced in a two-step process at large research facilities. High energy protons (>500 MeV) generated by a particle accelerator collide into a carbon or beryllium target. This high energy interaction between the incoming protons and the target protons or neutrons produces particles known as pions (π). Positive and negative pions are very unstable and almost immediately decay into positive and negative muons respectively as well as neutrinos. The muons are then selectively channelled into beamlines and transported to the spectrometer where the sample lies.
We can form surface muon beams from pions decaying at the surface of the target. That beam is made of positive muons only, as the negative muons are captured. We can also form high momentum beams of positive and negative muons, where the pion decays in flight.