# Vectors to Matrices in algebraic equations

This question is based off of Dave Eberly's 3D Game Engine Design, 2nd Edition. I am reading it slowly to gain a larger algebraic grasp of 3D graphics, which this book seems to offer.

When finding a reflection of a vector V in the plane N • X = 0, the book describes breaking the vector up into two parts, cN and Nperp, where c is the height of V. No issues here.

To find the reflection, he uses U = -cN + Nperp, which also makes sense. But then he makes this jump:

U = V - 2(N • V)N = (I - 2NNT)V

He has taken the reflected vector and transformed it into a matrix. I have two questions here.

1) What is the formula or rule of thumb used to make this leap? 2) Is there a particular branch of linear algebra that this type of calculation is commonly observed in?

My linear algebra class was many years ago, but I don't ever remember anything quite like this.

Writing indices, as physicists do, helps. Denote elements of the vectors $U$, $V$ and $N$ respectively by $u_i$, $v_i$ and $n_i$. In such notation, matrix elements of $N$ are denoted by say $n_{i}$. Then, $$u_i = v_i - 2 \left(\sum_j n_j v_j\right)\ n_j$$ which can be rewritten as $$u_i = \sum_{j} \left(\delta_{ij} - 2 n_i n_j\right)\ v_j\ ,$$ where $\delta_{ij}$ is the Kronecker delta. In matrix form, $\delta_{ij}$ is the identity matrix and $n_i n_j$ corresponds to $NN^T$.