Given point $P=(x,y)$ and a line $l$, what is a general formula for the reflection of $P$ in $l$ I am doing Isometries i.e. Rotations, translations and reflections at the moment. General equations for  2 of them are "easy"
Translation: $f(x,y)=(x+a,y+b)$
Rotation about origin through the angle $\alpha$ is just $f(r,\theta)=(r,\theta+\alpha)$
However I struggle to find similiar function for a reflection in a line. For some simple cases like Reflection in line $y=x$ this is easy, $f(x,y)=(y,x)$ but I struggle to find the way for a general function $f(x)=mx+c$. 
Thanks for any help
 A: Hint: If line $l_1$ is reflected in line $l_r$ to become $l_2$ then where they intersect gives you one point of line $l_2$, $(x_0,~ y_0)$. What is the slope of $l_2$? If you can reason this out, then you can write the equation $y-y_0 = m(x-x_0)$ directly.
A: This is fun. If point P is given and a line $y=m x + c$, then the mirror point Q is
$$ \begin{pmatrix} x_Q \\ y_Q \end{pmatrix} =\begin{bmatrix} \frac{1-m^2}{1+m^2} & \frac{2 m}{1+m^2} \\ \frac{2 m}{1+m^2} & \frac{m^2-1}{1+m^2} \end{bmatrix}  \begin{pmatrix} x_P \\ y_P \end{pmatrix} +  \begin{pmatrix} -\frac{2 c m}{1+m^2} \\ \frac{2 c}{1+m^2} \end{pmatrix}$$
How
I decomposed the coordinates of point P into three vector parts


*

*From the origin to the line (perpendicular to the line) 
$$ \begin{pmatrix} -\frac{c m}{1+m^2} \\ \frac{c}{1+m^2} \end{pmatrix}$$

*From there move along the line and closest to P
$$ \begin{pmatrix} \frac{m y_P+x_P}{1+m^2} \\ \frac{m ( m y_P+x_P)}{1+m^2} \end{pmatrix} $$

*From the closest point move perpendicular to P
$$ \begin{pmatrix} \frac{m (m x_P - y_P+c)}{1+m^2} \\ -\frac{m x_P-y_P+c}{1+m^2} \end{pmatrix} $$


You can confirm that the following is true
$$ \begin{pmatrix} x_P \\ y_P \end{pmatrix} = \begin{pmatrix} -\frac{c m}{1+m^2} \\ \frac{c}{1+m^2} \end{pmatrix} + \begin{pmatrix} \frac{m y_P+x_P}{1+m^2} \\ \frac{m ( m y_P+x_P)}{1+m^2} \end{pmatrix} + \begin{pmatrix} \frac{m (m x_P - y_P+c)}{1+m^2} \\ -\frac{m x_P-y_P+c}{1+m^2} \end{pmatrix} $$
To get to the mirror point Q flip the direction of the last part
$$ \begin{pmatrix} x_Q \\ y_Q \end{pmatrix} = \begin{pmatrix} -\frac{c m}{1+m^2} \\ \frac{c}{1+m^2} \end{pmatrix} + \begin{pmatrix} \frac{m y_P+x_P}{1+m^2} \\ \frac{m ( m y_P+x_P)}{1+m^2} \end{pmatrix} - \begin{pmatrix} \frac{m (m x_P - y_P+c)}{1+m^2} \\ -\frac{m x_P-y_P+c}{1+m^2} \end{pmatrix} $$
