The law of comparative advantage describes how, under free trade, an agent will produce more of and consume less of a good for which they have a comparative advantage.

In an economic model, agents have a comparative advantage over others in producing a particular good if they can produce that good at a lower relative opportunity cost or autarky price, i.e. at a lower relative marginal cost prior to trade. Comparative advantage describes the economic reality of the work gains from trade for individuals, firms, or nations, which arise from differences in their factor endowments or technological progress. (One should not compare the monetary costs of production or even the resource costs (labor needed per unit of output) of production. Instead, one must compare the opportunity costs of producing goods across countries).

David Ricardo developed the classical theory of comparative advantage in 1817 to explain why countries engage in international trade even when one country's workers are more efficient at producing every single good than workers in other countries. He demonstrated that if two countries capable of producing two commodities engage in the free market, then each country will increase its overall consumption by exporting the good for which it has a comparative advantage while importing the other good, provided that there exist differences in labor productivity between both countries. Widely regarded as one of the most powerful yet counter-intuitive insights in economics, Ricardo's theory implies that comparative advantage rather than absolute advantage is responsible for much of international trade.

## Classical theory and David Ricardo's formulation

Adam Smith first alluded to the concept of absolute advantage as the basis for international trade in 1776, in The Wealth of Nations:

Writing several decades after Smith in 1808, Robert Torrens articulated a preliminary definition of comparative advantage as the loss from the closing of trade:

David Ricardo

In 1817, David Ricardo published what has since become known as the theory of comparative advantage in his book On the Principles of Political Economy and Taxation.

### Ricardo's example

Graph illustrating Ricardo's example:
In case I (diamonds), each country spends 3600 hours to produce a mixture of cloth and wine.
In case II (squares), each country specializes in its comparative advantage, resulting in greater total output.

In a famous example, Ricardo considers a world economy consisting of two countries, Portugal and England, each producing two goods of identical quality. In Portugal, the a priori more efficient country, it is possible to produce wine and cloth with less labor than it would take to produce the same quantities in England. However, the relative costs or ranking of cost of producing those two goods differ between the countries.

In this illustration, England could commit 100 hours of labor to produce one unit of cloth, or produce

5/6 units of wine. Meanwhile, in comparison, Portugal could commit 100 hours of labor to produce10/9 units of cloth, or produce10/8 units of wine. So, Portugal possesses an absolute advantage in producing cloth due to more produced per hour (since10/9 > 1), but England has a comparative advantage in producing cloth due to lower opportunity cost.

In other words, if it is cheaper for a country to produce one good relative to a second, then they will have a comparative advantage and an incentive to produce more of that good which is relatively cheaper for them to produce than the other--assuming they have an advantageous opportunity to trade in the marketplace for the other more difficult to produce good. Similarly, most anyone should take the opportunity to offer in the marketplace a good which they have a relative advantage in producing.

In the absence of trade, England requires 220 hours of work to both produce and consume one unit each of cloth and wine while Portugal requires 170 hours of work to produce and consume the same quantities. England is more efficient at producing cloth than wine, and Portugal is more efficient at producing wine than cloth. So, if each country specializes in the good for which it has a comparative advantage, then the global production of both goods increases, for England can spend 220 labor hours to produce 2.2 units of cloth while Portugal can spend 170 hours to produce 2.125 units of wine. Moreover, if both countries specialize in the above manner and England trades a unit of its cloth for5/6 to9/8 units of Portugal's wine, then both countries can consume at least a unit each of cloth and wine, with 0 to 0.2 units of cloth and 0 to 0.125 units of wine remaining in each respective country to be consumed or exported. Consequently, both England and Portugal can consume more wine and cloth under free trade than in autarky.

### Ricardian model

The Ricardian model is a general equilibrium mathematical model of international trade. Although the idea of the Ricardian model was first presented in the Essay on Profits (a single-commodity version) and then in the Principles (a multi-commodity version) by David Ricardo, the first mathematical Ricardian model was published by William Whewell in 1833. The earliest test of the Ricardian model was performed by G.D.A MacDougall, which was published in Economic Journal of 1951 and 1952. In the Ricardian model, trade patterns depend on productivity differences.

The following is a typical modern interpretation of the classical Ricardian model. In the interest of simplicity, it uses notation and definitions, such as opportunity cost, unavailable to Ricardo.

The world economy consists of two countries, Home and Foreign, which produce wine and cloth. Labor, the only factor of production, is mobile domestically but not internationally; there may be migration between sectors but not between countries. We denote the labor force in Home by ${\displaystyle \textstyle L}$, the amount of labor required to produce one unit of wine in Home by ${\displaystyle \textstyle a_{LW}}$, and the amount of labor required to produce one unit of cloth in Home by ${\displaystyle \textstyle a_{LC}}$. The total amount of wine and cloth produced in Home are ${\displaystyle Q_{W}}$and ${\displaystyle Q_{C}}$respectively. We denote the same variables for Foreign by appending a prime. For instance, ${\displaystyle \textstyle a'_{LW}}$is the amount of labor needed to produce a unit of wine in Foreign.

We don't know if Home can produce cloth using fewer hours of work than Foreign. That is, we don't know if ${\displaystyle a_{LC}. Similarly, we don't know if Home can produce wine using fewer hours of work. However, we assume Home is relatively more productive than Foreign in making in cloth vs. wine:

${\displaystyle a_{LC}/a'_{LC}

Equivalently, we may assume that Home has a comparative advantage in cloth in the sense that it has a lower opportunity cost for cloth in terms of wine than Foreign:

${\displaystyle a_{LC}/a_{LW}

In the absence of trade, the relative price of cloth and wine in each country is determined solely by the relative labor cost of the goods. Hence the relative autarky price of cloth is ${\displaystyle a_{LC}/a_{LW}}$in Home and ${\displaystyle a'_{LC}/a'_{LW}}$in Foreign. With free trade, the price of cloth or wine in either country is the world price ${\displaystyle P_{C}}$or${\displaystyle P_{W}}$.

Instead of considering the world demand (or supply) for cloth and wine, we are interested in the world relative demand (or relative supply) for cloth and wine, which we define as the ratio of the world demand (or supply) for cloth to the world demand (or supply) for wine. In general equilibrium, the world relative price ${\displaystyle \textstyle P_{C}/P_{W}}$will be determined uniquely by the intersection of world relative demand ${\displaystyle \textstyle RD}$and world relative supply ${\displaystyle \textstyle RS}$curves.

The demand for cloth relative to wine decreases with the relative price of cloth in terms of wine; the supply ${\displaystyle RS}$of cloth relative to wine increases with relative price. Two relative demand curves ${\displaystyle RD_{1}}$and ${\displaystyle RD_{2}}$are drawn for illustrative purposes.

We assume that the relative demand curve reflects substitution effects and is decreasing with respect to relative price. The behavior of the relative supply curve, however, warrants closer study. Recalling our original assumption that Home has a comparative advantage in cloth, we consider five possibilities for the relative quantity of cloth supplied at a given price.

• If ${\displaystyle \textstyle P_{C}/P_{W}=a_{LC}/a_{LW}, then Foreign specializes in wine, for the wage ${\displaystyle P'_{W}/a'_{LW}}$in the wine sector is greater than the wage ${\displaystyle P'_{C}/a'_{LC}}$in the cloth sector. However, Home workers are indifferent between working in either sector. As a result, the quantity of cloth supplied can take any value.
• If ${\displaystyle \textstyle P_{C}/P_{W}, then both Home and Foreign specialize in wine, for similar reasons as above, and so the quantity of cloth supplied is zero.
• If ${\displaystyle \textstyle a_{LC}/a_{LW}, then Home specializes in cloth whereas Foreign specializes in wine. The quantity of cloth supplied is given by the ratio ${\displaystyle \textstyle {\frac {L/a_{LC}}{L'/a'_{LW}}}}$of the world production of cloth to the world production of wine.
• If ${\displaystyle \textstyle a_{LC}/a_{LW}, then both Home and Foreign specialize in cloth. The quantity of cloth supplied tends to infinity as the quantity of wine supplied approaches zero.
• If ${\displaystyle \textstyle a_{LC}/a_{LW}, then Home specializes in cloth while Foreign workers are indifferent between sectors. Again, the relative quantity of cloth supplied can take any value.
The blue triangle depicts Home's original production (and consumption) possibilities. By trading, Home can also consume bundles in the pink triangle despite facing the same productions possibility frontier.

As long as the relative demand is finite, the relative price is always bounded by the inequality

${\displaystyle a_{LC}/a_{LW}\leq {P_{C}/P_{W}}\leq {a'_{LC}/a'_{LW}}.}$

In autarky, Home faces a production constraint of the form

${\displaystyle a_{LC}Q_{C}+a_{LW}Q_{W}\leq L,}$

from which it follows that Home's cloth consumption at the production possibilities frontier is

${\displaystyle Q_{C}=L/a_{LC}-(a_{LW}/a_{LC})Q_{W}}$.

With free trade, Home produces cloth exclusively, an amount of which it exports in exchange for wine at the prevailing rate. Thus Home's overall consumption is now subject to the constraint

${\displaystyle a_{LC}Q_{C}+a_{LC}(P_{W}/P_{C})Q_{W}\leq L}$

while its cloth consumption at the consumption possibilities frontier is given by

${\displaystyle Q_{C}=L/a_{LC}-(P_{W}/P_{C})Q_{W}\geq L/a_{LC}-(a_{LW}/a_{LC})Q_{W}}$.

A symmetric argument holds for Foreign. Therefore, by trading and specializing in a good for which it has a comparative advantage, each country can expand its consumption possibilities. Consumers can choose from bundles of wine and cloth that they could not have produced themselves in closed economies.

There is another way to prove the theory of comparative advantage, which requires less assumption than the above-detailed proof, and in particular does not require for the hourly wages to be equal in both industries, nor requires any equilibrium between offer and demand on the market. Such a proof can be extended to situations with many goods and many countries, non constant returns and more than one factor of production.

Terms of trade is the rate at which one good could be traded for another. If both countries specialize in the good for which they have a comparative advantage then trade, the terms of trade for a good (that benefit both entities) will fall between each entities opportunity costs. In the example above one unit of cloth would trade for between ${\displaystyle {\frac {5}{6}}}$units of wine and ${\displaystyle {\frac {9}{8}}}$units of wine.

## Haberler's opportunity costs formulation

In 1930 Austrian-American economist Gottfried Haberler detached the doctrine of comparative advantage from Ricardo's labor theory of value and provided a modern opportunity cost formulation. Haberler's reformulation of comparative advantage revolutionized the theory of international trade and laid the conceptual groundwork of modern trade theories.

Haberler's innovation was to reformulate the theory of comparative advantage such that the value of good X is measured in terms of the forgone units of production of good Y rather than the labor units necessary to produce good X, as in the Ricardian formulation. Haberler implemented this opportunity-cost formulation of comparative advantage by introducing the concept of a production possibility curve into international trade theory.

## Modern theories

Since 1817, economists have attempted to generalize the Ricardian model and derive the principle of comparative advantage in broader settings, most notably in the neoclassical specific factors Ricardo-Viner (which allows for the model to include more factors than just labour) and factor proportions Heckscher–Ohlin models. Subsequent developments in the new trade theory, motivated in part by the empirical shortcomings of the H–O model and its inability to explain intra-industry trade, have provided an explanation for aspects of trade that are not accounted for by comparative advantage. Nonetheless, economists like Alan Deardorff, Avinash Dixit, Gottfried Haberler, and Victor D. Norman have responded with weaker generalizations of the principle of comparative advantage, in which countries will only tend to export goods for which they have a comparative advantage.

### Dornbusch et al.'s continuum of goods formulation

In both the Ricardian and H–O models, the comparative advantage theory is formulated for a 2 countries/2 commodities case. It can be extended to a 2 countries/many commodities case, or a many countries/2 commodities case. Adding commodities in order to have a smooth continuum of goods is the major insight of the seminal paper by Dornbusch, Fisher, and Samuelson. In fact, inserting an increasing number of goods into the chain of comparative advantage makes the gaps between the ratios of the labor requirements negligible, in which case the three types of equilibria around any good in the original model collapse to the same outcome. It notably allows for transportation costs to be incorporated, although the framework remains restricted to two countries. But in the case with many countries (more than 3 countries) and many commodities (more than 3 commodities), the notion of comparative advantage requires a substantially more complex formulation.

### Deardorff's general law of comparative advantage

Skeptics of comparative advantage have underlined that its theoretical implications hardly hold when applied to individual commodities or pairs of commodities in a world of multiple commodities. Deardorff argues that the insights of comparative advantage remain valid if the theory is restated in terms of averages across all commodities. His models provide multiple insights on the correlations between vectors of trade and vectors with relative-autarky-price measures of comparative advantage. "Deardorff's general law of comparative advantage" is a model incorporating multiple goods which takes into account tariffs, transportation costs, and other obstacles to trade.

### Alternative approaches

Recently, Y. Shiozawa succeeded in constructing a theory of international value in the tradition of Ricardo's cost-of-production theory of value. This was based on a wide range of assumptions: Many countries; Many commodities; Several production techniques for a product in a country; Input trade (intermediate goods are freely traded); Durable capital goods with constant efficiency during a predetermined lifetime; No transportation cost (extendable to positive cost cases).

In a famous comment, McKenzie pointed that "A moment's consideration will convince one that Lancashire would be unlikely to produce cotton cloth if the cotton had to be grown in England." However, McKenzie and later researchers could not produce a general theory which includes traded input goods because of the mathematical difficulty. As John Chipman points it, McKenzie found that "introduction of trade in intermediate product necessitates a fundamental alteration in classical analysis." Durable capital goods such as machines and installations are inputs to the productions in the same title as part and ingredients.

In view of the new theory, no physical criterion exists. Deardorff examines 10 versions of definitions in two groups but could not give a general formula for the case with intermediate goods. The competitive patterns are determined by the traders trials to find cheapest products in a world. The search of cheapest product is achieved by world optimal procurement. Thus the new theory explains how the global supply chains are formed.

## Empirical approach to comparative advantage

Comparative advantage is a theory about the benefits that specialization and trade would bring, rather than a strict prediction about actual behavior. (In practice, governments restrict international trade for a variety of reasons; under Ulysses S. Grant, the US postponed opening up to free trade until its industries were up to strength, following the example set earlier by Britain.) Nonetheless there is a large amount of empirical work testing the predictions of comparative advantage. The empirical works usually involve testing predictions of a particular model. For example, the Ricardian model predicts that technological differences in countries result in differences in labor productivity. The differences in labor productivity in turn determine the comparative advantages across different countries. Testing the Ricardian model for instance involves looking at the relationship between relative labor productivity and international trade patterns. A country that is relatively efficient in producing shoes tends to export shoes.

### Direct test: natural experiment of Japan

Assessing the validity of comparative advantage on a global scale with the examples of contemporary economies is analytically challenging because of the multiple factors driving globalization: indeed, investment, migration, and technological change play a role in addition to trade. Even if we could isolate the workings of open trade from other processes, establishing its causal impact also remains complicated: it would require a comparison with a counterfactual world without open trade. Considering the durability of different aspects of globalization, it is hard to assess the sole impact of open trade on a particular economy.

Daniel Bernhofen and John Brown have attempted to address this issue, by using a natural experiment of a sudden transition to open trade in a market economy. They focus on the case of Japan. The Japanese economy indeed developed over several centuries under autarky and a quasi-isolation from international trade but was, by the mid-19th century, a sophisticated market economy with a population of 30 million. Under Western military pressure, Japan opened its economy to foreign trade through a series of unequal treaties.

In 1859, the treaties limited tariffs to 5% and opened trade to Westerners. Considering that the transition from autarky, or self-sufficiency, to open trade was brutal, few changes to the fundamentals of the economy occurred in the first 20 years of trade. The general law of comparative advantage theorizes that an economy should, on average, export goods with low self-sufficiency prices and import goods with high self-sufficiency prices. Bernhofen and Brown found that by 1869, the price of Japan's main export, silk and derivatives, saw a 100% increase in real terms, while the prices of numerous imported goods declined of 30-75%. In the next decade, the ratio of imports to gross domestic product reached 4%.

### Structural estimation

Another important way of demonstrating the validity of comparative advantage has consisted in 'structural estimation' approaches. These approaches have built on the Ricardian formulation of two goods for two countries and subsequent models with many goods or many countries. The aim has been to reach a formulation accounting for both multiple goods and multiple countries, in order to reflect real-world conditions more accurately. Jonathan Eaton and Samuel Kortum underlined that a convincing model needed to incorporate the idea of a 'continuum of goods' developed by Dornbusch et al. for both goods and countries. They were able to do so by allowing for an arbitrary (integer) number i of countries, and dealing exclusively with unit labor requirements for each good (one for each point on the unit interval) in each country (of which there are i).

### Earlier empirical work

Two of the first tests of comparative advantage were by MacDougall (1951, 1952). A prediction of a two-country Ricardian comparative advantage model is that countries will export goods where output per worker (i.e. productivity) is higher. That is, we expect a positive relationship between output per worker and number of exports. MacDougall tested this relationship with data from the US and UK, and did indeed find a positive relationship. The statistical test of this positive relationship was replicated with new data by Stern (1962) and Balassa (1963).

Dosi et al. (1988) conduct a book-length empirical examination that suggests that international trade in manufactured goods is largely driven by differences in national technological competencies.

One critique of the textbook model of comparative advantage is that there are only two goods. The results of the model are robust to this assumption. Dornbusch et al. (1977) generalized the theory to allow for such a large number of goods as to form a smooth continuum. Based in part on these generalizations of the model, Davis (1995) provides a more recent view of the Ricardian approach to explain trade between countries with similar resources.

More recently, Golub and Hsieh (2000) presents modern statistical analysis of the relationship between relative productivity and trade patterns, which finds reasonably strong correlations, and Nunn (2007) finds that countries that have greater enforcement of contracts specialize in goods that require relationship-specific investments.

Taking a broader perspective, there has been work about the benefits of international trade. Zimring & Etkes (2014) finds that the Blockade of the Gaza Strip, which substantially restricted the availability of imports to Gaza, saw labor productivity fall by 20% in three years. Markusen et al. (1994) reports the effects of moving away from autarky to free trade during the Meiji Restoration, with the result that national income increased by up to 65% in 15 years.

## Criticism

Several arguments have been advanced against using comparative advantage as a justification for advocating free trade, and they have gained an audience among economists. For example, Dani Rodrik argues that free trade undermines democracy and equality within countries. James Brander and Barbara Spencer demonstrated how, in a strategic setting where a few firms compete for the world market, export subsidies and import restrictions can keep foreign firms from competing with national firms, increasing welfare in the country implementing these so-called strategic trade policies.

However, the overwhelming consensus of the economics profession remains that while these arguments against comparative advantage are theoretically valid under certain conditions or assumptions, these assumptions do not usually hold. Thus, these arguments should not be used to guide trade policy. Gregory Mankiw, chairman of the Harvard Economics Department, has stated: ″Few propositions command as much consensus among professional economists as that open world trade increases economic growth and raises living standards.″

There are some economists who dispute the claims of the benefit of comparative advantage. James K. Galbraith has stated that "free trade has attained the status of a god" and that " ... none of the world's most successful trading regions, including Japan, Korea, Taiwan, and now mainland China, reached their current status by adopting neoliberal trading rules." He argues that comparative advantage relies on the assumption of constant returns, which he states is not generally the case. According to Galbraith, nations trapped into specializing in agriculture are condemned to perpetual poverty, as agriculture is dependent on land, a finite non-increasing natural resource. These comments have been heavily criticized by mainstream academics like Paul Krugman, who noted the lack of mathematical modeling or simulations supporting the argument, and cast doubt on the scientific credibility of Galbraith's claims, calling him "an intellectual outside his field".