In economics, comparative advantage refers to the ability of a party to produce a particular good or service at a lower marginal and opportunity cost over another. Even if one country is more efficient in the production of all goods (absolute advantage in all goods) than the other, both countries will still gain by trading with each other, as long as they have different relative efficiencies.
For example, if, using machinery, a worker in one country can produce both shoes and shirts at 6 per hour, and a worker in a country with less machinery can produce either 2 shoes or 4 shirts in an hour, each country can gain from trade because their internal trade-offs between shoes and shirts are different. The less-efficient country has a comparative advantage in shirts, so it finds it more efficient to produce shirts and trade them to the more-efficient country for shoes. Without trade, its opportunity cost per shoe was 2 shirts; by trading, its cost per shoe can reduce to as low as 1 shirt depending on how much trade occurs (since the more-efficient country has a 1:1 trade-off). The more-efficient country has a comparative advantage in shoes, so it can gain in efficiency by moving some workers from shirt-production to shoe-production and trading some shoes for shirts. Without trade, its cost to make a shirt was 1 shoe; by trading, its cost per shirt can go as low as 1/2 shoe depending on how much trade occurs.
The net benefits to each country are called the gains from trade.
Origins of the theory 
The idea of comparative advantage has been first mentioned in Adam Smith's Book The Wealth of Nations: "If a foreign country can supply us with a commodity cheaper than we ourselves can make it, better buy it of them with some part of the produce of our own industry, employed in a way in which we have some advantage." But the law of comparative advantages has been formulated by David Ricardo who investigated in detail advantages and alternative or relative opportunity in his 1817 book On the Principles of Political Economy and Taxation in an example involving England and Portugal. In Portugal it is possible to produce both wine and cloth with less labor than it would take to produce the same quantities in England. However the relative costs of producing those two goods are different in the two countries. In England it is very hard to produce wine, and only moderately difficult to produce cloth. In Portugal both are easy to produce. Therefore while it is cheaper to produce cloth in Portugal than England, it is cheaper still for Portugal to produce excess wine, and trade that for English cloth. Conversely England benefits from this trade because its cost for producing cloth has not changed but it can now get wine at a lower price, closer to the cost of cloth. The conclusion drawn is that each country can gain by specializing in the good where it has comparative advantage, and trading that good for the other.
Modern Theories 
|This section may be confusing or unclear to readers. (November 2012)|
Classical comparative advantage theory was extended in two directions: Ricardian theory and Heckscher-Ohlin-Samuelson theory (HOS theory). In both theories, the comparative advantage concept is formulated for 2 country, 2 commodity case. It can easily be extended to the 2 country, many commodity case or many country, 2 commodity case. But in the case with many countries (more than 3 countries) and many commodities (more than 3 commodities), the notion of comparative advantage loses its facile features and requires totally different formulation. In these general cases, HOS theory totally depends on Arrow-Debreu type general equilibrium theory but gives little information other than general contents. Ricardian theory was formulated in Jones' 1961 paper, but it was limited to the case where there are no traded intermediate goods. In view of growing outsourcing and global procuring, it is necessary to extend the theory to the case with traded intermediate goods. This was done in Shiozawa's 2007 paper. Until now, this is the unique general theory which accounts for traded input goods.
Effect of trade costs 
Using Ricardo's classic example:
In the absence of transportation costs, it is efficient for Britain to produce cloth and for Portugal to produce wine as, assuming that these trade at equal price (1 unit of cloth for 1 unit of wine), Britain can then obtain wine at a cost of 100 labor units by producing cloth and trading, rather than 110 units by producing the wine itself, and Portugal can obtain cloth at a cost of 80 units by trade rather than 90 by production.
However, in the presence of trade costs of 15 units of labor to import a good (alternatively a mix of export labor costs and import labor costs, such as 5 units to export and 10 units to import), it then costs Britain 115 units of labor to obtain wine by trade – 100 units for producing the cloth, 15 units for importing the wine, which is more expensive than producing the wine locally, and likewise for Portugal. Thus, if trade costs exceed the production advantage, it is not advantageous to trade.
Krugman proceeds to argue more speculatively that changes in the cost of trade (particularly transportation) relative to the cost of production may be a factor in changes in global patterns of trade; if trade costs decrease, such as with the advent of steam-powered shipping, trade should be expected to increase, as more comparative advantages in production can be realized. Conversely, if trade costs increase or if production costs decrease faster than trade costs (such as via electrification of factories), then trade should be expected to decrease as trade costs become a more significant barrier.
Effects on the economy 
||This section needs additional citations for verification. (June 2012)|
Conditions that maximize comparative advantage do not automatically resolve trade deficits. In fact, many real world examples where comparative advantage is attainable may require a trade deficit. For example, the amount of goods produced can be maximized, yet it may involve a net transfer of wealth from one country to the other, often because economic agents have widely different rates of saving.
As the markets change over time, the ratio of goods produced by one country versus another variously changes while maintaining the benefits of comparative advantage. This can cause national currencies to accumulate into bank deposits in foreign countries where a separate currency is used.
Macroeconomic monetary policy is often adapted to address the depletion of a nation's currency from domestic hands by the issuance of more money, leading to a wide range of historical successes and failures.
Development economics 
The theory of comparative advantage, and the corollary that nations should specialize, is criticized on pragmatic grounds within the import substitution industrialization theory of development economics, on empirical grounds by the Singer–Prebisch thesis which states that terms of trade between primary producers and manufactured goods deteriorate over time, and on theoretical grounds of infant industry and Keynesian economics. In older economic terms, comparative advantage has been opposed by mercantilism and economic nationalism. These argue instead that while a country may initially be comparatively disadvantaged in a given industry (such as Japanese cars in the 1950s), countries should shelter and invest in industries until they become globally competitive. Further, they argue that comparative advantage, as stated, is a static theory – it does not account for the possibility of advantage changing through investment or economic development, and thus does not provide guidance for long-term economic development.
Much has been written since Ricardo as commerce has evolved and cross-border trade has become more complicated. Today trade policy tends to focus more on "competitive advantage" as opposed to "comparative advantage". One of the most indepth research undertakings on "competitive advantage" was conducted in the 1980s as part of the Reagan administration's Project Socrates to establish the foundation for a technology-based competitive strategy development system that could be used for guiding international trade policy.
Free mobility of capital in a globalized world 
Ricardo explicitly bases his argument on an assumed immobility of capital:" ... if capital freely flowed towards those countries where it could be most profitably employed, there could be no difference in the rate of profit, and no other difference in the real or labor price of commodities, than the additional quantity of labor required to convey them to the various markets where they were to be sold."
He explains why, from his point of view (anno 1817), this is a reasonable assumption: "Experience, however, shows, that the fancied or real insecurity of capital, when not under the immediate control of its owner, together with the natural disinclination which every man has to quit the country of his birth and connexions, and entrust himself with all his habits fixed, to a strange government and new laws, checks the emigration of capital."
Some scholars, notably Herman Daly, an American ecological economist and professor at the School of Public Policy of the University of Maryland, have voiced concern over the applicability of Ricardo's theory of comparative advantage in light of a perceived increase in the mobility of capital: "International trade (governed by comparative advantage) becomes, with the introduction of free capital mobility, interregional trade (governed by Absolute advantage)."
Adam Smith developed the principle of absolute advantage. The economist Paul Craig Roberts notes that the comparative advantage principles developed by David Ricardo do not hold where the factors of production are internationally mobile. Limitations to the theory may exist if there is a single kind of utility. Yet the human need for food and shelter already indicates that multiple utilities are present in human desire. The moment the model expands from one good to multiple goods, the absolute may turn to a comparative advantage. The opportunity cost of a forgone tax base may outweigh perceived gains, especially where the presence of artificial currency pegs and manipulations distort trade.
Economist Ha-Joon Chang criticized the comparative advantage principle, contending that it may have helped developed countries maintain relatively advanced technology and industry compared to developing countries. In his book Kicking Away the Ladder, Chang argued that all major developed countries, including the United States and United Kingdom, used interventionist, protectionist economic policies in order to get rich and then tried to forbid other countries from doing the same. For example, according to the comparative advantage principle, developing countries with a comparative advantage in agriculture should continue to specialize in agriculture and import high-technology widgits from developed countries with a comparative advantage in high technology. In the long run, developing countries would lag behind developed countries, and polarization of wealth would set in. Chang asserts that premature free trade has been one of the fundamental obstacles to the alleviation of poverty in the developing world. Recently, Asian countries such as South Korea, Japan and China have utilized protectionist economic policies in their economic development.
Philosopher and Professor of Evolutionary Psychology Bruce Charlton has argued that comparative advantage is a metaphysical assumption, rather than a discovery. In addition to falsifiable nature of the principle, he notes that the principle relies on several assumptions that are not necessarily operative. In particular "under conditions of stability and trust - where cycles of exchange tend to repeat themselves, where there is high trust between producers, and dependability of producers, where costs of exchange such as transport are relatively small etc."
See also 
- Competitive advantage
- Revealed comparative advantage
- Heckscher-Ohlin model
- Bureau of Labor Statistics
- Resource curse
- 'Baumol, William J. and Alan S. Binder, 'Economics: Principles and Policy, [p. 50 http://books.google.com/books?id=6Kedl8ZTTe0C&lpg=PA49&dq=%22law%20of%20comparative%20advantage%22&pg=PA50#v=onepage&q=%22law%20of%20comparative%20advantage%22&f=false]. 2009.
- "BLS Information". Glossary. U.S. Bureau of Labor Statistics Division of Information Services. February 28, 2008. Retrieved 2009-05-05.
- O'Sullivan, Arthur; Sheffrin, Steven M. (2003) [January 2002]. Economics: Principles in Action. The Wall Street Journal:Classroom Edition (2nd ed.). Upper Saddle River, New Jersey 07458: Pearson Prentice Hall: Addison Wesley Longman. p. 444. ISBN 0-13-063085-3. Retrieved May 3, 2009.
- The exact phrase is not found in an online version of that book.
- For example, R. Dornbusch, S. Fischer and P. A. Samuelson, Comparative Advantage, Trade, and Payments in a Ricardian Model with a Continuum of Goods, The American Economic Review, Vol. 67, No. 5, Dec., 1977, pages 823-839. Rudiger Dornbusch, Stanley Fischer and Paul A. Samuelson, Heckscher-Ohlin Trade Theory with a Continuum of Goods, Quarterly Journal of Economics Volume 95 Issue 2, pages 203-224.
- Alan V. Deardorff, How Robust is Comparative Advantage, Review of International Economics, Volume 13, Issue 5, pages 1004–1016, November 2005.
- Richard Jones, Comparative Advantage and the Theory Tariffs: A Multi-country, Multi-commodity Model, Review of Economic Studies, Nomber 77, pages 161-175, June 1961.
- Yoshinori Shiozawa, A New Construction of Ricardian Trade Theory / a Many-Country, Many-Commodity Case with Intermediate Goods and Choice of Production Techniques, Evolutionary and Institutional Economics Review, Volume 3 Issue 2, pages 141-187, March 2007. Andrew J. Cassey, An Application of the Ricardian Trade Model with Trade Costs, Applied Economics Letters, 2012, 19, 1227-1230.
- A Globalization Puzzle, Paul Krugman, February 21, 2010
- Ricardo (1817). On the Principles of Political Economy and Taxation. London, Chapter 7
- "Lecture by Sophie Prize winner Herman Daly, Oslo, 1999". Sophieprize.org. 1999-06-15. Retrieved 2009-04-07.
- Roberts, Paul Craig (August 7, 2003). Jobless in the USA Newsmax. Retrieved on January 5, 2010.
- Hira, Ron and Anil Hira with forward by Lou Dobbs, (May 2005). Outsourcing America: What's Behind Our National Crisis and How We Can Reclaim American Jobs. (AMACOM) American Management Association. Citing Paul Craig Roberts, Paul Samuelson, and Lou Dobbs, pp. 36-38.
- Bivens, Josh (September 25, 2006 ).China Manipulates Its Currency—A Response is Needed. Economic Policy Institute. Retrieved on February 2, 2010.
- Chang, Ha-Joon. Kicking Away the Ladder: Development Strategy in Historical Perspective. London: Anthem Press, 2002.
- http://charltonteaching.blogspot.com/2013/05/the-metaphysical-law-of-comparative.html, "The metaphysical 'law' of Comparative Advantage - an assumption masquerading as a discovery"
- Chang, Ha-Joon (2002). Kicking Away the Ladder: Development Strategy in Historical Perspective, Anthem Press.
- Chang, Ha-Joon (2008). Bad Samaritans: The Myth of Free Trade and the Secret History of Capitalism, Bloomsbury Press.
- Ronald Findlay (1987). "comparative advantage," The New Palgrave: A Dictionary of Economics, v. 1, pp. 514–17.
- Hardwick, Khan and Langmead (1990). An Introduction to Modern Economics - 3rd Edn
- A. O'Sullivan & S.M. Sheffrin (2003). Economics. Principles & Tools.
- Comparative advantage in glossary, U.S. Bureau of Labor Statistics Division of Information Services
- David Ricardo's The Principles of Trade and Taxation (original source text)
- Ricardo's Difficult Idea, Paul Krugman's exploration of why non-economists don't understand the idea of comparative advantage
- The Ricardian Model of Comparative Advantage
- J.G. Hülsmann's Capital Exports and Free Trade explanation of why the immobility of capital is not an essential condition.
- Matt Ridley, 'When Ideas Have Sex', a video at the TED talk where he explain the Comparative advantage for a general audience (5:05 out in the video).