In general, the latter has a rather complicated form. As we discussed in Chapters 6 and 7, the total energy of a system can change only if it interacts with its environment. Such changes in energy require work. From a microscopic point of view there is no physical distinction between heat and work. The manifestation of random motion without net displacement is the temperature of the material, which as we learned is proportional to the internal energy.
Energy flows out of one system into the other due to the difference in the temperatures.
From a microscopic point of view, heat is the work done by the forces between the molecules of the two systems. Work can also be accompanied by an average displacement or velocity of the system. For example, if we stir a cup of water very vigorously, it becomes hotter. In this case, the mechanical energy performed by our hand increases the internal energy of the particles. Contrast this to the case where we put two systems with different temperatures in contact but do not move things around.