How does transfer of thermal energy relate to earthquakes and volcanoes?

answer in two sentences

Transfer of thermal energy plays a significant role in causing earthquakes and volcanoes. In the case of earthquakes, thermal energy from the mantle can heat up and weaken the lithosphere, leading to the build-up of stress and eventual rupture. Similarly, in the case of volcanoes, the transfer of thermal energy from the mantle to the crust can cause the melting of rocks, leading to the formation of magma chambers and subsequent volcanic eruptions.