Formula for feasibility for production versus import Is there a formula that can tell us whether it's better for a country to produce something inside (creating tariffs &amp; regulations, subsidies) or it is better to import (lowering tariffs, etc)?

For example, imagine there's some gizmo. It can be bought on the external market for \$100, or it can be produced locally, importing \$50 worth of raw materials, and the end price will be \$150.

What other variables we need to consider here, and how do we make this computation of feasibility?
Really, when considering whether importing a good is beneficial to a country we need only look at comparative advantage. For this concept however, we need information on another good which could be produced in each country. Consider the following example:

Suppose we have country A and country B. Both countries can produce only two goods (for simplicity). These goods are gizmos and doodads. Each country has 100 labor hours to spend on production. It costs country A 10 hours to produce a gizmo and 5 hours to produce a doodad. It costs country B 15 hours to produce a gizmo and 6 hours to produce a doodad.

Using this information, we can see that country A can produce both gizmos and doodads more efficiently than country B. This is what we call absolute advantage. A country has absolute advantage in producing a good if it takes less resources for that country to produce the good.

Now, just because country A has an absolute advantage in producing both goods does not mean that they cannot benefit from trade. In order to see how they can benefit, we must look at the opportunity cost of producing each good for both countries. We will consider the case where opportunity costs are constant.

$\textbf{For country A:}$

If they want to produce a gizmo, they must give up the opportunity to produce 2 doodads. Therefore the opportunity cost is 2 doodads. If country A wants to produce a doodad, they must give up the opportunity to produce 0.5 gizmos. Therefore the opportunity cost is 0.5 gizmos.

$\textbf{For country B:}$

If they want to produce a gizmo, they must give up the opportunity to produce 2.5 doodads. If they want to produce a doodad, they must give up the opportunity to produce 0.4 gizmos. 

Now, we can see that the opportunity cost for producing gizmos is lower in country A, and the opportunity cost for producing doodas is lower in country B. This means that country A has a comparative advantage in producing gizmos and country B has a comparative advantage in producing doodads. On a side note, this situation will always be the case. If we are looking at a two-country-two-good world, each country will have comparative advantage in production of one good.

What has all of this analysis told us? Well, it has told us that each country would be better off if they produced only the good for which they have comparative advantage in production and traded for the other good.

This is, of course, a very simplified example, but the same basic concept applies when you start adding more countries and more goods. I hope this helps!