The immune system is incredibly complex, but most of us would probably assume that ideally it runs very precisely, like clockwork. However, a new study has found that a big dose of chaos is not just present but may be a necessary piece of the puzzle in helping the immune system regulate itself.

In mathematics, the theory of chaos dynamics describes how tiny changes in the conditions of a complex system can snowball into massive differences later on, making it almost impossible to accurately predict the end results. It's most commonly known through the "butterfly effect" – where, for example, a butterfly flapping its wings on one side of the planet could lead to a hurricane on the other. Or maybe you remember chaos theory from Jeff Goldblum's rambled warnings in Jurassic Park.

Interestingly, until recently it hadn't really been applied to biology – on the contrary, living things are usually thought to avoid chaos. But now, researchers from the Niels Bohr Institute at the University of Copenhagen have discovered that chaos dynamics may play a vital role in the immune system.

The team focused on a protein called NF-κB, which, among other functions, regulates how the immune system responds to threats. But it doesn't just stay at a constant level in the body – instead, it fluctuates over time. While this was known to occur, the new study is the first to demonstrate that the effect is the result of chaos dynamics.

This isn't just a system that tolerates chaos either. As the levels of NF-κB swing up and down, the activation of certain genes increases, meaning the protein is working at peak efficiency when there's a healthy amount of chaos in the system.

"The results can have a tremendous impact on our understanding of how the immune system functions and how the incidence of some of the most serious illnesses, including diabetes, cancer and Alzheimer's, might be avoided," says Mogens Høgh Jensen, co-author of the study. "For example, we know that cancer is related to a failure of signaling within the body. So, to avoid cancer, it is imperative to have the right dynamic at work in cells."

The team says that this finding could help inform future treatments for a wide range of illnesses.

"These could come in the form of new medications that ensure proper protein function," says Mathias Heltberg, co-author of the study. "Therapies could also involve the withdrawal and testing of cells from a body to gauge whether cells are in the right condition to have the correct swings. If they aren't, it may be possible to predict and discover illnesses before they occur."

The research was published in the journal Nature Communications.