Nitrogen and oxygen molecules dissociate on hot metal surfaces such as those found in car engines creating nitrogen and oxygen atoms which can recombine to form nitrogen monoxide.
N2 + O2 --> 2NO
Nitrogen monoxide (a primary pollutant) is slowly oxidised to nitrogen dioxide (a secondary pollutant) by oxygen, ozone and HO2 radicals.
2NO + O2 --> 2NO2
Nitrogen dioxide undergoes photolysis in the presence of sunlight creating highly reactive oxygen atoms.
NO2 + hf --> NO + O
These oxygen atoms react with oxygen molecules forming ozone.
O + O2 + M --> O3 + M where M is a third body, typically a nitrogen molecule.
Ozone reacts with hydrocarbons (another primary pollutant) to form a complex mixture including aldehydes (a secondary pollutant).
O3 + hydrocarbons --> complex mixture including aldehydes (RCHO)