Consider L be a line in \(\displaystyle{\mathbb{{{R}}}}^{{3}}\)

Orthogonal projection of \(\displaystyle\vec{{{x}}}\) onto the line L is,

\(\displaystyle{p}{r}{o}{j}_{{L}}{\left(\vec{{{x}}}\right)}={\left(\vec{{{x}}}\cdot\vec{{{u}}}\right)}\vec{{{u}}}\)

Here \(\displaystyle\vec{{{u}}}\) is a unit vector parallel to the line L.

Let

\(\vec{u}=\left(\begin{array}{c}u_1\\u_2\\u_3\end{array}\right)\)

Now \(proj_L(\vec{x})=(xu_1+yu_2+zu_3)\left(\begin{array}{c}u_1\\u_2\\u_3\end{array}\right)\)

Consider the matrix \(B=\frac{1}{3}\left(\begin{array}{c}1&1&1\\1&1&1\\1&2&1\end{array}\right)\)

Consider the corresponding linear transformation that representled by the matrix B.

\(B\vec{x}=\frac{1}{3}\left(\begin{array}{c}1&1&1\\1&1&1\\1&1&1\end{array}\right)\vec{x}\)

\(=\frac{1}{3}\left(\begin{array}{c}1&1&1\\1&1&1\\1&1&1\end{array}\right)\left(\begin{array}{c}x\\y\\z\end{array}\right)\)

\(=\frac{1}{3}\left(\begin{array}{c}x+y+z\\x+y+z\\x+y+z\end{array}\right)\)

\(=(\frac{1}{\sqrt{3}}x+\frac{1}{\sqrt{3}}y+\frac{1}{\sqrt{3}}z)\left(\begin{array}{c}\frac{1}{\sqrt{3}}\\ \frac{1}{\sqrt{3}}\\\frac{1}{\sqrt{3}}\end{array}\right)\)

This linear transformation is of the form (1)

From (1), unit vector is,

\(\vec{u}=\left(\begin{array}{c}\frac{1}{\sqrt{3}}\\ \frac{1}{\sqrt{3}}\\\frac{1}{\sqrt{3}}\end{array}\right)\)

The line L is,

\(\displaystyle{x}={y}={z}\)

Hence, the matrix B represents an orthogonal projection onto the line \(\displaystyle{L}:{x}={y}={z}\)

Reflection of \(\displaystyle\vec{{{x}}}\) onto the line L is,

\(\displaystyle{r}{e}{{f}_{{L}}{\left(\vec{{{x}}}\right)}}={2}{p}{r}{o}{j}_{{L}}{\left(\vec{{{x}}}\right)}-\vec{{{x}}}\)

\(\displaystyle={2}{\left(\vec{{{x}}}\cdot\vec{{{u}}}\right)}\vec{{{u}}}-\vec{{{x}}}\)

Now

\(\displaystyle{r}{e}{{f}_{{L}}{\left(\vec{{{x}}}\right)}}={2}{\left(\vec{{{x}}}\cdot\vec{{{u}}}\right)}\vec{{{u}}}-\vec{{{x}}}\)

\(=2(xu_1+yu_2+zu_3)\left(\begin{array}{c}u_1\\u_2\\u_3\end{array}\right)-\left(\begin{array}{c}x\\y\\z\end{array}\right)\)

Consider the matrix \(E=\frac{1}{3}\left(\begin{array}{c}-1&2&2\\2&-1&2\\2&2&-1\end{array}\right)\)

Consider the corresponding linear transformation that represented by the matrix E.

\(\vec{x}=\frac{1}{3}\left(\begin{array}{c}-1&2&2\\2&-1&2\\2&2&-1\end{array}\right)\left(\begin{array}{c}x\\y\\z\end{array}\right)\)

\(=\frac{1}{3}\left(\begin{array}{c}-x+2y+2z\\2x-y+2z\\2x+2y-z\end{array}\right)\)

\(=\frac{1}{3}\left(\begin{array}{c}-x+2y+2z\\2x-y+2z\\2x+2y-z\end{array}\right)+\left(\begin{array}{c}x\\y\\z\end{array}\right)-\left(\begin{array}{c}x\\y\\z\end{array}\right)\)

\(=\frac{1}{3}\left(\begin{array}{c}2x+2y+2z\\2x+2y+2z\\2x+2y+2z\end{array}\right)-\left(\begin{array}{c}x\\y\\z\end{array}\right)\)

This linear transformation is of the form

The line L is,

x=y=z

Hence, the matrix E represents reflection onto the line: x=y=z

Note that

\(\displaystyle{r}{e}{{f}_{{L}}{\left(\vec{{{x}}}\right)}}={2}{\left(\vec{{{x}}}\cdot\vec{{{u}}}\right)}\vec{{{u}}}-\vec{{{x}}}\)

\(\displaystyle={2}{p}{r}{o}{j}_{{L}}{\left(\vec{{{x}}}\right)}-\vec{{{x}}}\)

Therefore

2B-E=I