As explained in these notes, the maximum rotation angle $\theta$ of a symmetric positive definite matrix $M$ is related to the condition number $K=\mu_{\rm max}/\mu_{\rm min}$ of the matrix (the ratio of largest and smallest eigenvalue) by $$K=\frac{1+\sin\theta}{1-\sin\theta}\Leftrightarrow\cos\theta=\frac{2\sqrt{K}}{{1+K}}.$$ For $n=2$ this reduces to the first equation in the OP. The formulas for $\cos\theta$ in the OP for $n=3,4$ do not agree with the above.
I just noticed a similar answer at MSE.