From where does ozone come in the photochemical smog?

Sunlight cause photochemical decomposition of NO2 into NO and O.
NO2hvNO+[O]
Atomic oxygen is a highly reactive species. It combines with diatomic oxygen and forms ozone.
O2+O+MO3+M
Where, M is inert gas such as nitrogen. This, O3 is formed during the formation of smog.