We rigorously derive the main results of thermodynamics,including Carnot’s theorem, in the framework oftime-varying linear systems.