TITLE: Extension of a continuous function so that the integral does not change
QUESTION [6 upvotes]: Suppose $f : [a,b] \to \mathbb{R}$ is a continuous function. Can another continuous function $g : [a,c] \to \mathbb{R}$ be defined such that $\int_a^b f(x)dx =\int_a^c g(x)dx$ so that $f(x) = g(x), x\in[a,b]$ and $c>b$
(Note: if $g \geq 0$ on $[b,c]$ this will not be possible but this restriction
is not imposed on the above.)

REPLY [11 votes]: Define the new function $g$ as follows: $ g(x)=f(x)$ $\forall x \in [a,b] $ and $g(x)= \frac{2f(b)(x-c)}{b-c} -f(b)$ on $(b,c]$. The last part just represents a linear function whose integral on $[b,c]$ is zero. So, it satisfies the required criteria.

REPLY [7 votes]: Yes, it is not so bad. In particular, suppose $f(b) = g(b) = K$. Then let $g(c) = -K$, and let $g$ be linear between $b$ and $c$. Then it integrates to zero and agrees with $f$ on the interval.