At the Olympics, we’re witnessing some serious cases of public shaming. Victorious competitors are publicly ostracizing those who once used performance-enhancing drugs. To take just one example, Australian Mack Horton, gold medalist in the 400-meter freestyle, pointedly refused even to acknowledge China’s silver medalist Sun Yang, who had been suspended for doping. “I don’t have time or respect for drug cheats,” Horton said later.

Horton and others are aggressively asserting the social norm against drug use. By ostracizing those who violate that norm, they’re giving some important clues about the functions of norms in general — and how they can be fortified.

As the philosopher Edna Ullmann-Margalit has shown, many social norms have a specific function: deterring people from making self-interested decisions that end up harming the community as a whole. In that respect, norms operate a lot like laws; they operate as private enforcement mechanisms, preventing people from acting to their mutual detriment.

A small example: You probably won’t try to cut into a long line at the checkout counter at the local grocery store, because your neighbors would get upset with you and you’d probably feel ashamed. Long lines aren’t much fun, and for busy shoppers, it might be tempting to try to cut in. But all of us benefit from the norm against doing that: It prevents a free-for-all.

In many places, there is a strong social norm against littering. Individuals might find it in their self-interest to litter, but if everyone does so, communities will be a lot dirtier. An anti-littering norm, enforced by social pressure (and far less frequently by law), solves a potentially big problem. The institution of private property itself is made possible not only by law but more fundamentally by norms, which lead most of us to respect other people’s holdings even if the police are unlikely to get involved.

Turn in this light to the Olympics, where norms are essential to keep competition from getting out of hand. Performance-enhancing drugs are a defining example. If Russian swimmers use drugs, then (all else being equal) other swimmers will feel pressure to use them as well to stay competitive. Before long, a lot of people will be doping. A ban on drug use prevents athletes from competing to their collective detriment.

advertisement | advertise on newsday

The challenge is that for the very reason that the ban is needed, it might be difficult to enforce. Athletes who want to win will be sorely tempted to violate it, and to do whatever they can get away with the violation. Maybe they’ll be caught — but maybe not.

That’s where norms become so important. In international competitions, athletes get to know one another, and they often become friendly. If an athlete knows that doping will mean contempt or ostracization from her peers, deterrence will increase.

In other words, nobody wants to be on the receiving end of the opprobrium directed at Yulia Efimova, a Russian suspended for doping in 2014. Booed by the audience and ignored by the triumphant gold medalist swimmer Lilly King, silver medalist Efimova was nearly reduced to tears during a post-race news conference. King was unmoved, saying, “I’m not a fan.”

In sports as in daily life, shaming and prospect of ostracism can be great motivators. No athlete wants to be treated as a pariah, especially by her fellow competitors; their disapproval operates like a fine or a tax. If gold medal winners like Horton and King prominently show contempt for those who have used performance-enhancing drugs, coaches and athletes alike may hesitate before doping in the future.

Will it work? The challenge is that here, as elsewhere, people’s behavior is a product of numerous incentives, not just one. A spot in the Olympics, or a shot at gold, can be hard to resist; if a drug really would make the difference, some athletes will always be tempted. In these circumstances, it’s not entirely pleasant to see Olympic gold medalists acting as village elders or self-appointed drug police — but if we want a level playing field in the future, it’s probably a good idea.

Cass Sunstein, a Bloomberg View columnist, is director of the Harvard Law School’s program on behavioral economics and public policy.