Why is it colder at higher altitudes?
I was told that, the closer one is to the sun the hotter it is. So why is it that, the higher the altitude one is at, the colder it is?
Well, the reason, Dennis, is if you think about it, the distance between the Earth and Sun is a very long way. It's a hundred million miles or so. And therefore, the distance between the Earth's surface and the top of Everest at 29,000 feet is a tiny fraction of the total distance to the Sun: in the grand scheme of things, it's a trivial change in the actual distance.
So that isn't why the temperature changes and therefore also why it isn't hotter. The reason it's actually colder is because, as you go up in the atmosphere, the Earth's atmosphere feels less pressure the higher up you go. So as the gas in the atmosphere rises it feels less pressure, which makes it expand. When the gas expands it does some work. And and if it's doing work, it must be losing some energy; and if it loses energy, its temperature must drop because we define temperature as the average energy of the particles. Therefore, if the energy of the particles is lower, the temperature must be lower. That's why, at altitude, the temperature appears to fall. In space, outside the earth's atmosphere, if you're facing the Sun, you can actually fry. That's why space suits are specially designed in order to keep people from getting too hot in the sunny bits but also prevent them from becoming too cold in the non-sunny bits.