This is a classic problem. Read up on "Jacobi rotations"
Here is the short answer:
Focus on the matrix $ \left( \begin{array}{c c}
a & b\\
b & a
\end{array}
\right)
$.
A Jacobi rotation is given by
$$ \left( \begin{array}{c c}
c & s\\
-s & c
\end{array}
\right)
$$
where $ c = \cos( \theta ) $ and $ s = \sin( \theta ) $
such that, for this problem,
$$ \left( \begin{array}{c c}
c & s\\
-s & c
\end{array}
\right)
\left( \begin{array}{c c}
a & b\\
b & a
\end{array}
\right)
\left( \begin{array}{c c}
c & s\\
-s & c
\end{array}
\right)^T
$$
is diagonal.
You then take that, and use it as follows:
$$ \left( \begin{array}{c c}
c & 0 & s\\
0 & 1 & 0 \\
-s & 0 & c
\end{array}
\right)
\left( \begin{array}{c c c }
a & 0 & b\\
0 & a & 0 \\
b & 0 & a
\end{array}
\right)
\left( \begin{array}{c c}
c & 0 & s\\
0 & 1 & 0 \\
-s & 0 & c
\end{array}
\right)^T
$$
The exact formula for $ c $ and $ s $ I don't quite remember.
A rotation is an orthogonal matrix, so it what you need.
This is a classic problem. Read up on "Jacobi rotations"
Here is the short answer:
Focus on the matrix $ \left( \begin{array}{c c} a & b\\ b & a \end{array} \right) $. A Jacobi rotation is given by $$ \left( \begin{array}{c c} c & s\\ -s & c \end{array} \right) $$ where $ c = \cos( \theta ) $ and $ s = \sin( \theta ) $ such that, for this problem, $$ \left( \begin{array}{c c} c & s\\ -s & c \end{array} \right) \left( \begin{array}{c c} a & b\\ b & a \end{array} \right) \left( \begin{array}{c c} c & s\\ -s & c \end{array} \right)^T $$ is diagonal. You then take that, and use it as follows: $$ \left( \begin{array}{c c} c & 0 & s\\ 0 & 1 & 0 \\ -s & 0 & c \end{array} \right) \left( \begin{array}{c c c } a & 0 & b\\ 0 & a & 0 \\ b & 0 & a \end{array} \right) \left( \begin{array}{c c} c & 0 & s\\ 0 & 1 & 0 \\ -s & 0 & c \end{array} \right)^T $$ The exact formula for $ c $ and $ s $ I don't quite remember.
A rotation is an orthogonal matrix, so it what you need.