Calculating the matrix corresponding to linear map How does one go about converting a linear map in functional form to a matrix; for instance:


  For a fixed unit vector $\hat{n} \in \mathbb{R}^{3}$, define the map $f:\mathbb{R}^{3}\to\mathbb{R}^{3}$ by: $$f(\vec{v})=\vec{v}-2(\hat{n}\cdot\vec{v})\hat{n}$$ Work out the matrix $\mathbf{A}$ describing $f$ relative to the basis $\{\hat{\mathrm{i}},\hat{\mathrm{j}},\hat{\mathrm{k}}\}$ and show that $\mathbf{A}^{2}=\vec{1}$


The question then goes on to ask how to work out a matrix describing $f$ relative to a different basis set $\{\hat{u}_{1},\hat{u}_{2},\hat{n}\}$ and I'm not sure how to approach these problems.
Recall what it means to find the matrix $A$ of a linear transformation $T$ (with respect to a given basis $B$): it means to find $A$ such that $T([v]_B)=A[v]_B$. (Here, $[v]_B$ means the coordinates of $v$ with respect to the basis $B$.)

In other words, $A$ is the matrix representation of $T$ if the "action" of $T$ on an input vector in $B$-coordinates is just multiplying that input vector on the left by the matrix $A$. Looking at this example might help. 

You have the linear transformation $f:\mathbb{R}^3\to\mathbb{R}^3$, $f(\mathbf{v})=\mathbf{v}-2(\mathbf{n}\cdot \mathbf{v})\mathbf{n}$ and you are working with the standard basis on $\mathbb{R}^3$. Let $\mathbf{v}=(a,b,c)$ and $\mathbf{n}=(n_1,n_2,n_3)$. Then
\begin{align}
f(\mathbf{v})&amp;=\mathbf{v}-2(\mathbf{n}\cdot \mathbf{v})\mathbf{n}\\
f((a,b,c))&amp;=(a,b,c)-2\left((n_1,n_2,n_3)\cdot(a,b,c)\right)(n_1,n_2,n_3)\\
&amp;=\begin{bmatrix} a-2an_1^2-2bn_1n_2-2cn_1n_3\\ 
b-2an_1n_2-2bn_2^2-2cn_2n_3\\
c-2an_1n_3-2bn_2n_3-2cn_3^2
\end{bmatrix}\\
&amp;=\underbrace{\begin{bmatrix} 1-2n_1^2 &amp; -2n_1n_2 &amp; -2n_1n_3\\
-2an_1n_2 &amp; 1-2n_2^2 &amp; -2n_2n_3\\
-2n_1n_3 &amp; -2n_2n_3 &amp; 1-2n_3^2
\end{bmatrix}}_A
\begin{bmatrix}
a\\ b\\ c\end{bmatrix}.
\end{align}
In your case $n=3$, $v_1:=\hat{i}$, $v_2:=\hat{j}$, $v_3:=\hat{k}$, $T:=f$.

Step 1: Evaluate each element of the basis $\{v_1,\ldots,v_n\}$ in the transformation.

Step 2: expand each of these values in the basis $$T(v_i)=\alpha_{1i}v_1+\ldots\alpha_{ni}v_n.$$

Step 3: Put these coefficients as columns of a matrix, in the same order as the basis $\{v_1,v_2,\ldots,v_n\}$. To get $$\begin{bmatrix}\alpha_{11}&amp;\alpha_{12}&amp;\ldots&amp;\alpha_{1n}\\\alpha_{21}&amp;\alpha_{22}&amp;\ldots&amp;\alpha_{2n}\\\vdots&amp;\vdots&amp;\vdots&amp;\vdots\\\alpha_{n1}&amp;\alpha_{n2}&amp;\ldots&amp;\alpha_{nn}\end{bmatrix}$$

Doing the first column:

$f(\hat{i})=\hat{i}-2(\hat{n}\cdot \hat{i})\hat{n}=\hat{i}-2\hat{n}(1)\hat{n}=(1-2\hat{n}(1)^2)\hat{i}-2\hat{n}(1)\hat{n}(2)\hat{j}-2\hat{n}(1)\hat{n}(2)\hat{k}$.

So, the first column of the matrix is $\begin{bmatrix}1-2\hat{n}(1)^2\\-2\hat{n}(1)\hat{n}(2)\\-2\hat{n}(1)\hat{n}(2)\end{bmatrix}$,

where $\hat{n}(1)$, $\hat{n}(2)$, $\hat{n}(3)$, are the components of $\hat{n}$ in the basis $\hat{i}$, $\hat{j}$, $\hat{k}$, which I am assuming to be the standard basis of $\mathbb{R}^3$.