This is Part 1 of a 7-part series revisiting the trolley problem with deeper philosophical tools.

Sometime between 1265 and 1274, Thomas Aquinas was working through a problem that had nothing to do with trolleys. He was writing about self-defense: is it permissible to kill an attacker to save your own life? His answer, in the Summa Theologica, introduced a line of reasoning that would quietly shape moral philosophy for centuries to come.[1]

The reasoning became known as the doctrine of double effect. Aquinas himself didn't formulate it as a tidy set of rules; later thinkers in the Catholic moral tradition, particularly Joseph Mangan in 1949, distilled it into the four conditions most philosophers now recognize.[5] An action that produces both good and bad consequences may be morally permissible if: the action itself is not intrinsically wrong; the agent intends the good effect, not the bad; the bad effect is not the means to achieving the good; and there is proportionate reason for allowing the bad effect to occur.

This sounds abstract until you realize it's the hidden architecture of the trolley problem itself.

The Engine Behind the Thought Experiment

When Philippa Foot introduced the trolley problem in 1967, she was, in significant part, probing the doctrine of double effect.[2] The scenario was designed to test whether the distinction between intended and merely foreseen consequences holds moral weight.

A railroad lever at a track junction viewed from above, two tracks diverging into warm and cold tones, representing the trolley problem's core choice
In the classic trolley problem, the lever-pull may be permissible under double effect. The loop track variant is morally different, even though the outcome is identical.

Consider the classic case. You divert the trolley to save five people, foreseeing that one person on the side track will die. Under double effect, this may be permissible: you intend to save the five, the death of the one is foreseen but not intended, and the one person's death is not the means of saving the five. If that person magically teleported away at the last second, the five would still be saved. The death is a side effect, not an instrument.

Now consider the loop track variant. The trolley is diverted onto a side track that loops back toward the five. The only thing that stops it is the body of the one person on the side track. Here, the person's death is the means of saving the five. Remove the person, and the trolley circles back to kill everyone. Double effect says this is morally different from the standard case, even though the outcome (five saved, one dead) is identical.

Many people feel the difference intuitively, even if they can't articulate why. The doctrine of double effect gives that intuition a name and a structure.

Side Effects in Silicon

Algorithms don't have intentions. They have objective functions. But the people who design, train, and deploy them do have intentions, and the doctrine of double effect can help us think more carefully about the moral texture of algorithmic harm.

Consider a recommendation algorithm optimized for engagement. Its designers intend to keep users on the platform longer. Research suggests that a foreseeable side effect is that some users get pushed toward increasingly extreme or problematic content, in part because such content can drive higher engagement.[3] The radicalization is not the goal. It's a byproduct of pursuing the goal.

An algorithmic network branching from a central node, most branches glowing white but outer branches shifting to red, representing harmful side effects of optimization
When an algorithm's harm is a byproduct rather than a mechanism, the moral question shifts from intention to proportionality.

Under double effect, we'd ask: is the radicalization a side effect of engagement optimization, or is it the means by which engagement is achieved? If the algorithm could maintain engagement without pushing users toward extremes, the radicalization is a side effect, and the moral question becomes one of proportionality: is the harm proportionate to the good? If the algorithm can only maintain engagement through escalation, then the harm is the means, and double effect says the design is harder to justify morally, regardless of the intended goal.

This distinction matters in practice. A medical triage algorithm that maximizes total life-years saved will, as a foreseeable consequence, deprioritize elderly patients.[4] Is the deprioritization a side effect of maximizing life-years, or is it the mechanism through which life-years are maximized? The answer depends on the algorithm's structure. If the system could maximize life-years without systematically disadvantaging any age group, the harm is a side effect. If the system achieves its goal precisely by redirecting resources away from older patients, the harm is the means.

The same analysis could apply to hiring algorithms that optimize for "culture fit" and may produce demographic homogeneity, or content moderation systems that optimize for speed and risk disproportionate impact on certain communities. In each case, double effect asks: is the harm a regrettable byproduct, or is it baked into how the system achieves its objective?

The Proportionality Problem

Even when harm is genuinely a side effect rather than a means, double effect requires proportionate reason. The good achieved must be significant enough to justify the foreseeable harm.

This is where algorithmic systems face their sharpest moral challenge. A recommendation algorithm that slightly increases average session length while foreseeably contributing to political radicalization in a small percentage of users may fail the proportionality test. The good (marginally more engagement) is modest. The harm (radicalized individuals, eroded public discourse) is severe. Proportionality demands that we weigh these honestly, not hide behind aggregate metrics that make the harm invisible.

An ornate balance scale with a small golden sphere of good outweighed by a larger dark fractured sphere of harm, representing the proportionality test
Proportionality demands that we weigh the good achieved against the foreseeable harm honestly.

Aquinas could not have anticipated algorithms. But the moral structure he identified, the distinction between what we aim at and what we merely allow, between harm as instrument and harm as byproduct, between proportionate and disproportionate collateral damage, turns out to be precisely the framework we need for thinking about systems that cause harm on the way to achieving their objectives.

The doctrine of double effect doesn't tell us which algorithms to build. It tells us which questions to ask before we build them: Is the harm a side effect or a mechanism? Could the objective be achieved without the harm? And if not, is the good we're pursuing worth the damage we foresee?

Those questions won't make the trolley problem easier. But they'll make our reasoning about it more honest.

References

[1] Thomas Aquinas, Summa Theologica, II-II, Q. 64, Art. 7. English translation available via New Advent. https://www.newadvent.org/summa/3064.htm

[2] Philippa Foot, "The Problem of Abortion and the Doctrine of the Double Effect," Oxford Review, No. 5, 1967, pp. 5–15. Reprinted in Foot, Virtues and Vices, Oxford University Press, 2002.

[3] Muhammad Haroon et al., "Auditing YouTube's recommendation system for ideologically congenial, extreme, and problematic recommendations," Proceedings of the National Academy of Sciences, Vol. 120, No. 50, December 2023. Summary via UC Davis: https://www.ucdavis.edu/curiosity/news/youtube-video-recommendations-lead-more-extremist-content-right-leaning-users-researchers

[4] Sharon Begley, "A system to allocate scarce ventilators and ICU beds gains traction for not counting any group out," STAT News, April 2, 2020. https://www.statnews.com/2020/04/02/ventilator-icu-rationing-pittsburgh-framework/

[5] Alison McIntyre, "Doctrine of Double Effect," Stanford Encyclopedia of Philosophy, revised July 2023. https://plato.stanford.edu/entries/double-effect/