A heat engine is a system that transfers heat from a hot to a cold body, and uses some of the heat to do useful work. Not all of the heat can be converted into useful work, and in fact there is a theoretical limit to the efficiency of a heat engine in per cent, given byAs energy is transferred the entropy of each body changes, with the entropy change given byThe entropy change is positive if a body gains energy becauseis positive, and negative if a body loses energy becauseis negative.
In the above machineandThe efficiency of the above machine is the maximum possible at 40%. The entropy change of the machine is
The over entropy change is not zero however because 160J is transferred to the surroundings, and will increase the entropy of the surroundings because is positive for the surroundings. If the machine is less efficient that the perfect heat machine, the entropy of the machine itself will increase since more heat will be transferred to the cold reservoir, so it's entropy will in crease by more and energy will still be transferred to the surroundings, so increasing their entropy.