Between the Earth and the sun, there is a vast expanse of vacuum, with no molecules present, which means that heat has to be transferred without a medium. There are three forms of heat transfer: conduction, convection and radiation. Of these three processes, conduction and convection require the presence of a medium to transfer heat, thus eliminating them as viable methods of heat transfer across space.
Radiation does not require the presence of molecules to transfer heat, since it relies on the use of infrared waves. Infrared waves are a part of the electromagnetic spectrum, which consists of waves of different wavelengths and frequencies that can transfer energy without a medium.
The electromagnetic spectrum also includes the visible spectrum, which has all the visible colors of light. A scientist named William Herschel measured the temperature of all the colors of light and found that red color had the highest temperature. When he placed a thermometer beyond the red end of the spectrum, he noticed an even higher temperature, which suggested the presence of an invisible wave that could carry heat. Since this wave was present just beyond the red end of the spectrum, it was named infrared and has since been accepted as the mode of heat transfer from the sun.Learn more about Our Sun