Increasing orthogonal functions

The answer is TWO. (The proof below is just an easy adaption of somebody else’s answer to a related question, here on MO).

Lemma Let $f^{\star}$ and $g^{\star}$ be two nonzero, nondecreasing functions in $L^1([0,1])$, with $\int_{[0,1]}f^{\star}=\int_{[0,1]}g^{\star}=0$. Then $\int_{[0,1]}f^{\star}g^{\star} \gt 0$.

Proof of lemma There is an $a_1\in [0,1]$ such that $f^{\star}(x)\leq 0$ when $x \lt a_1$ and $f^{\star}(x) \geq 0$ when $x\gt a_1$. Similarly, there is an $a_2\in [0,1]$ such that $g^{\star}(x)\leq 0$ when $x \lt a_2$ and $g^{\star}(x) \geq 0$ when $x\gt a_2$. By symmetry, we may assume $a_1 \leq a_2$.

Then $0=\int_{0}^{a_2}f^{\star}(x)dx+\int_{a_2}^{1}f^{\star}(x)dx$, so $\int_{0}^{a_2}f^{ \star}(x)dx \leq 0$. We deduce

$$ \int_{0}^{a_1} |f^{\star}(x)|dx \geq \int_{a_1}^{a_2} |f^{\star}(x)|dx $$

and hence

$$ \int_{0}^{a_1} f^{\star}(x)g^{\star}(x)dx= \int_{0}^{a_1} |f^{\star}(x)||g^{\star}(x)|dx \geq \int_{0}^{a_1} |f^{\star}(x)||g^{\star}(a_1)|dx \geq \int_{a_1}^{a_2} |f^{\star}(x)||g^{\star}(a_1)|dx =\int_{a_1}^{a_2} |f^{\star}(x)||g^{\star}(x)|dx= -\int_{a_1}^{a_2} f^{\star}(x)g^{\star}(x) dx $$

So the integral $\int_{0}^{a_2} f^{\star}(x)g^{\star}(x)dx$ is nonnegative ; on the other hand, $f^{\star}g^{\star}$ is nonnegative on $[a_2,1]$. So $\int_{[0,1]}f^{\star}g^{\star} \geq 0$, and if this inequality is in fact an equality then $|f^{\star}g^{\star}|$ must be zero a.e. on $[0,1]$. In particular, there is a sequence $(x_n)$ tending to $1$ such that $f^{\star}(x_n)g^{\star}(x_n)=0$ for all $n$. By the pigeon-hole principle, there must be infinitely many $n$ such that $u(x_n)=0$, where $u$ is one of $f^{\star}$ or $g^{\star}$. Then $u \leq 0$, but this contradicts the fact that $u$ is nonzero with integral zero. The lemma is proved.

Corollary : Let $f$ and $g$ be two orthogonal, nonzero, nondecreasing functions in $L^1([0,1])$. Then $0 \gt \int_{[0,1]}f \int_{[0,1]}g$ : the integrals of $f$ and $g$ must have different signs.

Proof of corollary : use the above lemma with

$$ f^{\star}=f-\int_{[0,1]}f, \ g^{\star}=g-\int_{[0,1]}g $$