Thermodynamic cycles, when is the work negative/positive? ever since I begun calculating thermodynamical cycles, I've had problems with determining the sign of the work along a particular bit of the cycle. Of course, I guess that an arbitrary cycle is 'bendy' and the sign of the work differential depends strongly on the coordinates, but usually the cycles I deal with consist of a couple of 'parts', for instance, adiabatics, isothermals, isochorics, etc. And whenever asked to calculate the total work done in a cycle (for instance to find the efficiency), I just kind of guessed the sign and managed to get by, but now when trying to understand this on a deeper level, this is coming back to haunt me.
So, suppose I have a thermodynamic cycle like this: LINK
Where: 
(1)-adiabatic
(2)-isobaric
(3)-isothermal
(4)-isochoric
How do I know the sign of the work along each of these paths?
 A: General remarks.
Let $\delta W$ denote the differential work done by a system, so $\delta W$ is postive when the system does work on something else and negative when work is done by something else on the system.  For a given process taking place over a path $\gamma$ in thermodynamic state space, the systematic way of determining whether work was done by or on the system is to determine the sign of $W$, the total work done by the system, which is given by
$$
  W = \int_\gamma\delta W
$$
This can be computed in various ways depending on the system at hand, and the process it undergoes. The trick is to attempt to find an expression for $\delta W$ that allows for the efficient calculation of the integral for $W$.
Example - adiabatic compression.
Suppose,for example, that we want to determine the work done by the gas during process $1$ of your diagram.  Recall that the first law of thermodynamics in differential form can be written as follows:
$$
  dE = \delta Q - \delta W
$$
The sign convention here is that $\delta Q$ denotes the heat transferred to the system, and $\delta W$, again, denotes the work done by the system.  Since process $1$ is adiabatic, we have $\delta Q = 0$ by definition.  It follows that
$$
  W = -\int_\gamma dE = -\Delta_\gamma E
$$
where $\Delta_\gamma E$ denotes the total change in energy along the path $\gamma$.  Let process $1$ start at point $a$ and end at point $b$, then we can write this result as
$$
  W = -(E_b - E_a) = E_a-E_b
$$
So to determine the sign of the work done, we simply need to know whether or not the internal energy of the gas increased (in which case $W<0$ so that work was done on the gas) or decreased (in which case $W>0$ so that work was done by the gas).  How to we figure this out for this adiabatic process?  Well take, for example, a monatomic ideal gas, and recall that for such a process, we have
$$
  T_aV_a^{\gamma-1} = T_bV_b^{\gamma-1}, \qquad \gamma = \frac{5}{3}
$$
Then we see that since $V_b<V_a$, we have $T_b>T_a$; the temperature of the gas increased.  But for a monatomic ideal gas, the internal energy can be written purely as a function of temperature and number of particles;
$$
  E = \frac{3}{2}NkT
$$
so assuming the number of particles is fixed, the internal energy also increase, and therefore, $W<0$, so work was done on the gas.
