How is carbon 14 produced in the atmosphere?

Carbon-14 is produced in the upper atmosphere when cosmic rays produce thermalised neutrons, by hitting atomic nuclei. If these thermalised neutrons then hits a Nitrogen neuclei it creates Carbon 14.