๐Ÿงฎ Brain Teaser

The Continuous Function That Must Change Sign

Let f:[0,1]โ†’Rf : [0,1] \to \mathbb{R} be continuous, with โˆซ01f(x)โ€‰dx=0andโˆซ01xf(x)โ€‰dx=0.\int_0^1 f(x)\, dx = 0 \quad \text{and} \quad \int_0^1 x f(x)\, dx = 0.

Must ff have at least two sign changes on (0,1)(0,1)? (A "sign change" means a point where ff transitions from strictly positive to strictly negative or vice versa.)

Prove your answer.

orthogonalitysign changesintegrationcontinuous functionsinner product

Answer: The Continuous Function That Must Change Sign

Key Idea / Intuition

The two integral conditions say that ff is orthogonal to both the constant function 11 and to xx. If ff had at most one sign change, it would look roughly like a single-signed bump or a function that crosses zero once โ€” and you can show that any such function cannot be simultaneously orthogonal to both 11 and xx unless it is identically zero. The trick is to construct a witness: a linear function โ„“(x)=a+bx\ell(x) = a + bx that has the same sign pattern as ff, making โˆซ01fโ‹…โ„“โ€‰dx\int_0^1 f \cdot \ell \, dx forced to be positive โ€” but the two conditions say this integral is exactly zero, giving a contradiction.


Formal Proof / Solution

Claim: Yes, ff must have at least two sign changes (provided fโ‰กฬธ0f \not\equiv 0).

Proof by contradiction. Suppose ff is continuous, not identically zero, satisfies both integral conditions, but has at most one sign change on (0,1)(0,1).

Case 1: ff has no sign change.

Then ff is either โ‰ฅ0\geq 0 or โ‰ค0\leq 0 on all of [0,1][0,1] (with at least one point of strict sign, since fโ‰กฬธ0f\not\equiv 0). But then โˆซ01f(x)โ€‰dxโ‰ 0\int_0^1 f(x)\,dx \neq 0, contradicting the first condition. โœ—

Case 2: ff has exactly one sign change at cโˆˆ(0,1)c \in (0,1).

Without loss of generality, suppose f(x)>0f(x) > 0 on (0,c)(0,c) and f(x)<0f(x) < 0 on (c,1)(c,1) (the other case is symmetric).

Now choose the linear function โ„“(x)=xโˆ’c.\ell(x) = x - c.

Note โ„“(x)=xโˆ’c\ell(x) = x - c satisfies:

  • โ„“(x)<0\ell(x) < 0 for xโˆˆ(0,c)x \in (0, c),
  • โ„“(x)>0\ell(x) > 0 for xโˆˆ(c,1)x \in (c, 1).

This is the opposite sign pattern to ff. Therefore f(x)โ‹…โ„“(x)โ‰ค0f(x)\cdot \ell(x) \leq 0 everywhere on [0,1][0,1], and f(x)โ‹…โ„“(x)<0f(x)\cdot\ell(x) < 0 on a set of positive measure. Hence: โˆซ01f(x)โ„“(x)โ€‰dx<0.\int_0^1 f(x)\ell(x)\,dx < 0.

But expanding using linearity: โˆซ01f(x)โ„“(x)โ€‰dx=โˆซ01f(x)(xโˆ’c)โ€‰dx=โˆซ01xf(x)โ€‰dxโˆ’cโˆซ01f(x)โ€‰dx=0โˆ’cโ‹…0=0.\int_0^1 f(x)\ell(x)\,dx = \int_0^1 f(x)(x - c)\,dx = \int_0^1 xf(x)\,dx - c\int_0^1 f(x)\,dx = 0 - c\cdot 0 = 0.

This is a contradiction: the integral must be strictly negative, but we computed it equals 00.

Conclusion

In both cases we reach a contradiction. Therefore ff must have at least two sign changes on (0,1)(0,1). โ– \blacksquare


Remark (geometric picture): The two conditions โˆซf=0\int f = 0 and โˆซxf=0\int xf = 0 say ff is orthogonal to all linear polynomials in L2([0,1])L^2([0,1]). By the general principle, orthogonality to polynomials of degree โ‰คnโˆ’1\leq n-1 forces at least nn sign changes โ€” this is a soft version of the Chebyshev equioscillation / Descartes' rule philosophy. Here n=2n=2 (orthogonal to {1,x}\{1, x\}), forcing โ‰ฅ2\geq 2 sign changes.