In the United States, sporting events often start with a performance of The Star-Spangled Banner, the American national anthem. Here’s one example. These performances reliably give me goosebumps, make me teary-eyed, and fire me up! This is fascinating because I’m not even American and yet hearing the last verse of the anthem (“for the land of the free and the home of the brave”) followed by the roar of two F-16s brings tears to my eyes every single time. So in this post I’m going to go into what this feeling is, why and how we might have evolved it, and then share a simulation showing how the patriotic gene must strike a delicate balance between risk-taking for the tribe and individual survival.
Patriotism: What, How, and Why
The phenomenon I’m referring to is often felt during events displaying or honoring great sacrifice. This is often in a collective setting and/or before going into battle (or in the modern world, sporting events). Here are some examples I found on the internet:
The effects I get from these scenes include goosebumps, a knot in my throat, elevated heart rate, tears in my eyes. It’s a full-body experience that leaves me feeling inspired, grateful, and moved. This feeling has been described as elevation, kama muta, frisson, and collective effervescence, and seems to be a deeply embedded mechanism built into humans with the purpose of bringing us closer to our tribe.
We probably evolved this as a way of surviving: if we feel energized by our tribe we are more likely to stay with it, increasing our individual chances of survival. And if we are willing to defend our tribe, we increase our tribe’s chances of survival. From here on, I’ll refer to this quality of being willing to die for your tribe as “patriotism.”
There’s an interesting conflict here: if the gene for patriotism makes you more likely to die for your tribe, you are also less likely to propagate it forward (because you might die before having kids). Therefore, there must surely be a balance between being willing to die for your tribe, but not too willing that you die before reproducing and propagating your patriotic genes.
In evolutionary biology, sacrificing your own chances of survival in favor of your tribe’s is known as altruism. A theory on why altruistic behavior emerges is that, at the population level, its benefits to the gene’s survival often outweigh the costs to individuals. For example, even if your patriotic behavior results in your death (and therefore you never spread your copies of the patriotic gene), you ensure the survival of genetically related tribe members which likely also carry the patriotic gene. Therefore, the gene lives on.
Simulating Patriotism
I wanted more intuition for how evolution finds the perfect amount of patriotic genes in a tribe, so I came up with a mathematical model for it and ran a ton of simulations showing tribe survival as a function of patriotism. First I represented a tribe as a list of numbers, each from zero to one. The number represents how patriotic a tribe member is, with 1.0 being most patriotic and 0.0 being least patriotic. For example, tribe i has 4 members and is represented as follows:
Next, I modeled reproduction dynamics and survival over time. At every point in time, each tribe member can add a new tribe member to the tribe’s list, with a patriotism score that is within 5% of the parent’s patriotism score. This models reproduction and the heritability of the patriotism gene. Survival of the tribe depends on two conditions:
the number of tribe members must be greater than zero.
the average patriotism of the tribe must be above a certain threshold. If the tribe is not patriotic enough, environmental threats overcome it and wipe it out.
At every point in time, each tribe member has a chance of dying given by the following expression:
You can think of the base chance of dying as the overall danger due to environmental factors like other tribes, animals, or weather. Note that this model only simulates the risk of death due to patriotic behavior, and not other dangers (like disease or old age) that are present whether or not a tribe member is patriotic.
We now have two competing evolutionary pressures: members must be patriotic enough to help the tribe survive, but if they’re too patriotic their chances of dying (and not reproducing) are higher.
Next I wanted to see if my simple model was expressive enough to simulate the following intuition: if a tribe is too patriotic, members may take too many risks and die before reproducing. But if it’s not patriotic enough, it won’t survive the dangers of nature. So I coded my model in Python + JAX (see code here) and ran simulations for tribe survival as a function of initial patriotism.
The results are shown in the figure below, where the y-axis shows average tribe patriotism level, and the x-axis is time. Each line represents a single tribe over time, with its color indicating its initial patriotism level.

One visible trend is that tribes overwhelmingly reduce patriotism over time. Highly patriotic tribes (yellow lines) often get wiped out by risky behavior, and the ones that survive do so by reducing their patriotism over time. The catch is that if the initial patriotism is too low (purple lines), they often died at the survival threshold (grey area at the bottom).
Another way of visualizing the balance the patriot gene must strike is by visualizing how long tribes survive, on average. In the figure below, I show how initial patriotism of a tribe affects how long it survives. As expected, there’s a sweet spot in the middle in which the tribes are patriotic but not too patriotic, so they survive for longer.
Final thoughts
In a future post, I could make the model a bit more expressive. For example, can we calibrate this notion of patriotism with any real-life, measurable metrics? This might allow us to say how patriotic a real country is, and simulate their “survival” over time and/or what might happen in the future. Or, alternatively, what if we simulate a tribe’s death a bit better: in real life, tribe’s survival may depend on high-consequence, low-probability events instead of a fixed patriotism requirement (see black swan theory).
29/100 posts

