Reflection across a line Let $g$ be a line with equation $g:ax+by+c=0$ in Hesse normal form. I want to show that the reflection across $g$ is described by \begin{equation*}\binom{x}{y}\mapsto \binom{x}{y}-2(ax+by+c)\binom{a}{b}\end{equation*} 
At the reflection across $g$ it holds the following for the image $P'$ of each point $P$: 


*

*$P'$ lies on the perpendicular to $g$ through $P$.   

*$g$ bisects $PP'$.


So to show the desired result, do we have to find the perpendicular line to $g$ ?
 A: For the first question it suffices to verify that $P-P'$ is orthogonal to $g$ that is $P-P'$ is parallel to $\binom{a}{b}$ which is true because
$$P-P'=2(ax+by+c)\binom{a}{b} \parallel \binom{a}{b}.$$
As regards the second question, we have that the midpoint of $PP'$ is
$$Q:=\frac{P+P'}{2}=\frac{1}{2}\left(\binom{x}{y}+\binom{x}{y}-2(ax+by+c)\binom{a}{b}\right)=\binom{x}{y}-(ax+by+c)\binom{a}{b}.$$
Now we verify that $g$ bisects $PP′$, that is $Q$ belongs to the line $g$:
$$\binom{a}{b}^t\cdot Q+c=ax+by-(ax+by+c)(a^2+b^2)+c=0$$
which holds because $a^2+b^2=1$.
P.S. The formula for reflection accross the line $ax+by+c$ with $a^2+b^2=1$
$$\binom{x}{y}\mapsto \binom{x}{y}-2(ax+by+c)\binom{a}{b}$$
can be "guessed" in this way:  $\binom{a}{b}$ is a unit vector orthogonal to the line, $ax+by+c$ is the signed distance of $(x,y)$ from the line (the sign depends on the orientation of $\binom{a}{b}$. Then to obtain the reflected point of $P$, we take $P$ and we subtract two times the component of $P$ along $\binom{a}{b}$.
A: This reflection is an affine map, so we can represent it as linear map if we embed plane in $\mathbb R^3$ with $(x,y)\mapsto (x,y,1)$.
I will use the same idea as Robert Z, $P'$ is reflection of $P$ along the line $ax + by + c=0$ if two conditions are met:

(1) $\ \displaystyle\frac{P+P'}2$ lies on the line $ax + by + c = 0$

We can describe this with linear equation $$\left\langle\frac{P+P'}2,(a,b,c) \right\rangle  = 0.$$

(2) $\ P-P'$ is perpendicular to the line $ax + by + c = 0$

Direction vector of the line is given by $(-b,a,0)$, so $P'-P$ must be orthogonal to it, i.e. $$\left\langle P'-P,(-b,a,0)\right\rangle = 0.$$
If we write $P = (x,y,1),\ P'=(x',y',1)$, conditions (1) and (2) can be written as 
\begin{align}
ax'+by'&= -ax - by - 2c\\
-bx'+ay' &= -bx+ay
\end{align}
or in matrix form
$$
\begin{pmatrix}
a & b & 0\\
-b & a & 0\\
0 & 0 & 1\\
\end{pmatrix}\begin{pmatrix}
x'\\
y'\\
1\\
\end{pmatrix} = \begin{pmatrix}
-a & -b & -2c\\
-b & a & 0\\
0 & 0 & 1\\
\end{pmatrix}\begin{pmatrix}
x\\
y\\
1\\
\end{pmatrix}.$$
Invert the matrix on the left hand side to get
\begin{align}
\begin{pmatrix}
x'\\
y'\\
1\\
\end{pmatrix} &= \frac 1{a^2+b^2}\begin{pmatrix}
a & -b & 0\\
b & a & 0\\
0 & 0 & a^2+b^2\\
\end{pmatrix}\begin{pmatrix}
-a & -b & -2c\\
-b & a & 0\\
0 & 0 & 1\\
\end{pmatrix}\begin{pmatrix}
x\\
y\\
1\\
\end{pmatrix}\\
&= \frac {-1}{a^2+b^2}\begin{pmatrix}
a^2-b^2 & 2ab & 2ac\\
2ab & b^2-a^2 & 2bc\\
0 & 0 & -(a^2+b^2)\\
\end{pmatrix}\begin{pmatrix}
x\\
y\\
1\\
\end{pmatrix}
\end{align}
or if you want to get back to $\mathbb R^2$, we get affine map
$$\begin{pmatrix} x\\ y\end{pmatrix} \mapsto \frac {-1}{a^2+b^2}\begin{pmatrix}
a^2-b^2 & 2ab \\
2ab & b^2-a^2 
\end{pmatrix}\begin{pmatrix}
x\\
y
\end{pmatrix}-\frac {1}{a^2+b^2}\begin{pmatrix} 2ac\\ 2bc\end{pmatrix}.$$
A: We have the following line
$$\mathcal L := \{ \mathrm x \in \mathbb R^2 \mid \mathrm a^\top \mathrm x = b \}$$
in Hessian normal form, i.e., $\| \mathrm a \|_2 = 1$. The point in $\mathcal L$ closest to the origin is the least-norm solution
$$\mathrm x_{\text{LN}} := \mathrm a \left( \mathrm a^\top \mathrm a \right)^{-1} b = b \, \mathrm a$$
We introduce $\rm y:= x - x_{\text{LN}}$ to translate the line. We then have a line $\mathcal L'$ passing through the origin, a $1$-dimensional linear subspace, defined by $\mathrm a^\top \mathrm y = 0$. Note that


*

*the projection matrix that projects onto the orthogonal complement of $\mathcal L'$ is $\rm P := a a^\top$.

*the projection matrix that projects onto $\mathcal L'$ itself is $\rm I_2 - P = I_2 - a a^\top$.
We can write a vector $\rm y$ in terms of two components, one orthogonal to $\mathcal L'$ and the other parallel to $\mathcal L'$, i.e., $\rm y = P y + (I_2 - P) y$. Thus, the desired reflection is given by the following linear function
$$\rm y \mapsto -P y + (I_2 - P) y = (I_2 - 2 P) y$$
or, in terms of $\rm x$, by the affine function $\mathrm x \mapsto f (\mathrm x)$, where
$$\begin{array}{rl} f (\rm x) &:= \rm \mathrm x_{\text{LN}} + (I_2 - 2 P) (x - x_{\text{LN}})\\ &\,= \rm 2 P x_{\text{LN}} + (I_2 - 2 P) x\\ &\,= 2 b \, \mathrm a + \left( \mathrm I_2 - 2 \mathrm a \mathrm a^\top \right) \mathrm x\\ &\,= \mathrm x - 2 \mathrm a \left( \mathrm a^\top \mathrm x - b \right)\\ &\,= \color{blue}{\mathrm x - 2 \left( \mathrm a^\top \mathrm x - b \right) \mathrm a}\end{array}$$
