<s>[INST] 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
 [/INST] 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}$$
</s>