Why does supply equal demand? My question is simple: in theory, why should we expect the total quantity that firms want to sell to be (at least approximately) equal to the total quantity that consumers want to buy?

As I understand it, the standard explanation is something like this. If supply were greater than demand (for instance), then there must be some 'frustrated' sellers who cannot sell all of the units that they want to sell. Instead of paying the market price, buyers could therefore pay a lower price to these sellers while still buying all the units that they want to purchase. This pushes the price downwards, a process that continues until supply equals demand.

I find this kind of explanation unsatisfying for two reasons:


In the standard framework of competitive equilibrium, agents choose quantities (and view prices as fixed). And yet, the disequilibrium adjustment story here relies on price setting.
The explanation is highly informal. As a result, it is unclear what assumptions are necessary for it to hold and when we should expect supply to equal demand.


I would be very grateful if anyone could improve on this explanation.

Edit: what I am looking for is a rigorous story explaining why:


If the number of units that producers want to sell exceeds the number that consumers want to buy, the price will fall.
If the number of units that consumers want to buy exceeds the number that producers want to sell, the price will increase.


This is a very fundamental assumption in economics so I think deserves a good answer on economics SE (apparently, not everyone agrees, judging by the recent downvotes!)

The puzzle (for me) is how this can happen in an environment when everyone views the price as given (i.e. the standard model of perfect competition).
You can easily change the informal explanation to a "quantity-based" approach, using a dynamic approach. Assume that firms in the market produce this period $S_1$ but the consumers that show up buy only $D_1&lt;S_1$. What would you do if you were a producer, for period $2$, given the information you have about where demand stands?

Assume the good is perishable. Then the unsold quantity from period $1$ is destroyed. In period $2$ are you going to produce the same amount, or something less? I would say less, to reduce somehow the quantity that will go to waste and your loss from that fact.

Assume the good is not perishable, so you have inventories left over from the first period. Now, the tendency is to produce even less than when the good is perishable, because you can sell during period $2$ the inventories from period $1$.

So we see, that starting from a quantity supplied above quantity demanded, it is reasonable to expect lower quantity supplied next period.
One can easily make the analogous argument starting with quantity demanded higher than quantity supplied. This is a gradual adjustment towards "market equilibrium", where quantity supplied will equal quantity demanded, or approximately so.

...and I didn't mention prices anywhere. You can think that this is a local market where the producers are forced to sell at a specific price, "imposed" on them by other similar markets and the expectations of consumers. In other words, what I described above can roll out while the price remains fixed from period to period.

The above was just an informal description. The benchmark approach to the dynamic adjustment towards market equilibrium is the Cobweb Theorem, see Ezekiel 1938.