Finding the matrix for the reflection of a vector over some arbitrary line in $\mathbb{R}^2$ With a little bit of drawing, I derived the matrix for the projection of some arbitrary vector $\vec{x}  \in \mathbb{R}^2$ onto some line $L$, where $\vec{u} = \begin{bmatrix} u_1 \\ u_2\end{bmatrix}$ is a unit vector parallel to $L$. The matrix for this, $A$:
$$
A = \begin{bmatrix} u^2_1 & u_1u_2 \\ u_1u_2 & u^2_2 \end{bmatrix} 
\ \ \ \text{where the projection of } \vec{x} \text{ onto } L \text { is found by } A\vec{x}.
$$
From there, I related the projection of $\vec{x}$ onto $L$ to its reflection. There, I got matrix $B$, representing the transformation for the reflection of some $\vec{x}$ over $L$:
\begin{align}
B &= 2\begin{bmatrix} u^2_1 & u_1u_2 \\ u_1u_2 & u^2_2 \end{bmatrix} - \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\[5pt] &= \begin{bmatrix} 2u^2_1 - 1 & 2u_1u_2 \\ 2u_1u_2 & 2u^2_2 - 1 \end{bmatrix} \ \ \ \text{where the reflection of } \vec{x} \text{ over } L \text { is found by } B\vec{x}.
\end{align}
However, in my textbook, the author merely states that the matrix for the reflection transformation is
$$
\begin{bmatrix} a & b \\ b & -a \end{bmatrix} \ \ \ \text{where  } a^2 + b^2 = 1
$$
Although the matrix is true based off of the matrix I derived, since...
$$ a + d = (2u^2_1 - 1) + (2u^2_2 - 1) = 0 \quad \text{and} \quad b = 2u_1u_2 = c $$
It still isn't helpful since I still have to somehow find $a$ and $b$ to get the appropriate transformation. But, it isn't clear from the text how to exactly find the variables $a$ and $b$. Given some unit vector, is there some sort of trick I can use to get these variables?
 A: Everything you've written is correct. Here's a derivation that perhaps sheds light on the meaning of the entries of the reflection matrix.

Given unit vector $\vec{u} = \begin{bmatrix} u_1 \\ u_2 \end{bmatrix}$, the projection of an arbitrary vector $\vec{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}$ along $\vec{u}$ is
$$
\operatorname{proj}_{\vec{u}} \vec{x} = (\vec{x} \cdot \vec{u}) \, \vec{u}, 
$$
so the orthogonal projection (sometimes called the rejection of $\vec{x}$ from $\vec{u}$) is
$$
\operatorname{oproj}_{\vec{u}} \vec{x} 
= \vec{x} - \operatorname{proj}_{\vec{u}} \vec{x} 
= \vec{x} - (\vec{x} \cdot \vec{u}) \, \vec{u}, 
$$
and the reflection of $\vec{x}$ across $\vec{u}$ is
$$
\vec{x} - 2\operatorname{oproj}_{\vec{u}} \vec{x} 
= \vec{x} - 2 \bigl( \vec{x} - (\vec{x} \cdot \vec{u}) \, \vec{u} \bigr) 
= 2 (\vec{x} \cdot \vec{u}) \, \vec{u} - \vec{x}.
$$
In coordinates, this looks like
\begin{align} 
B \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}  
&= 2(u_1 x_1 + u_2 x_2) \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} 
- \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \\
&= \begin{bmatrix} 2u_1^2 x_1 + 2u_1u_2 x_2 \\ 
2u_1u_2 x_1 + 2u_2^2 x_2\end{bmatrix} 
- \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \\ 
&= \begin{bmatrix} 2u_1^2 - 1 & 2u_1u_2 \\ 
2u_1u_2 & 2u_2^2 - 1 \end{bmatrix} 
\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}, 
\end{align}
hence
$$
B = \begin{bmatrix} 2u_1^2 - 1 & 2u_1u_2 \\ 
2u_1u_2 & 2u_2^2 - 1 \end{bmatrix}, 
$$
precisely as you have stated. The entries of this symmetric matrix are stated explicitly in terms of the components of the unit vector $\vec{u}$, exactly as you desire, i.e.
$$
a = 2u_1^2 - 1 
\quad\text{and}\quad 
b = 2u_1u_2. 
$$
Familiarity with trig identities suggests that if $u_1 = \cos \theta$ and $u_2 = \sin \theta$, where $\theta$ is the angle between $\vec{u}$ and $\vec{x}$, then
$$
a = 2u_1^2 - 1 = 2 \cos^2 \theta - 1 = \cos 2\theta 
\quad\text{and}\quad 
b = 2u_1u_2 = 2 \cos\theta \sin\theta = \sin 2\theta,  
$$
so
$$
B = \begin{bmatrix} \cos 2\theta & \sin 2\theta \\ 
\sin 2\theta & - \cos 2\theta \end{bmatrix} 
= \begin{bmatrix} \cos 2\theta & -\sin 2\theta \\ 
\sin 2\theta & \cos 2\theta \end{bmatrix} 
\begin{bmatrix} 1 & 0 \\ 
0 & -1 \end{bmatrix}, 
$$
is the composition of a reflection in the second coordinate followed by a rotation through angle $2\theta$, sometimes called an improper rotation.
