Solution (source code)

= Solution

For a line through the origin making angle $\theta$ with the positive $x$-axis, its <reflection matrix> is
$$
S_\theta=\begin{pmatrix}\cos2\theta&\sin2\theta\\\sin2\theta&-\cos2\theta\end{pmatrix}.
$$
Its <determinant> is $-1$. An <orthogonal matrix> has <determinant> $\pm1$. If its <determinant> is $-1$, write its first column as $(\cos\varphi,\sin\varphi)^T$; orthonormality and the <determinant> then force the second column to be $(\sin\varphi,-\cos\varphi)^T$. The matrix is $S_{\varphi/2}$, hence is one <Euclidean reflection>. If its <determinant> is $+1$, the second column is $(-\sin\varphi,\cos\varphi)^T$, so it is a <rotation matrix>. Direct multiplication gives
$$
\boxed{R_\varphi=S_{\varphi/2}S_0.}
$$
The identity may be taken as an empty product or as two identical reflections. Thus at most two origin-line reflections suffice in every case.

For a nonzero vector $b=d n$ with $d=|b|$ and unit normal $n$, reflection in the affine line $n\cdot x=c$ is $s_c(x)=x+2(c-n\cdot x)n$. Consequently $s_{d/2}s_0(x)=x+d n=x+b$. A <translation> is therefore a product of two parallel-line reflections. Combining this with the given decomposition of a <Euclidean isometry> as translation followed by an orthogonal map proves that every plane isometry is a finite product of affine-line reflections. The affine lines need not pass through the origin. In fact three suffice: if an isometry $f$ sends zero to $b\ne0$, reflection in the perpendicular bisector of $0,b$ takes $b$ to zero. Composing that reflection with $f$ gives an isometry fixing zero, to which the two-reflection linear result applies. This is the planar <finite reflection decomposition of a Euclidean isometry>.

For an example that genuinely needs three, take the <glide reflection>
$$
\boxed{g(x,y)=(x+1,-y).}
$$
It has no fixed point, so it is not one reflection. Its orthogonal part has <determinant> $-1$, whereas the product of two reflections has <determinant> $+1$, so it is not two reflections; it is not the identity either. Explicitly it is reflection in $y=0$ followed by reflection in $x=0$ and then in $x=1/2$. Thus its minimum reflection count is exactly three.