Density is a physical property of substances that compares the relationship between volume and mass. Density is affected by temperature because as temperature increases so does the kinetic energy of the particles.
The more kinetic energy a substance has, the warmer it will be and the faster particles will be moving, which reduces the density of the substance.
When temperatures rise, the air becomes less dense and rises, which is known as a low pressure system. When temperatures fall, the air becomes more dense and is known as a high pressure system.
When the change in temperature is significant enough, a substance can change its phase from a solid to a liquid or gas, or condense from a gas to a liquid or solid.
When temperatures increase, objects expand and become larger and therefore the density decreases. When temperatures decrease, objects condense and become smaller so density increases.
Temperature can only alter the number of molecules in an area. However, temperature cannot affect how many protons and neutrons are in each atom.