# Equation of a line after being reflected in another line using the transformation matrix

For a specific case, consider the line $$y = 3x + 1$$. How can I find the equation of the new line when this is reflected in the line $$y = 2x$$ ? I would like to solve this using solely matrices and not considering angles of lines.

My attempt:

The general matrix transformation for a reflection in $$y = mx$$ is

$$\dfrac{1}{1+m^2}\begin{bmatrix} 1-m^2 & 2m \\ 2m & m^2-1 \end{bmatrix}$$ so when $$m = 2$$, $$\mathbf{T} = \dfrac{1}{5} \begin{bmatrix} -3 & 4 \\ 4 & 3 \end{bmatrix}$$

Using the vector equation of a line, $$y = 3x+1$$ can be written as

$$\mathbf{r} = \begin{bmatrix} 0\\ 1 \end{bmatrix} +\lambda \begin{bmatrix} 1\\ 3 \end{bmatrix} = \begin{bmatrix} \lambda \\ 3\lambda +1 \end{bmatrix}$$

Applying the transformation,

$$\mathbf{r}' = \mathbf{T} \ \mathbf{r} = \dfrac{1}{5}\begin{bmatrix} -3 & 4\\ 4 & 3 \end{bmatrix}\begin{bmatrix} \lambda \\ 3\lambda +1 \end{bmatrix} = \dfrac{1}{5}\begin{bmatrix} 9\lambda +4\\ 13\lambda +3 \end{bmatrix}$$

Converting back to Cartesian,

$$x = 9\lambda + 4 \rightarrow \lambda = \dfrac{x-4}{9}$$

$$y = 13 \left ( \dfrac{x-4}{9} \right ) + 3$$

$$9y = 13x-25$$.

However some graphing on Desmos shows this is not correct, and the right answer looks more like $$9y = 13x-5$$. Any help in finding where is my mistake is much appreciated.

• I confirm the answer $9y=13x-5$, obtained with pure geometry. – Bernard Aug 13 at 22:45
• It looks as though there are no errors in your calculations, as I just checked. – Kraig Aug 13 at 22:47
• You forgot the factor $\frac 15$ in your computations. – Bernard Aug 13 at 23:03
• @Bernard Ah thankyou very much! Please write this as an answer so I can tick it? :) – Nick_2440 Aug 13 at 23:08
• I proposed another, faster, way of calculating. – Bernard Aug 13 at 23:14

## 2 Answers

There is a much faster way to make the computations: remember that a reflection is its own inverse, so if $$\mathbf r'$$ has coordinates $$(x',y')$$, we have $$\mathbf r=T\mathbf r'\iff \begin{pmatrix}x\\y\end{pmatrix}=T\begin{pmatrix}x'\\y'\end{pmatrix}=\tfrac 15 \begin{pmatrix}-3x'+4y'\\4x'+3y'\end{pmatrix}$$ and plugging this relation in the equation of the line $$y=3x+1$$, we obtain \begin{align} \frac 15(4x'+3y')&=\frac 35(-3x'+4y')+1\iff 4x'+3y'=-9x'+12 y'+5\\&\iff13x'-5=9y'. \end{align}

• @amd: Yes, of course. For my excuse, it was late here when I wrote this answer. Thank you for pointing it! – Bernard Aug 14 at 8:52

Bernard has already noted in a comment where you made your mistake and given you an excellent answer to boot, but since you wrote that you wanted “to solve this using solely matrices,” I thought that I’d post a brief solution that does just that. It’s equivalent to Bernard’s solution, but presented differently.

Working in homogeneous coordinates, the line can be represented by a vector $$\mathbf l$$, so that an equation of the line is $$\mathbf l^T\mathbf x=0$$. If $$M$$ is the matrix of some invertible point transformation $$\mathbf x' = M\mathbf x$$, then we have $$\mathbf l^T\mathbf x = \mathbf l^T(M^{-1}\mathbf x') = (M^{-T}\mathbf l)^T\mathbf x'$$, so the line transforms as $$\mathbf l'=M^{-T}\mathbf l$$.

Now, every reflection is its own inverse, and the matrix of this reflection (after padding it out to make it suitable for use with homogeneous coordinates) is symmetric, so the image of the line is $$M^{-T}\mathbf l = M\mathbf l = \begin{bmatrix}-\frac35&\frac45&0\\\frac45&\frac35&0\\0&0&1\end{bmatrix} \begin{bmatrix}3\\-1\\1\end{bmatrix} = \begin{bmatrix}-\frac{13}5\\\frac95\\1\end{bmatrix},$$ which corresponds to the equation $$-\frac{13}5x+\frac95y+1=0$$, or $$13x-9y=5$$.