When the Carnot engine works, the working substance of the engine goes through a different cycle known as the Carnot cycle, and this cycle consists of four different stages.

1. First stage (called isothermal expansion)
In this stroke, the barrel is placed over the source. The piston is gradually pushed back as the gas expands. Fall of temperature, due to expansion, is compensated by the supply of heat from the source, and consequently, the temperature remains constant. The conditions of the gas change from A(P1, V1) to B(P2, V2). If W1 is the work done during this process, then heat Q1, derived from the source is given by
W1 = -nRT1 loge(V2 / V1)
2. Second stage (called adiabatic expansion)
The barrel is removed from the source and is placed over the insulating stand. The piston is pushed back so that the gas expands adiabatically, resulting in a fall of temperature from T1 to T2. The conditions of the gas change from B(P2, V2) to C(P3, V3). If W2 is the work done in this case, then
W2 = nCv(T2 – T1)
3. Third stage (called isothermal compression)
The barrel is placed over the sink. The piston is pushed down, thereby compressing the gas. The heat generated due to compression flows to the sink, maintaining the temperature of the barrel constant. The state of the gas changes from C(P3, V3) to D(P4, V4). If W is the work done in this process and Q is the heat rejected to the sink, then
W3 = -nRT2 loge(V4 / V3)
4. Fourth stage (called adiabatic compression)
The barrel is placed over the insulating stand. The piston is moved down, thereby compressing the gas adiabatically till the temperature of gas increases from T2 to T1. The state of gas changes from D(P4, V4) to A(P1, V1). If W4 is the work done in this process, then
W4 = nCv(T1 – T2)