I would like to understand where to following formula for a 2-D rotation matrix is derived from:
$R =\frac{1}{a^2+b^2} \left(\begin{array}{cc} a^2-b^2 & 2ab\\ -2ab & a^2-b^2 \end{array}\right)$
I believe the answer is geometric and if it is, a picture would be nice.
Consider the unit vector
$$\vec u=\left(\frac a{\sqrt{a^2+b^2}},\frac b{\sqrt{a^2+b^2}}\right).$$
The rotation that applies $(1,0)$ to $\vec u$ and $(0,1)$ to a unit vector orthogonal to $\vec u$ is described by the matrix
$$R=\frac1{\sqrt{a^2+b^2}}\begin{bmatrix}a&b\\-b&a\end{bmatrix}.$$
Applying the rotation twice, i.e. squaring the matrix gives
$$R^2=\frac1{a^2+b^2}\begin{bmatrix}a^2-b^2&2ab\\-2ab&a^2-b^2\end{bmatrix}.$$