Energy from the sun travels to the Earth. The molecules on the Earth s surface convert this energy into heat. If air goes up it experiences a temperature change because it expands. It has the opportunity to expand because at the surface of the Earth there exists 1000 milibars of pressure, at the top of the atmosphere exist a vacuum, which gives rising air room to spread. Atmosphere is unstable if a parcel of air is warmer than the surrunding air.
Atmosphere is stable if a parcel of air is colder than the surrounding area.
Thermals are parcels of continuously rising air. CAPE - Convective Available Potential Energy. It is a direct measure of instability. The greater the CAPE, the more likely thunderstorms are to occur.