I was having trouble in solving this question: For a vector $\textbf{v}$, let $\textbf{r}$ be the reflection of $\textbf{v}$ over the line $\textbf{x} = t \begin{pmatrix} 2 \\ -1 \end{pmatrix}.$There exists a $2 \times 2$ matrix $\textbf{R}$ such that $\textbf{r} = \textbf{R} \textbf{v}$ for all 2-dimensional vectors $\textbf{v}$. Find $\textbf{R}$.
This question also came with an asy diagram, but I don't know how to make it work on this site :(
unitsize(1 cm);
pair O, V, R;
O = (0,0);
V = (3,1);
R = reflect(O,(2,-1))*(V);
xaxis(-2,4);
yaxis(-3,1);
draw((-1)*(2,-1)--2*(2,-1));
draw(O--V,Arrow(8));
draw(O--R,Arrow(8));
dot(O);
label("$\mathbf{v}$", (O + V)/2, N);
label("$\mathbf{r}$", (O + R)/2, W);
Let $\mathbf a = \begin{bmatrix} 2 \\ -1 \end{bmatrix}$ such that $\mathbf x = t \cdot \mathbf a$. Then, to reflect $\mathbf v$ on $\mathbf x$, you need to:
Insert, and factor:
$\mathbf r = 2\mathbf a \cdot (\mathbf a^T\mathbf v)/(\mathbf a^T \mathbf a) - \mathbf v = \left(2 \frac{\mathbf a \mathbf a^T}{\mathbf a^T \mathbf a} - \mathbf I_2\right) \cdot \mathbf v = \mathbf R \mathbf v$
for $\mathbf R = 2 \frac{\mathbf a \mathbf a^T}{\mathbf a^T \mathbf a} - \mathbf I_2$.
Just as a note: There are more general expressions for it, have a look for reflection matrices if you like.
edit: Here is a sketch to illustrate the projection and $\mathbf n$ for $\mathbf v = \begin{bmatrix} 3 \\ 1 \end{bmatrix}$: