# Prove that $f(x)$ has at least two real roots in $(0,\pi)$

Let $f$ be a continuous function defined on $[0,\pi]$. Suppose that

$$\int_{0}^{\pi}f(x)\sin {x} dx=0, \int_{0}^{\pi}f(x)\cos {x} dx=0$$

Prove that $f(x)$ has at least two real roots in $(0,\pi)$

• I have the feeling that the Fourier expansion $f(x) = a_0 + \sum_{n\geq 1} (a_n \sin 2n x + b_n \cos 2n x)$ might help, but can't see how exactly. Nov 29, 2012 at 17:20
• @LiorB-S Since $f$ is "just@ continuous you can't be sure that Fourier series of $f$ converges to $f$. Nov 29, 2012 at 17:27
• @Norbert: You are right, but I have no proof for smooth $f$'s either. Moreover it would be nice, I think, to have if a proof using Fourier expansion exists... Nov 29, 2012 at 17:32
• It's worth remarking that the function $f(x)=\sin(3x)$ satisfies the conditions and has exactly 2 roots in $(0,\pi)$, so 2 is the best possible integer in this problem. Nov 29, 2012 at 21:04

Here is one root: Let $F(x) = \int_{0}^x f(t) \sin t dt$. Then $F(0)=0$ and $F(\pi)=\int_{0}^\pi f(t)\sin tdt=0$. So by the intermediate value theorem, there exists $0<c<\pi$ such that $$0=F'(c) = f(c)\sin c.$$
But since $\sin c\neq 0$, we get that $f(c)=0$.

If f has only one real root on $(0,\pi)$, say $a \in (0,\pi)$, then define $g(x) = f(x) \sin(x-a) = f(x) (\sin(x)\cos(a) - \cos(x)\sin(a))$, then $g(x)$ is either non-positive or non-negative, not identically zero, and has integral $0$. Contradiction.

• Why is $g(x)$ either non-positive or non-negative? Nov 29, 2012 at 19:32
• @Lev - I think you assume that $f$ changes sign at its root, which doesn't necessarily happen (the function could be tangent to the $x$-axis). However, if $f$ doesn't change sign and is not identically zero, the integral $\int_0^\pi f(x) \sin(x)dx$ would be strictly positive (or strictly negative, if you take $f\leq 0$). This is again a contradiction. Nov 29, 2012 at 19:53
• @TonyK: Note that $\sin (x-a)>0$ for $a<x<\pi$ and $\sin(x-a) <0$ for $0<x<a$. Nov 29, 2012 at 19:57
• Yes, OK -- if $f$ doesn't change sign at $a$, then the $\sin$ integral can't be zero. So $f$ does change sign at $a$, and therefore $f(x)\sin(x-a)$ doesn't. Nov 29, 2012 at 20:01
• @James Fennell: thank you, I missed the case when f does not change sign.
– Lev
Nov 29, 2012 at 20:36

Since another question has been closed and linked to here, I figure it would be good to make sure there's an answer here that compiles everything nicely.

First, we show that $$f$$ has at least one root, as in Lior B-S's answer.

Let $$F(x) = \int_{0}^x f(t) \sin(t)\, dt$$. Then $$F(0)=0$$, and by hypothesis $$F(\pi)=0$$ too. It follows from the intermediate value theorem that there is some $$c \in (0,\pi)$$ with

$$0=F'(c) = f(c)\sin c.$$

Because $$\sin$$ has no zeroes in $$(0,\pi)$$, we obtain that $$f(c)=0$$.

We now show that $$f$$ must have more than one root, by contradiction. This is in line with Lev's answer and the addtitional explanantions in the comments under it.

Suppose that $$f$$ has the single root at $$c$$; there are two possibilities:

• $$f$$ does not change signs at the root $$c$$.

In this case, because the sine also does not change signs on $$(0,\pi)$$, we'd have that $$f(x)\sin(x)$$ does not change signs on $$(0,\pi)$$. This implies that for $$x\in(0,\pi)$$, $$f(x)\sin(x) = 0$$ only at $$x=c$$, and it has the same sign everywhere else, in contradiction with $$\int_0^\pi f(t)\sin(t)\,dt =0$$.

• $$f$$ changes signs at the root $$c$$.

In this case, consider

$$g(x) = f(x)\cdot \sin(x-c) = f(x) \Big(\sin(x)\cos(c) - \cos(x)\sin(c)\Big).$$

Notice that

$$\int_0^\pi g(t)\,dt = \cos(c)\underbrace{\int_0^\pi f(t)\sin(t)\,dt}_0 - \sin(c)\underbrace{\int_0^\pi f(t)\cos(t)\,dt}_0 = 0.$$

However, $$\sin(x-c)$$ changes sign exactly once for $$x\in(0,\pi)$$, on $$x=c$$. This implies that for $$x\in(0,\pi)$$, $$g(x) = 0$$ only at $$x=c$$, and it has the same sign everywhere else, in contradiction with $$\int_0^\pi g(t)\,dt =0$$.

Regardless of the situation, we see that the assumption that $$f$$ has a single root at $$c$$ leads to a contradiction, so we conclude that $$f$$ must have more than one root, as desired.

Moreover, as per James Fennell's comment under the question, $$f(x)=\sin(3x)$$ satisfies the conditions in the statement and has exactly $$2$$ roots in $$(0,\pi)$$, so 'at least two roots in $$(0,\pi)$$' is tight.

This is a problem of complex calculus.

The linear combination of both given integral can be used to represent a path. The function $$f$$ can be rewritten with the path inside. This is possible because $$f$$ depends on one real variable.

The path can be interpreted as the upper half circle above the real axis in the complex plane.

Look at for example: Line integral.

Now just given the pair of identies allows us the combine with $$i$$ and $$-i$$. The path can be run clockwise and counterclockwise.

If $$F$$ is the function $$f$$ on the complex path over the upper half of the unit circle. With $$F$$ is the $$\overline F$$ a solution. This gives without the complexes the existence of two solutions for $$f$$.

The steadiness of $$f$$ is needed to the exitence of the integrals. This does not follow from the identities. A function that is steady has an integral. Functions that are steady have integrals multiplied with transcendent functions. These are in the class of steady functions too. This attribut hat to be given in the interval $$[0,\pi]$$.

If the identities were not given alone the solution will not be double.

I am the opinion it is better practice to be more precise on the question regarding for $$x$$. The question is hard because it has not contexts. There is reason to mark this duplicate. Now that a correct answer/proof is given the situation changes.

• You can flag a question as “low quality” or “duplicate” if you find that appropriate, but that does not belong in an answer. – Regarding your answer: What is a “steady” function? Do you mean “continuous”? Generally that all is quite vague. Can you demonstrate more concretely how you conclude that $f$ has at least two distinct zeros? Feb 28, 2021 at 17:13

This statement is not true. Actually, we should prove that $$\int_0^\pi f(x)[\cos x-\sin x]dx=0$$Now, define $$f(x)=\begin{cases}a\left(e-e^{4x\over \pi}\right)+1&,\quad 0\le x\le {\pi\over 4}\\1&,\quad {\pi\over 4}where $$a\ge 0$$. It is clear that $$f(x)\ge 1$$ over $$[0,\pi]$$ for all $$a\ge 0$$ hence it has no root. However, by defining $$I=\int_0^\pi f(x)[\cos x-\sin x]dx$$we immediately conclude that $$I=-2<0$$ for $$a=0$$ and $$\lim_{a\to \infty } I=\infty$$. Based on intermediate value theorem and since $$I$$ is continuous w.r.t. $$a$$, there is a value for $$a$$ for which $$I=0$$, hence the statement is not true.

Here is a sketch of the two functions using Python:

• You have found an example where $\int_{0}^{\pi}f(x)\sin {x} dx= \int_{0}^{\pi}f(x)\cos {x} dx$, but not necessarilty $\int_{0}^{\pi}f(x)\sin {x} dx = \int_{0}^{\pi}f(x)\cos {x} dx=0$. So this is not a counterexample. Feb 12, 2021 at 12:05