If $a\le f(x)\le b<0$, why $\int_0^t f(x) g(x) dx +\int_t^T f(x) g(x) dx\le a\int_0^t g(x) dx +b\int_t^T g(x) dx$? Let $T>0$ be fixed $f, g$ be continuous real valued functions such that
$$a\le f(x)\le b<0\quad\text{ and }\quad \int_0^t g(x) dx >0, \quad \int_t^T g(x) dx <0$$
for some constants $a, b\in\mathbb{R}^*$ and a fixed $t\in [0, T]$.
Could someone please help me in justifying the inequality
$$\int_0^t f(x) g(x) dx +\int_t^T f(x) g(x) dx\le a\int_0^t g(x) dx +b\int_t^T g(x) dx?$$
Thank you in advance.
 A: I am not sure if this statement is true:
Let $t=T=9$ such that the inequality becomes $\int_0^9 f(x)g(x)\mathrm{d}x\leq a\int_0^9g(x)\mathrm{d}x$.
Let $$g(x)=\begin{cases}8&t\leq1\\-1&t\geq1+\varepsilon\end{cases}$$ and $$f(x) = \begin{cases}-1&t\leq1\\-2&t\geq1+\varepsilon\end{cases}$$ where the part with $t\in(1,1+\varepsilon)$ is filled such that the functions are nicely continuous.
Then (ignoring the part $t\in(1,1+\varepsilon)$ for the moment) we have $$\int_0^9f(x)g(x)\mathrm{d}x\approx\int_0^1-8\mathrm{d}x+\int_{1+\varepsilon}^92\mathrm{d}x\approx-8+16=8\gg0$$ and $$a\int_0^9g(x)\mathrm{d}x=-2\left(\int_0^18\mathrm{d}x+\int_{1+\varepsilon}^9-1\mathrm{d}x\right)\approx-2\varepsilon\approx0$$
So we see $\int_0^9f(x)g(x)\mathrm{d}x\gg0\approx a\int_0^9g(x)\mathrm{d}x$, contradicting your statement
A: this is clearly wrong, because a can be a huge minus number and it would make the right part of equation a huge minus.
I'm gonna assume that you made a typo in the right side of inequation and you meant this because I've seen this before:
$$b\int_0^t g(x) dx + a\int_t^T g(x) dx$$
but this is also wrong :D,
here is the counterexample:
$T = 4, t = 2, a = -10, b = -1$
$ g(x) = 1.1, f(x) = -9$ for $x$ in $(0,1)$,
$g(x) = -1, f(x) = -2$ for $x$ in $(1,2)$,
$g(x) = -1.1, f(x) = -9$ for $x$ in $(2,3)$,
$g(x) = 1, f(x) = -2$ for $x$ in $(3,4)$
for simplicity you can compute on this simplified version of you inequation:
$$\int_t^T (f(x)-a)g(x) dx \le \int_0^t (b-f(x))g(x) dx$$
