# Integrating the modulus of the difference of two functions

This question caught my eye from "How to integrate it" by Sean M. Stewart. I have attempted it for fun and am now stuck.

Question

Let $f$ and $g$ be continuous bounded functions on some interval $[a,b]$ such that $\int_a^b|f(x)-g(x)|dx=0$. Show that $\int_a^b|f(x)-g(x)|^2dx=0$.

Attempt

Note: $0\le |\int_a^bf(x)-g(x)dx |\le\int_a^b|f(x)-g(x)|dx=0$

We conclude $|\int_a^bf(x)-g(x)dx |=0$

Multiply both sides by $|\int_a^bf(x)-g(x)dx |$ giving $|\int_a^bf(x)-g(x)dx |^2=0$

This is where I'm stuck. Specifically how do I get both the square and the modulus back past the pesky $\int dx$

Possibly $|\left(\int_a^bf(x)-g(x)dx\right)^2|=0$ leading to $0=|\left(\int_a^bf(x)-g(x)dx\right)^2|\le?$

I feel I'm missing something with obvious with modulus but it is escaping me. Of course I could be on the wrong track altogether.

Side question: the afore mention book only has solutions to selected problems so if anyone knew of a full solution set somewhere that'd greatly help.

update

I now realise I had discarded $f(x)=g(x)$ because I thinking was thinking (incorrectly) of $\int_a^b f(x)-g(x)dx=0$ whereby I imagined a situation such as $f(x)=-x$ and $g(x)=x$ over an interval such as $[-1,1]$ I have accepted the answer that includes the case for discontinuous functions but appreciate all other efforts.

• If the integral is zero, then doesn't that mean $f(x)=g(x)$? Apr 6, 2018 at 11:30
• Thank you see update to question for my error.
– Karl
Apr 6, 2018 at 11:51

Are you sure that the condition is for $f$ and $g$ to be continuous? In that case, if $f$ and $g$ differ at one point $x_0$, then $f-g$ has the same sign and $|f-g| > \epsilon > 0$ in some small interval around $x_0$, so the integral can't be zero. In other words, under that condition we get the much better result that $f=g$ in $[a,b]$.

Not assuming contiuity, we get have that $|f| < M$ and $|g| < N$ for some constants $M,N$ (in $[a,b]$), so we have $|f-g| < M+N$ in that interval. This leads to $\int_a^b |f(x)-g(x)|^2dx = \int_a^b |f(x)-g(x)| \times |f(x)-g(x)|dx \le \int_a^b |f(x)-g(x)|(M+N)dx = (M+N)\int_a^b |f(x)-g(x)|dx = 0.$

• Thank you see update to question for my error.
– Karl
Apr 6, 2018 at 11:51

Replace $f- g$ with $h$. It suffices to show that $$\int_a^b |h|=0 \implies \int_a^b |h|^2=0 \quad \forall\, h \in C([a,b])$$ As @KingTut points out, this follows trivially from $$\forall\, h \in C([a,b]), \int_a^b |h|=0 \implies h \equiv 0.$$ Its contrapositive form has a straightforward proof: let $h(x_0) \ne 0$ at some point $x_0 \in [a,b]$. There exists $\delta > 0$ such that $|h|$ is positive in the $\delta$-neighbourhood of $x_0$. $$\text{i.e.} \forall\, x \in [a,b] \cap (x_0-\delta, x_0+\delta), |h(x)| > 0$$ $$\therefore \int_a^b h \ge \int_{[a,b] \cap (x_0-\delta, x_0+\delta)} |h| > 0$$

In fact, you can replace "continuous" with "measurable". The given condition shows that $f = g$ a.e. in $[a,b]$, so $|f-g|^2 = 0$ a.e. in $[a,b]$.

(Addded in response to OP's edit)

In your example $\int_{-1}^1 (f-g) = \int_{-1}^1 (-2x) dx = 0$, but $\int_{-1}^1 (f-g) = \int_{-1}^1 |-2x| dx = 2 \int_0^1 |x| dx = 1 > 0$, so the condition $\int_a^b|f(x)-g(x)|dx=0$ is not satisfied. As a result, $\int_a^b|f(x)-g(x)|^2dx=\int_{-1}^1 |-2x|^2 dx=2\cdot\frac43 > 0$.

• Thank you see update to question for my error.
– Karl
Apr 6, 2018 at 11:51