# Interlaced Roots: Strum's Separation Theorem

# Interlaced Roots: Strum's Separation Theorem

### We take a look the power Python has for data science when it comes to solving higher order mathematical problems, taking an example from differential equations.

Join the DZone community and get the full member experience.

Join For FreeHow to Simplify Apache Kafka. Get eBook.

**Strum's separation theorem** says that the zeros of independent solutions to an equation of the form

alternate. That is, between any two consecutive zeros of one solution, there is exactly one zero of the other solution. This is an important theorem because a lot of differential equations of this form come up in applications.

If we let *p*( *x*) = 0 and *q*( *x*) = 1, then sin(*x*) and cos(*x*) are independent solutions and we know that their zeros interlace. The zeros of sin(*x*) are of the form *n*π, and the zeros of cos(*x*) are multiples of (n + 1/2)π.

What's less obvious is that if we take two different linear combinations of sine and cosine, as long as they're not proportional, then their zeros interlace as well. For example, we could take *f*(*x*) = 3 sin(*x*) + 5 cos(*x*) and *g*(*x*) = 7 sin(*x*) - 11 cos(*x*). These are also linearly independent solutions to the same differential equation, and so the Strum separation theorem says their roots have to interlace.

If we take *p*(*x*) = 1/ *x* and *q*(*x*) = 1 - (ν/*x*)² then our differential equation becomes **Bessel's equation**, and the Bessel functions *J*_{ν} and *Y*_{ν} are independent solutions. Here's a little Python code to show how the zeros alternate when ν = 3.

```
import matplotlib.pyplot as plt
from scipy import linspace
from scipy.special import jn, yn
x = linspace(4, 30, 100)
plt.plot(x, jn(3, x), "-")
plt.plot(x, yn(3, x), "-.")
plt.legend(["$J_3$", "$Y_3$"])
plt.axhline(y=0,linewidth=1, color="k")
plt.show()
```

Published at DZone with permission of John Cook , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

## {{ parent.title || parent.header.title}}

## {{ parent.tldr }}

## {{ parent.linkDescription }}

{{ parent.urlSource.name }}