One of the few provable useful results in economics is the one about markets producing an optimal outcome. It’s what’s behind Adam Smith’s theory of The Invisible Hand, and why certain people go on about the benefits of markets.
If all goods and services in an economy are traded via perfectly competitive free markets, the resulting outcome is “efficient” (*), i.e. there is no other possible arrangement of available resources in which some would be better off and no one would be worse off.(By contrast, an “inefficient” outcome is one where the position of some can be improved without making anyone else’s position worse, e.g. where the benefits of exchange have not been fully exploited.)
This is potentially a very useful result, because if we want to ensure that things are as good as they could be (ignoring redistribution issues) we don’t first have to calculate everyone’s happiness under various different conditions. All we need do is set up perfectly competitive (PC) markets and let them get on with it. This is just as well, since in practice it’s impossible to know what people’s happiness level is under different conditions, or to find out all possible preferences between different outcomes for every individual. We may not even need to do anything as active as “setting up markets” since they tend to develop spontaneously.
If we currently don’t have conditions of PC markets, the way to get to efficiency is simple, in theory: do whatever it takes to get to precisely those conditions.
The problem is that, in practice — for various reasons, e.g. political — we may not be able to get to PC conditions. We may therefore have to choose between other, suboptimal alternatives, and try to decide which of those is preferable from the point of view of efficiency. Is it still a good idea to have a situation as close as possible to PC? This is the "problem of the second best". Which will be covered in part two of this post.
(*) strictly, “Pareto-efficient”, after Vilfredo Pareto who first used the concept.