The sum of integrals of a function and its inverse: $\int_{0}^{a}f+\int_{0}^{f(a)}f^{-1}=af(a)$

Regarding real numbers, the following appears to be true, or at least true with some modifications. Could you help me for the proof? $$\int_0^af(x)dx+\int_{f(0)}^{f(a)}f^{-1}(x)dx=af(a)$$

Solutions Collecting From Web of "The sum of integrals of a function and its inverse: $\int_{0}^{a}f+\int_{0}^{f(a)}f^{-1}=af(a)$"

Geometrically, this equality represents:

The area of the rectangle with side lengths $a\times f(a)$ is equal to the sum of the area below the graph of $f(x),\,x\in[0,a]$ and the area above the graph of $f(x)$, which completes the rectangle. The later area is in fact the area below the inverse of $f$ in the interval $[0,f(a)]$.

Addition: The minimal requirements on the function $f$ are to be continuous and injective (differentiability is not needed),
so that $f^{-1}$ makes sense. The condition of continuity is necessary,
because otherwise it might happen that the range of $f$ is a strict subset of $[f(0),f(a)]$
and that $f^{-1}$ is not defined on a whole subinterval of $[f(0),f(a)]$ and so the integral $\int\limits_{f(0)}^{f(a)}{f^{-1}(y)dy}$ would not make sense. Now, because $f$ is continuous and a bijection from $[0,a]$ to $[f(0),f(a)]$ it follows that $f$ is strictly monotone.

Case 1 ($f$ is increasing) (look at the picture of Nikolaos Skout):

For each point $M(x_M,y_M)$ in the rectangle $a\times f(a)$ we have that either $y_M>f(x_M)$ ($M$ is above the graph of $f$, i.e $M\in B$) or $y_M\leq f(x_M)$ ($M$ is below the graph of $f$, i.e $M\in A$). Therefore $A\cap B=\emptyset$ and $A\cup B=$ the rectangle $\{a\times f(a)\}$ $\quad\quad(*)$.

Also we have that according to the Rieman integral ($f$ and $f^{-1}$ are integrable as continuous functions defined on fintie intervals) that $\mu(A)=\int\limits_{0}^{a}{f(x)dx}$ and $\mu(B)=\int\limits_{f(0)}^{f(a)}{f^{-1}(y)dy}$, where $\mu$ denotes area. Now according to $(*)$ it follows that $\mu(\{a\times f(a)\})=\mu(A)+\mu(B)$.

Case 2 ($f$ is decreasing) is done analogously, having in mind that $\int\limits_{f(0)}^{f(a)}{f^{-1}(y)dy}$ is a negative value, because $f(0)>f(a)$.

We assume $f$ has an inverse over the interval $(0,a)$ and both $f$ and $f^{-1}$ are smooth. Letting $x = f^{-1}(y) \iff y = f(x)$, by substitution we have

$$\int_{f(0)}^{f(a)} f^{-1}(y) \, dy = \int_0^a x f'(x) dx$$

Using integration by parts, we have
$$\int_0^a x f'(x) dx = \int_0^a x df(x) = xf(x) \Big\vert_{x=0}^{x=a} – \int_0^a f(x) dx = af(a) – \int_0^a f(x) dx $$

enter image description here A geometric approach is as follows: the integral
$\displaystyle \int_{0}^{a}f(x)dx$ is represented by the region A and the
$\displaystyle \int_{f(0)}^{f(a)}f^{-1}(x)dx$ is represented by
the region B. Of course the sum of the areas of the above regions equals the whole area, that is af(a), as desired.

Hint: (Assuming $f$ is differentiable). Differentiate the function $g$ defined by
$$
g(a) = \int_0^a f + \int_{f(0)}^{f(a)} f^{-1} – af(a)
$$
(which is indeed differentiable as $f$ is).

In detail (place your mouse over the gray area to reveal its contents)

$$g^\prime(a) = f(a) + f^\prime(a)\cdot f^{-1}(f(a)) – (af^\prime(a) + f(a)) = f(a) + af^\prime(a) – af^\prime(a) – f(a) = 0$$ using the chain rule to derive the second term. To conclude, observe that $g(0)=0$.