I am in need to create a matrix consisting of a 5x5 array.
I have in total of 5 vectors [v1,v2,v3,v4,v5]. Where of [v1,v2,v3] needs to the same in the new "room", and [v4,v5] needs to be opposing. So the angle between all vectors is consistent.
I am personally thinking of creating a x-axis mirroring of vector [v4,v5] however it needs to be one large transformation matrix.
Any advice is greatly considered, thank you!
Here’s one way to proceed:
Since the $\mathbf v_i$ are linearly independent, they form an ordered basis. Replace the last two with their corresponding unit vectors to get the ordered basis $\mathscr B = \left(\mathbf v_1,\mathbf v_2,\mathbf v_3,{\mathbf v_4\over\|\mathbf v_4\|},{\mathbf v_5\over\|\mathbf v_5\|}\right)$. (For consistency, you could normalize everything, but it doesn’t really gain you anything.) In this basis the matrix of the described transformation is the permutation matrix $$P=\begin{bmatrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0&0&0&1\\0&0&0&1&0\end{bmatrix},$$ which swaps the last two coordinates. Perform a change-of-basis on this to get the matrix in the standard basis: $$M=BPB^{-1} = \begin{bmatrix}\mathbf v_1&\mathbf v_2&\mathbf v_3&{\mathbf v_5\over\|\mathbf v_5\|}&{\mathbf v_4\over\|\mathbf v_4\|}\end{bmatrix}\begin{bmatrix}\mathbf v_1&\mathbf v_2&\mathbf v_3&{\mathbf v_4\over\|\mathbf v_4\|}&{\mathbf v_5\over\|\mathbf v_5\|}\end{bmatrix}^{-1}$$ (note the order of the last two columns of the first matrix). It’s simple matter to verify that $M^2=I$ and $\det M=-1$, so this is indeed a reflection.
However, you also mention that the vectors form an orthonormal set, which makes things even easier: you don’t need to normalize anything and the inverse of an orthogonal matrix is its transpose, so the formula for the transformation matrix simplifies to $$M = \begin{bmatrix}\mathbf v_1&\mathbf v_2&\mathbf v_3&\mathbf v_5&\mathbf v_4\end{bmatrix}\begin{bmatrix}\mathbf v_1^T \\ \mathbf v_2^T \\ \mathbf v_3^T \\ \mathbf v_4^T \\ \mathbf v_5^T\end{bmatrix}.$$ Another way to compute this matrix in the orthonormal case is to modify the basis by replacing $\mathbf v_4$ with $\mathbf u_4=\frac1{\sqrt2}(\mathbf v_4+\mathbf v_5)$ and $\mathbf v_5$ with $\mathbf u_5=\frac1{\sqrt2}(\mathbf v_4-\mathbf v_5)$ (their angle bisectors). In this basis, the transformation matrix is $D=\operatorname{diag}(1,1,1,1,-1)$ and $$M=B'DB'^T = \begin{bmatrix}\mathbf v_1&\mathbf v_2&\mathbf v_3&\mathbf u_4&-\mathbf u_5\end{bmatrix}\begin{bmatrix}\mathbf v_1^T \\ \mathbf v_2^T \\ \mathbf v_3^T \\ \mathbf u_4^T \\ \mathbf u_5^T\end{bmatrix}.$$