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

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}$$
