As a qualified pilot, this is one of the first things we learn. The temperature drops by 1.98 degrees celsius for every 1,000 ft increase in altitude, it is called the 'dry adiabatic lapse rate' and comes from something called 'Boyles Law' - maybe you learned it in physics. It is to do with the pressure of gasses, and pressure changes the higher you climb - that's why you can use a barometer to detect altitude. Boyles Law says that a low pressure gas (including air) is cooler than a higher pressure gas