Reflection across a line?
The linear transformation matrix for a reflection across the line $y = mx$ is:
$$\frac{1}{1 + m^2}\begin{pmatrix}1-m^2&2m\\2m&m^2-1\end{pmatrix} $$
My professor gave us the formula above with no explanation why it works. I am completely new to linear algebra so I have absolutely no idea how to go about deriving the formula. Could someone explain to me how the formula is derived? Thanks
Solution 1:
You can have (far) more elegant derivations of the matrix when you have some theory available. The low-tech way using barely more than matrix multiplication would be:
The line $y = mx$ is parametrised by $t \cdot \begin{pmatrix}1\\m\end{pmatrix}$. The line orthogonal to it is parametrised by $r \cdot \begin{pmatrix}-m\\1\end{pmatrix}$. The line $y = mx$ shall be fixed, the line orthogonal to it shall be reflected, so you want a matrix $R$ with
$$R \begin{pmatrix}1 & -m\\ m & 1\end{pmatrix} = \begin{pmatrix}1 & m\\ m & -1\end{pmatrix},$$
and that means
$$\begin{align} R &= \begin{pmatrix}1 & m\\m&-1\end{pmatrix} \begin{pmatrix}1&-m\\m&1\end{pmatrix}^{-1}\\ & = \begin{pmatrix}1&m\\m&-1\end{pmatrix}\cdot \frac{1}{1+m^2}\begin{pmatrix}1&m\\-m&1\end{pmatrix}\\ &= \frac{1}{1+m^2} \begin{pmatrix}1 - m^2 & 2m\\2m &m^2-1\end{pmatrix}. \end{align}$$
Solution 2:
Another way. To reflect along a line that forms an angle $\theta$ with the horizontal axis is equivalent to:
- rotate an angle $-\theta$ (to make the line horizontal)
- invert the $y$ coordinate
- rotate $\theta$ back.
Further, $y=mx$ implies $\tan \theta = m$, and $1+m^2 = \frac{1}{\cos^2\theta}$ .
Then, assumming you know about rotation matrices, you can write
$$\begin{align}T&=\begin{pmatrix}\cos \theta & -\sin \theta\\ \sin \theta & \cos \theta\end{pmatrix} \begin{pmatrix}1&0\\ 0 & -1\end{pmatrix} \begin{pmatrix}\cos \theta & \sin \theta\\ -\sin \theta & \cos \theta\end{pmatrix} \\ &= \begin{pmatrix}\cos \theta & -\sin \theta\\ \sin \theta & \cos \theta\end{pmatrix} \begin{pmatrix}\cos \theta & \sin \theta\\ \sin \theta & -\cos \theta\end{pmatrix} \\ &= \cos^2 \theta \begin{pmatrix}1 & -\tan \theta\\ \tan \theta & 1\end{pmatrix} \begin{pmatrix}1 & \tan \theta\\ \tan\theta & -1\end{pmatrix} \\ &= \frac{1}{1 + m^2} \begin{pmatrix}1 & -m\\ m & 1\end{pmatrix} \begin{pmatrix}1 & m\\ m & -1\end{pmatrix} \\ &=\frac{1}{1 + m^2}\begin{pmatrix}1-m^2&2m\\2m&m^2-1\end{pmatrix}\end{align}$$