*(Note: this is a follow-up to my previous story. If you haven’t read that one, you should! This story assumes you’ve checked out the earlier one.*)

Relationships can be complicated, unpredictable, and dramatic. While this makes for great tabloid fodder or binge-worthy television, it also complicates mathematical modeling. After all, where’s the dramatic tension if we can predict how someone’s feelings will change at any point in the future?

We attempted just this kind of modeling exercise in our last story. Equipped with a handful of different models, we explored relationships between two people over time. And while those models grew in complexity, they all shared one common feature: they were *linear*.

What does this mean? A rigorous explanation gets a little technical, but loosely speaking, there’s a limit to how complex the solutions to our linear equations can be. You may have experienced some of these limitations yourself: out of our three models, only one yielded examples of relationships that evolved and stabilized to non-zero values. And even those relationships tended to follow a predictable pattern, with each individual’s feelings gradually stabilizing along a smooth, relatively drama-free curve.

Before talking more about what makes a set of (differential) equations nonlinear, let’s take a look at an example.

Let’s revisit our second model from the previous story. The equations we were modeling were these:

These were the models that gave us four archetypes for people in relationships: *eager beavers*, *narcissistic nerds*, *cautious lovers*, and *hermits*.

This model gave us some cool pictures, but it also didn’t seem to do a great job modeling healthy and realistic relationships. But maybe that’s because the assumptions in the model aren’t healthy or realistic, either.

For example, this model assumes that each person has relatively simple response behavior to their partner’s feelings: they either respond positively or negatively to those feelings, no matter what. But this an oversimplification.

What seems more likely is that your response to your partner’s feelings may depend on the intensity of those feelings. Many people enjoy being loved and appreciated, and would respond positively to such feelings from their partner. If those feelings become too intense, though, especially early in a relationship, then they may well backfire.

Let’s take a look at a model that takes a more nuanced approach to how each person responds to the feelings of their partner. Below are a couple of graphs. The first one is the same one from the previous story, whose equations are given above. The second one is a modified version in which each person’s response to their partner will flip if the partner’s feelings become too intense. (For more on this model, check out *Dynamical Models of Love*, a paper by J. C. Sprott. There’s a link at the end of this story.)

A's Initial Feelings

A's Response to B's Feelings

A's Response to A's Feelings

B's Initial Feelings

B's Response to A's Feelings

B's Response to B's Feelings

Figure 1: On the left, our linear model from before; on the right, a new and nonlinear model.

As you explore these models, it’s pretty clear that the latter one allows for a larger family of relationships. For example, the second model allows for relationships that stabilize but still have some variation.

So how is the second model different? Well, here are the equations used:

We’ll talk more about the notation in just a bit. These equations certainly look a little complicated. But what does it mean for them to be *nonlinear*?

All of the equations in our last story, including the ones for the first model above, are *linear*. This is because in both of them, the expressions on the right hand side of the equals sign consist only of **constant multiples of the functions we’re trying to model** (*A(t)* and *B(t)*), along with optionally any additional *constant* terms.

In particular, these equations don’t involve any more complex expressions involving *A(t)* and *B(t)*, such as *A(t)* × *B(t)*, *A(t)* × *A(t)*, or more complex expressions, such as *A(t)* × (1 - |*A(t)*|).

If you’ve gotten far enough in my book, you’ll see that I talk about this nonlinear example at length. Unfortunately, I let a pretty egregious error slip through: the figures are correct, but the functions aren’t! In the book I replaced the absolute value function by a different function accidentally. One thousand apologies!

(In case you need a refresher, the notation |*x*| denotes the absolute value of *x*, which measures the magnitude of *x* and ignores its sign. So, for example, |5| = 5, but |-5| = 5 too.)

The linear models we’ve seen so far are examples of a family of equations that are well-understood by mathematicians. (For more on that family, click here.) However, nonlinear models are much trickier in general. One reason for this is that with a system of linear differential equations, you can combine solutions you’ve already found in order to generate new solutions. However, this is not possible in general with nonlinear systems, which makes solving them much more challenging. In fact, one of the Clay Mathematics Institute Millenium Problems revolves around the Navier-Stokes equations, a famious system of nonlinear differential equations. A solution to this problem will bring you a million dollars and an unlimited supply of mathematical street cred.

Because the real world is endlessly complex, it should come as no surprise that it’s also full of nonlinear systems of differential equations. These systems are used to model a wide variety of phenomena, from predator/prey relationships, to the weather, to superconductivity. And yes, they’re even used to model love.

But even though the model above is non-linear, there’s still a problem: it’s highly predictable. If you use a computer to generate solutions to those equations, you can plug in any time value you want and figure out, with a high degree of precision, how each person will feel about the other. Of course, this assumes that you can measure all of the parameters that go into the equations, which is another huge assumption. But for now, let’s focus on predictability.

There are some mathematical models that don’t give you perfect predictive power, even when you have good information. Models of the weather are a classic example of this. Even our best mathematical models of the weather can’t provide accurate forecasts more than a couple of weeks out. You could ask for a better model, but more refined models would almost certainly suffer a similar fate. The reason for this has to do with another mathematical buzzword: *chaos*.

There are a few hallmarks of chaos, but the one we’ll concern ourselves with here is also the one that’s the most well known. The technical term for it is *sensitivity to initial conditions*, but it’s more commonly known as the *butterfly effect*.

Sensitivity to initial conditions means that if we make small changes to the input values to the system, the system may evolve in an entirely different way. Rather than small perturbations remaining small over time, instead they produce an entirely different trajectory for the system. Or, in the words of mathematician Edward Lorenz, “Chaos: When the present determines the future, but the approximate present does not approximately determine the future.”

It should be noted that sensitivity to initial conditions doesn’t automatically make a system chaotic. But every chaotic system must have this property. And while linear systems like the ones we’ve seen so far can never be chaotic, nonlinear systems frequently are.

Technically, linear systems of differential equations can be chaotic, but only if they are infinitely dimensional. But that’s a rabbit hole for another day.

While nonlinear systems can be chaotic, the one we looked at earlier in this story isn’t. However, we can bring chaos into the relationship in a way that perhaps isn’t so surprising: by adding a third party.

Imagine now that Person B is secretly trysting with two people, Person A and Person C. A and C don’t know about one another, and so their feelings depend only on their response to B’s feelings, and on their response to their own feelings. B’s feelings, on the other hand, are a bit more complicated. Person B responds not only to their own feelings, but also to the combined feelings of Person A and Person C. For simplicity, we’ll assume that Person A and Person C have equal effect on Person B’s feelings, though you could drop this assumption in a slightly more complicated model.

In this scenario, we can think of Person B’s feelings in two parts: feelings towards Person A, and feelings towards Person C. However, these two relationships are not independent. As you can see by adjusting the values, altering a parameter in Person A’s personality affects both relationships, and similarly for Person C. Even though Person B may want to keep A and C in the dark, the relationships themselves cannot lie.

To see chaos in action, try adjusting one of the parameters just a little bit. For example, if you adjust A’s feelings upwards just a couple of ticks, these relationships go absolutely bonkers. If you adjust A’s initial feelings down a couple of ticks, things are relatively stable, but there’s no rhyme or reason to how the peaks and valleys in each graph change based on this slight adjustment to initial conditions. (Note that I’ve extended the x-axis out so that the timeline is twice as long as in the other visualizations, so that we can see even more chaotic behavior.)

A's Initial Feelings

A's Response to B's Feelings for A

A's Response to A's Feelings

B's Initial Feelings for A

B's Response to A & C's Feelings

B's Response to B's Feelings

B's Initial Feelings for C

C's Initial Feelings

C's Response to B's Feelings for C

C's Response to C's Feelings