By now you’ve probably seen the infuriating video of a man being forcibly dragged off a United Airlines flight by police. His crime? He purchased a ticket in advance, arrived at the airport on time, boarded the airplane when the airline told him to board, then quietly sat in the seat the airline reserved for him. United Airlines, however, decided that a crew member needed to have that man’s seat. When nobody on the plane volunteered to take a different flight in exchange for $800, the airline sent police to forcibly remove that man from the plane so a United crew member could sit there.

The video of the incident is enough to make anyone want to stock up on tar and feathers and trek to the United Airlines headquarters in Chicago, Illinois. There’s no excuse on earth for the way that man was treated. He did nothing wrong, yet United apparently chose to victimize him for having the audacity to buy a plane ticket and boarding a flight as instructed. By all appearances, United willfully and deliberately targeted this man for persecution because it was too cheap to just offer more money for a volunteer to hop on a different flight. But what about the overbooking, the practice of selling more seats than are available, which led to the seat shortage in the first place? Should that practice be discouraged or prohibited going forward?

To understand whether that would be a good idea, you first have to understand why airlines even do it. The short answer is that from a pure financial perspective, it would be crazy for airlines not to overbook. Airlines call it revenue or yield management. By continuously compiling and analyzing data on who shows up to which flights, airlines are able to calculate probability distributions for each flight to figure out precisely how many seats they should sell to maximize the amount of revenue earned per flight.

This video from TED-Ed does a great job of explaining the complicated math used to calculate these probability and revenue estimates:

The reason for overbooking is that a seat on a flight is a perishable good. If a seat remains empty, it can never be sold again. Just as a piece of meat will spoil if it sits in a butcher shop display for too long, an empty airline seat spoils the second that flight takes off. As a result, airlines will now do anything in their power to avoid a plane with empty seats.

To figure out how to maximize their expected revenue per flight (revenue maximization comes first; concern about passenger experience comes later, if at all), airlines determine the cost of the seats to be sold (this variable also serves as the cost of not selling a seat), the cost to rebook if the number of people who show up for the flight exceeds the total number of seats, and the probabilities of each different seat availability scenario based on historical data.

Here’s a simple example that demonstrates the logic of overbooking. Let’s assume a particular flight has 100 seats, that each seat costs $200, that rebooking an oversold seat costs $500, and that the following probabilities govern who shows up: there’s a 10 percent chance every person who bought a ticket shows up, and a 90 percent chance that only 95 percent of ticket buyers show up, and under no circumstances will the airline sell more than 110 tickets.

In this example, there are 22 different revenue scenarios (the math on each is shown below). Let’s look at just a few of them to illustrate the revenue dynamic. If the airline sells 100 seats and 100 people show up, the airline will make $20,000 (100 seats x $200 = $20,000). If the airline sells 110 seats and 110 people show up, the airline will only make $17,000 (110 seats x $200 = $22,000 minus $5,000 to rebook 10 passengers), far less than if it had only sold the number of seats available.

If the airline sells 105 seats and only 100 people show up, the airline will make $21,000 (105 seats x $200 = $21,000 with no rebooking costs). Now if you do the revenue numbers for each scenario, multiply each by the assigned probability for that particular scenario, then add the two revenue numbers per scenario together, you’ll end up with a net expected revenue number for each ticket sold scenario. The results are shown below.

As you can see, overbooking makes complete economic sense. Using the assumptions we outlined in this problem, the optimal number of tickets to sell is 105 because it generates the maximum expected revenue per flight. Based on the data estimating who will show up, the airline can expect to earn $20,750 per flight if it sells 105 tickets, even though the flight’s capacity is only 100 seats.

The airline could sell up to 107 seats based on its data and still earn more money ($20,150) than if it only sold as many seats as were available, even taking costly rebooking fees into account. Because some amount of no-shows is more likely than every ticket buyer showing up for the flight, airlines are incentivized to overbook to maximize the amount of revenue they earn per flight.

Because of the math outlined above, and because flight no-shows are statistically more likely than every ticket buyer showing up for the flight, airlines will continue to overbook passengers as a matter of course. Until it becomes economically irrational — for example, if rebooking costs go through the roof or customer ill will from overbooking sends passengers elsewhere — or illegal for them to do so, airlines will continue overbooking passengers.

That leaves angry potential customers with two main options: lobby the government to make overbooking illegal, or band together with fellow passengers at the airport to force the airlines to pay more to bump someone from a flight. Or you could ditch airlines altogether and drive if that’s a possibility. But until overbooking becomes an illegal act or an economic liability, airlines are going to keep doing it.