Is there an explanation why the reflection of $f(x)$ through y = x is its inverse?

Solution 1:

Yes, but it is the graph of the function that is reflected, not the function itself.

The graph of a function $f$ is the set of all pairs $(x,y)$ with $y=f(x)$. If $f$ has an inverse function $g$, then $y=f(x)$ is equivalent to $x=g(y)$, so when $(x,y)$ belongs to the graph of $f$, then $(y,x)$ belongs to the graph of $g$ and vice versa.

Interchanging $x$ and $y$ in the pair $(x,y)$, that is replacing it by $(y,x)$, can be described as reflection throught the diagonal. And that explains the phenomenon in general.

Solution 2:

Suppose that $D(a,b)$ is a point on the graph of a one-to-one function defined by $y=f(x)$. Then $b=f(a)$ This means that $a=f^{-1}(b)$, so $D_{1}(b,a)$ is a point on the graph of the inverse function $f^{-1}$. Now, two points are said to be symmetric with respect to any line if the line is perpendicular to the segment that links both points in its midpoint.

Therefore, the demonstration reduces to prove that $y=x$ is perpendicular to the segment $DD_{1}$ in its midpoint $M$. The midpoint of $DD_{1}$ is $M$($\frac{a+b}{2}$,$\frac{a+b}{2}$), which also belongs to $y=x$. Then the line $y=x$ intersects the segment $DD_1$ at its midpoint $M$. Now, two nonvertical lines are perpendicular if and only if the product of their slopes is $-1$.The slope $m$ of $y=x$ is $m=1$. The slope $m_1$ of the line $DD_1$ is $m_1=\frac{b-a}{a-b}=\frac{-(a-b)}{a-b}=-1$. It follows that the line $y=x$ is perpendicular to the segment $DD_1$in its midpoint $M$.

Q.E.D.