the troposphere is hotter near the earth's surface because heat from the earth warms this air. As the altitude increases the number of air molecules decreases, thus the average of their kinetic energy falls.
The temperature causes the air to either become more or less dense, which expands or lowers its pressure. Warm air is less dense than cold air, as air becomes less dense, the pressure increases
Hope this is helpful!!! (^_^)