As you take an ideal gas through a complete cycle, you can calculate the energy transfers along each step in the process and how the internal energy of the gas changes. Because the energy of the gas is a state function, meaning it only depends on the state the gas is in, the change in the energy of the gas must be zero for the full cycle. If the gas is used to drive an engine, the net energy transferred to the gas as heat will then equal the net work done by the gas during the cycle. We can then calculate the efficiency of the cycle, relating the net work done by the gas to the total energy absorbed by the gas as heat during the cycle.