Hope you brought a book. Photo: David S. Holloway/Getty Images

At Chicago’s O’Hare Airport last Sunday, two-hour security lines caused 400-some American Airlines passengers to miss their flights, leaving customers to sleep on cots until they could finally catch a flight out. Lines in Atlanta are snaking for an hour or more. Around New York, it’s so bad that the Port Authority is considering switching out TSA agents for private contractors, which has already happened at over 20 airports around the country. Clowns and ponies are reportedly being brought in to calm traveler rage.

At a macro level, this is what happens when the number of air passengers increases by ten percent and the number of Transportation Security Administration agents decreases by ten percent over a five-year span. While assuring travelers that more agents would be added soon, Homeland Security Secretary Jeh Johnson gave the Zen-like advice to “contemplate increased wait times as you travel.”

But there’s more going on here, and the nightmare scenes going on at airports across the U.S. are case studies in how the most efficient human systems actually leave room for people to work with.

The thing about queues, as MIT engineering systems professor Richard Larson explained to Science of Us, is that they’re “very sensitive systems,” especially at full capacity. “The TSA queues these days, it looks like they’re busy 100 percent of the time,” he says. “You can’t expect them to be busy 100-percent and have any rational [as in not insane] queues. They’re going to grow without bound.”

Queues are governed by Little’s Law, which states that the number of items in a queuing system (the length of a queue) is equal to the average waiting time per item (how long each interaction takes) times the number of items arriving per unit time (how many people/things are coming in).

For queues with “servers” — someone handling transactions with whomever’s at the front of the line — the server needs to have some idle time, otherwise the queue, according to the math, could grow without limit. For a queue with only a single server, the rule of thumb is about 15 percent to 20 percent idle time. If there’s lots of servers (like a call bank with hundreds of people taking calls), then they don’t need as much idle time, because there’s less of a chance of every server being occupied at once, causing the line to build and leading to the inevitable viral videos.

A lot of this, Larson says, has to do with the profoundly human quality of variability. If queues were mechanical — like in a well-run factory, where the time of arrival and the time of service for each transaction were highly predictable — then a server could be super busy and queues still wouldn’t form.

But people are neither predictable nor identical in how they approach airline travel.

While Larson hasn’t empirically measured this, he speculates that seasonality is driving the increasingly outsized lines. We’re entering into the very start of the summer travel season, and so more infrequent flyers are coming to airports. With their inexperience comes variability: Passengers might not know to take their shoes off or phones out, not to mention the families with cute yet unruly young children. On top of that, baggage fees are pressuring passengers to stuff as much as possible into their carry-ons, introducing even more variability. Add all these snags together, and you get snowballing delays.

That’s why, Larson says, if you were to line up veteran travelers and novice travelers in queues of equal length, the veteran line would move in half the time. Those grizzled travelers, shoes off before they even arrive at the bins, introduce much less variability.

You can see way variability leads to queues not just in line at the airport, but on the road. If cars were more automated, as they may soon be, there’d be much less congestion. But because it only takes one rubbernecker to introduce a heaping dose of unwanted variability into the system, things break down fairly easily, and suddenly everyone is stuck at a crawl.

“If there’s a lot of driverless cars, they could double or triple the capacity of the highway because of the reduced uncertainty,” Larson says. “With humans, you only communicate with people in front of you. That’s why you get these unexplained waves of traffic, which are due to these instabilities.”

But TSA can’t automate the flying public. Instead, Larson has a few reasons for hope. American Airlines, for one, is bringing in extra staff to coach passengers waiting in line with the hopes of reducing variability. Another idea would be to go through TSA the same way passengers board planes — like by creating a separate line for elderly and families with young children.

For customers, Larson says, the most “no-brainer” thing you can do is take the time and $85 to sign up for the TSA PreCheck. If you fly several times a year, it could save you hours of waiting. Does he have it? Not yet — but he and his wife are going in for the interviews next week.