Gary Cohn had enough. Oh, not when the President praised neo-Nazis. That wasn’t enough. But when Trump unilaterally announced steel and aluminum tariffs against every other country in the world, that was enough. Cohn issued his resignation, possessed of the tax bill his vulture capitalist friends wanted and not wanting to be the face of protection. Although he said there was no one reason, there was only one reason: Trump is an idiot. For a while he was a useful idiot, but now one of them had to go. Fly, Gary, fly.

Rex Tillerson also had to go. Tillerson may have been the U.S. version of an oil oligarch, but he was a defender of free trade and one of the rare “adults in the room” in the White House. He found out by tweet that he was being evicted from the State Department shortly after Trump put him at odds with his oil buddies over the incipient trade war. In only one week, two of the biggest foes of tariffs were on the street and shaking their heads.

This tweet may have had a lot to do with it.

Uh, yeah, there’s a lot to unpack there. The US has a trade deficit of over $500 billion, due to softness in the manufacturing sector, a strengthening dollar in the mid-2010s, and other factors way too complex for Trump to comprehend. But not with virtually every country. We have a trade surplus with many of our biggest trade partners. Our trade surpluses include the United Kingdom, Hong Kong, Australia, the Netherlands, and Brazil. Oh, Canada as well. Our commenter-in-chief has no idea that we have a trade surplus with the Great White North, as evidenced by his admission that he lied to Prime Minister Trudeau and hadn’t bothered to find out if we had a surplus or a deficit. He doubled down on it on Twitter, making us the laughingstock of the world for the, I don’t know, 60th straight week or something.

And the $100 bil he says we’re down on China doesn’t mean we can just stop trading with them. That’s not how trade works. Take a look at this chart.

Those are some very red states.

Each of those states has China as its top export partner, or very near the top. Quite a lot of them are states Trump won. They’d all be devastated if they suddenly lost hundreds of billions in trade with China. I can’t imagine Trump would like to lose all support in those particular states.

But I want to focus on Trump’s idiotic statement that “trade wars are good, and easy to win.” They’re neither of those. But what might surprise you is that free trade is not the historical norm. Despite what Adam Smith taught you in Econ 101, protectionism was the standard policy of nearly every country prior to World War II. Only after the Cold War began did nations start to pull the bandages off and loosen tariffs around the globe. That’s because on a game theory level, a trade war had a new parallel apocalypse: nuclear war.

Both arms agreements and free trade agreements are functional because of a communal understanding of the prisoner’s dilemma, and how fraught it is with peril. The prisoner’s dilemma suggests that if there is a possibility of one side betraying the other, there is a certainty of both sides betraying the other. The payoff for betraying is always greater than the payoff for not. Here’s a simple payoff matrix.

We both put in a dollar. If we don’t betray each other, I get $1 and you get $1. If you betray me but I don’t betray you, you come out much better: you get $2 and I lose $1. If we both betray each other, we both get nothing. So if you don’t betray, me betraying beats me not betraying ($2>$1). If you do betray, me betraying beats me not betraying ($0>–$1). So betraying is always better.

Some people assume that the prisoner’s dilemma only functions when it’s a non-repeated situation, meaning you don’t have to deal with another chance where everyone knows you betrayed. This is also wrong. The iterated prisoner’s dilemma, also known as the peace-war game, predicts behavior of participants in multiple-round negotiations. Imagine you and I have two identical dilemma situations in sequence, where we can pick either peace or war. We both know both of us will pick war in the final one, because if there’s a possibility of betraying without consequence, there’s a certainty of it. Since we know that, then in the previous event, we both know that in the previous round, we should both pick war, because we do better in war and because war is inevitable. In two rounds of this game, it’s all war.

This is the same in three rounds of this game, and four rounds, and so on until… well, that’s where it gets interesting. If we don’t know how many rounds there are, then we don’t know when war will come, so maybe, just maybe, we can bet on peace and expect war will happen well after we’re gone. Except that doesn’t work either. War is still always more profitable than peace, and since it’s coming eventually, we should always pick war. This is called the shadow of the future. We know that war will come, and war is always more profitable than peace, so we pick war.

Don’t worry, I’m getting to the hopeful part. There’s a possibility we haven’t considered: that the game will end with total annihilation at an unexpected point in our warmaking. This is mutual assured destruction. War becomes too horrible to consider at that point, and so we never declare war. Why this works is a simple construct called the grim trigger. It says that once a side picks war, it can only pick war until at some point everyone dies in a wave of annihilation. We don’t know when, but we can calculate the damage that’s coming in the following way.

Let’s say the daily payoff for declaring war is two trillion dollars, and peace is only a trillion. Woo! I want a bonus trillion dollars, so on day one I declare war. But after war is declared there’s some probability that the world will be consumed in flame the next day. Let’s say for a minute that it’s 10%. I survive day one! So now day two comes, and my profit is a trillion dollars for day one, but only the day two result of a trillion dollars times 90%, with a 10% chance I die. And if I live through day two, then my profit is a trillion dollars times 81% (90% of 90%), with a 19% chance I die by then. And so on and so on, until I get to a value of ten trillion dollars and/or death by fire.

But wait. When I declare war, my opponent will also declare war. So they’re heading down this path too. So for all participants, the game is finite. We end with ten trillion dollars and/or death by fire.

That’s ten trillion, which sounds a lot better than one trillion for peace. But in peace, we get a trillion dollars every day, and we don’t die by fire. A trillion dollars every day for a month is thirty trillion dollars. In one month, we’ve made three times the value of war, simply by being patient with each other. The grim trigger isn’t so grim, because it keeps us peaceful.

A trade war works the same way. We’re a little richer in the short term, and doomed in the long term. It’s an idiotic approach. Yet here we are. President Trump’s trade policy has made everything more expensive and less desirable. Farmers are hurting. Manufacturers are hurting. Retailers are hurting. Practically the only one not hurting is Trump. That’s because he’s never thought long-term. Not about anything. Certainly not about trade.

So now Trump’s policy—if it can even be said to have been one—has failed. The U.S. and E.U. have reached a deal to end tariffs. China and Canada should follow too. It was all a massively painful stunt. In a few years, I hope we can say that about the Trump presidency as well.

This is the nineteenth installment of a series on politics and game theory. It has covered impeachment, Russian collusion, white supremacy, abortion, guns, nuclear war, debt, the NFL, sexual harassment, the Mueller probe, taxes, Trump’s first year, the Clinton Foundation, immigration, parades, the Democrats, hope, and separation of migrant families. A note on this article: I wrote it in April but never published it till late July. But now it’s here! Essays like this are in my new book, Game Theory in the Age of Chaos.