Let $X \in \mathbb{R}^{N \times 2}$, such that \begin{equation} X = \begin{bmatrix} 1 & 0 \newline \vdots & \vdots \newline N & 0 \end{bmatrix} \end{equation} Let $Y \in \mathbb{R}^{N \times 2}$, such that \begin{equation} Y = \begin{bmatrix} 1 & f(1) \newline \vdots & \vdots \newline N & f(N) \end{bmatrix} \end{equation} where $f(i) = bi^2$. It is possible to find the best rotation matrix that fits $X$ and $Y$:
\begin{equation} min_\theta \| X-YR(\theta) \|_F^2 \end{equation}
where $R(\theta)$ is a rotation matrix, and derive an expression for the angle $\theta$. Is there a shorter way to derive to a concise expression for this angle ?
This is basically Miss Mae's answer using vectors.
Define the column vectors and matrices
$$ u = \begin{bmatrix} 1 \\ \vdots \\ N \end{bmatrix} \! , ~ v = \begin{bmatrix} 1^2 \\ \vdots \\ N^2 \end{bmatrix} \!, ~ X = \begin{bmatrix} | & | \\ u & 0 \\ | & |\end{bmatrix} \!, ~ Y = \begin{bmatrix} | & | \\ u & v \\ | & | \end{bmatrix} \!, ~ R=\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \! . $$
The columns of $YR$ are $p=\cos\theta u+\sin\theta v$ and $q=-\sin\theta u+\cos\theta v$. Therefore,
$$ \begin{array}{ll} \|X-YR\|^2 & = \|u-p\|^2+\|-q\|^2 \\ & = \|u\|^2-2u\cdot p+\|p\|^2+\|q\|^2 \\ & = \|u\|^2-2u\cdot p+\|u\|^2+\|v\|^2. \end{array}$$
(Note $\|p\|^2+\|q\|^2=\|u\|^2+\|v\|^2$ is just $\|YR\|^2=\|Y\|^2$.) Then
$$ \arg\min_\theta \bigl(2\|u^2\|+\|v\|^2-2u\cdot p\bigr)~=~\arg\max_\theta(u\cdot p). $$
We can write $u\cdot p=u\cdot (\cos\theta u+\sin\theta v)=(\cos\theta,\sin\theta)\cdot(\|u\|^2,u\cdot v)$ which is maximized when $(\cos\theta,\sin\theta)$ equals $(\|u\|^2,u\cdot v)$ normalized, so we get
$$ \tan\theta=\frac{u\cdot v}{\|u\|^2}=\left(\frac{1^3+\cdot+N^3}{1^2+\cdot+N^2}\right)b. $$
With $1^2+\cdots+N^2=N(N+1)(2n+1)/6$ and $1^3+\cdots+N^3=(n(n+1)/2)^2$:
$$ \theta = \tan^{-1} \left(\frac{3N(N+1)}{2(2N+1)}b\right). $$
Note that $\cos\theta=\|u\|^2/\sqrt{\cdots}\ge0$ means $-\frac{\pi}{2}<\theta<\frac{\pi}{2}$ is in the range of $\tan^{-1}$.