Show rigorously that the sum of integrals of $f$ and of its inverse is $bf(b)-af(a)$

Let $\{x_0,x_1,\dots,x_N\}$ be a partition of $[a,b]$. Then $\{f(x_0),f(x_1),\dots,f(x_N)\}$ is a partition of $[f(a),f(b)]$. The following equality holds: $$ \sum_{i=0}^{N-1}f(x_i)(x_{i+1}-x_i)+\sum_{i=0}^{N-1}x_i(f(x_{i+1})-f(x_i))+\sum_{i=0}^{N-1}(x_{i+1}-x_i)(f(x_{i+1})-f(x_i))=b\,f(b)-a\,f(a). $$ The first two sums are Riemann sums for $\int_a^bf$ and $\int_{f(a)}^{f(b)}f^{-1}$ respectively. The third sum converges to $0$ as the size of the partition goes to $0$.


I think it is very natural from a geometrical point of view. It's just about the addition of two areas, which make up a big rectangle substracting a small one. See the graph below:enter image description here


Now, obviously, in the case shown in my graph $$S_1=\int_{a}^{b}f(x)dx$$ and $$S_2=\int_{f(a)}^{f(b)} f^{-1}(x)dx$$ Geometrically, we have $$S_1+S_2=S_{big}-S_{small}$$ where $S_{big}$ and $S_{small}$ respectively denotes the area of the big rectangle and the small one in the graph. Therefore $$\int_{a}^{b}f(x)dx+\int_{f(a)}^{f(b)} f^{-1}(x)dx=bf(b)-af(a)$$


Let $C$ be the graph of $y = f(x)$ over the interval $[a,b]$. Then $\int_a^b f(x)\, dx$ is the line integral $\int_C y\, dx$, and $\int_{f(a)}^{f(b)} f^{-1}(y)\, dy$ is the line integral $\int_C x\, dy$. Thus $$\int_a^b f(x)\, dx + \int_{f(a)}^{f(b)} f^{-1}(y)\, dy = \int_C x\, dy + y\, dx = \int_C d(xy) = bf(b) - af(a).$$