# First law of thermodynamics: internal or external pressure?

I'm taking my first course in thermodynamics, so my apologies if this is a rather silly question.

I'm a bit confused about the pressure term in the formulation of the first law. The first law states that: $$dU_{system} = \delta Q - p_{int}dV$$

I "understand" this formulation if the pressure $$p$$ is the pressure of the system on the surroundings, i.e. the internal pressure. Sometimes however the first law is formulated with the external pressure.

I understand that you can say this, because ultimately energy is conserved: $$dU_{surroundings} = \delta Q - p_{ext}dV$$

My question is the following: Is it correct to formulate the first law in two ways?

1. With the internal energy of the system and internal pressure.

2. With the internal energy of the surroundings and external pressure

$$dU$$ usually refers exclusively to the change in internal energy of the system, though you do bring up a common point about internal and external pressures. I will use the convention that positive work $$W$$ means work done on the gas by the surroundings.

The equation that is always correct is $$W = -\int P_{ext} dV$$, no matter whether the process is reversible or not. So the following formulation is also always correct

$$dU = Q + W = Q - \int P_{ext} dV$$

The problem is that "internal pressure" is often not well defined. If the process is reversible - that is, a continuous series of equilibrium states - then the internal pressure is fairly well defined by the ideal gas equations, and we can use an internal pressure of $$P_{int} = \frac{nRT}{V}$$. In this case, due to the equilibrium condition, $$P_{ext} = P_{int}$$ and it is perfectly fine to write $$W = -\int P_{int} dV$$.

However, if the process is not reversible, contributions from (for instance) viscous stresses also affect the force per unit area at the interface and the internal pressure we might calculate from the ideal gas equations does not equal the force per unit area at the interface. The external pressure, however, is well defined and consequently we can use this in our calculations.

To summarise, if in doubt always use $$W = -\int P_{ext} dV$$, unless you are completely sure the process is reversible (in which case you can use the internal pressure).

Extra Note

You might wonder why the equation for external pressure is valid. To give some explanation, consider a piston expanding non-reversibly from one rest position to another rest position. The internal pressure is not well defined, so let's call the work done by the inside gas on the piston between the start and end positions $$W_{p}$$. The external pressure is well defined, so let's call the work done by the surroundings on the piston $$-\int P_{ext} dV$$.

Since the total work done on the piston between the start and end positions equals the piston's change in kinetic energy (zero!), we have

$$W_{p} - \int P_{ext} dV = 0 \implies W_{p} = \int P_{ext} dV$$

Finally, since $$W_{p}$$ is the work done by the inside gas on the piston, the work one by the piston on the inside gas, $$W$$ then equals

$$W = -W_{p} = -\int P_{ext} dV$$

The work done by the gas on its surroundings is determined by the force that the gas exerts on the piston integrated over the piston displacement. If the deformation is quasi static (slow), then this force is equal to the pressure calculated from the ideal gas law times the area of the piston. But, if the gas deformation is rapid, then the force is not equal to the pressure calculated by the ideal gas law times the area of the piston. This is because the ideal gas law is only valid for a gas at or close to thermodynamic equilibrium. For rapid irreversible deformations, the ideal gas law gives the wrong value.

However, all is not lost. From Newton's 3rd law, at the piston face, the force that the gas exerts on the piston must be equal to the force that the piston exerts on the gas. This force is equal to the external pressure times the area of the piston. So, if we have some way of imposing the external force of the piston on the gas, we can still calculate the work that the gas does on its surroundings. For example, if the piston mass is very small, we can use a spring or a weight on the piston to establish the external force.

Even in the case of a slow quasi static deformation, the force of the gas on the piston is equal to the external force of the piston on the gas. However, in this case, we can also use the ideal gas law to get the force that the gas exerts on the piston.

So, to summarize, for any arbitrary deformation, the work can be calculated from $$W=\int{P_{ext}dV}$$But, for the special case of a quasi static deformation, $$P_{ext}=P_{ig}=\frac{nRT}{V}$$ But if the deformation is not quasi static, this latter equation will give the wrong answer.