Entropy change in the free expansion of a gas

What am I missing ?

Entropy can be generated without there being heat transfer, i.e., when $$Q=0$$. That's the case for a free expansion into a vacuum. The classic example given is an ideal gas located in one side of a rigid insulated vessel with a vacuum in the other side separated by a rigid partition. An opening is created in the partition allowing the gas to expand into the evacuated half of the vessel. $$W=0$$, $$Q=0$$, $$\Delta T=0$$ (for an ideal gas) and therefore $$\Delta U=0$$. Although no heat transfer has occurred, the process is obviously irreversible (you would not expect the gas to be able to spontaneously return to its original location) and entropy increases.

You can calculate the entropy increase by assuming any convenient reversible process that can bring the system back to its original state (original entropy). The obvious choice is to remove the insulation and insert a movable piston. Then conduct a reversible isothermal compression until the gas is returned to its original volume leaving a vacuum in the other half. All properties are then returned to their original state. The change in entropy for the isothermal compression is then, where $$Q$$ is the heat transferred to the surroundings by the isothermal compression,

$$\Delta S=-\frac{Q}{T}$$

Since the system is returned to its original state, the overall change in entropy is zero, meaning the original change in entropy due to the irreversible expansion has to be

$$\Delta S=+\frac{Q}{T}$$

Hope this helps.

The equality $$dS=dQ/T$$ is only valid for reversible processes, so it does not apply in a free expansion.