Let a linear transformation in $\mathbb R^2$ be the reflection in the line $x_1=x_2$. Find its matrix.

Solution: Let us think $x_1=x$ and $x_2=y$. In the $(x,y)$-coordinate plane, the graph of the inverse function of a function $f(x)$ is obtained by reflecting the graph of $f(x)$ in the line $y=x$. Also note the the inverse function interchanges $x$ and $y$.

Denote the linear transformation in $\mathbb R^2$ corresponding to the reflection in the line $x_1=x_2$ by $T$. With the above observation, we see that $$T(x_1,x_2)^T=(x_2,x_1)^T.$$Therefore, we have $$T\begin{pmatrix}x_1\\ x_2\end{pmatrix}=x_1\begin{pmatrix}0\\ 1\end{pmatrix}+x_2\begin{pmatrix}1\\ 0\end{pmatrix}.$$Hence the matrix is given by $\begin{pmatrix}0 & 1\\ 1 & 0\end{pmatrix}$.