A Function $g(x)$, Written in Terms of $f(x)$, That Flips Sign when a Root of $f(x)$ is Encountered

calculusfunctionsnumber theory

Let $f(x)$ be any continuous, differentiable function that has extrema and that $f(x) \geq 0$ for all $x$ and has a finite amount of roots (it is not always a polynomial). Let $g(x)$ be a function (written in terms of $f(x)$) that flips sign only when a root of $f(x)$ is encountered. For example, let's say that $f(x)$ has roots at $2,3,7,11$. That means if from $0$ to $2$, $g(x)$ is positive, from $2$ to $3$, $g(x)$ should be negative. From $3$ to $7$ it should be positive and from $7$ to $11$ it should be negative. $g(x)$ should be written in terms of $f(x)$; therefore $g(x)$ should be a general equation. You should not need to know the roots of $f(x)$ in order to construct $f(x)$. $g(x)$ does not have to be continuous nor differentiable. Hopefully, $g(x)$ is closed form (ie. no $\sum$ or $\prod$). What is one definition of $g(x)$? Or is such a function possible to construct?

In any answer, please use $f(x)=\sin^2(\frac{33}{x}\pi)+sin^2(x \pi)$ as the example function.

Background: I was thinking about this problem because I wanted to know if it was possible to find roots numerically for functions that are all positive and have other extrema other than the roots (so something like f(x)/f'(x) wouldn't work). Newton's, fixed point, and so on are only valuable if you start near the root, and even then, with a function like the example, it's not guaranteed to work. Bisection is the only one guaranteed to work, but I need to get the equations in a form so that can work.

EDIT: After giving it some thought, I'm thinking that such $g(x)$, if possible, will probably include sine, cosine, and/or tangent in some way, but I'm not sure how. I was hoping someone could help me.

Best Answer

From context clues it seems like you are looking for an algorithm that can compute $g(x)$ from $f(x)$ without first having to compute the roots of $f(x)$, since that would defeat the purpose (as you would like to use $g(x)$ as a step in determining the roots of $f(x)$ numerically). I am not optimistic that you will find such an algorithm, simply for the reason that it seems no easier to find such a $g(x)$ than it is to find the roots using standard numerical techniques.

However, there are still interesting things to say here. First let me point out that in the case of a polynomial, we would necessarily have $$ f(x)=\prod_{i} (x-r_i)^{2n_i} $$ for some integers $n_i$ (up to multiplication by an overall constant), and then the most natural choice of polynomial satisfying your conditions would be $$ g(x)=\prod_{i} (x-r_i). $$ The two polynomials $f(x)$ and $g(x)$ bear the same relation as do the characteristic polynomial and the minimal polynomial of a matrix in linear algebra. There are computational approaches for computing the minimal polynomial of a matrix, which could be used in this problem: starting from the original polynomial $f(x)$, you can put the coefficients (no knowledge of the roots required!) into a so-called companion matrix (whose characteristic polynomial is automatically equal to $f(x)$) and then use the mentioned computational approach to calculate the minimal polynomial of the companion matrix, which will equal $g(x)$. (No claims for efficiency here...) This type of method could be made to apply to non-polynomials by using an approximation scheme.

To address your specific example $$ f(x)=\sin^2\left(\frac{33}{x}\pi\right)+\sin^2(x \pi), $$ let me start by pointing out the obvious, which is that $f(x)=0$ if and only if both of the two terms are equal to zero. The second term is zero precisely when $x\in\mathbb Z$, and the first term is zero precisely when $33/x\in\mathbb Z$. Thus the roots occur when $$ x=-33,-11,-3,-1,1,3,11,33. $$ If you heuristically apply a method similar to what I suggested above for polynomials, you would end up with $$ g(x)=(x^2-33^2)(x^2-11^2)(x^2-3^2)(x^2-1^2), $$ which can be compared with the expressions you get from heuristically manipulating Euler's infinite product