# Calculate angle between two vectors, given their rotation w.r.t. a third vector.

I have three vectors, $$\vec{a},\vec{b},$$ and $$\vec{c}$$ in $$n$$-dimensional space. I know the coordinates of all three vectors and their dot products. Both $$\vec{a}$$ and $$\vec{b}$$ are rotated away from $$\vec{c}$$ by an angle $$\alpha$$, in their own respective directions, obtaining $$\vec{a}'$$ and $$\vec{b}'$$. What is the angle between $$\vec{a}'$$ and $$\vec{b}'$$?

I have worked on finding the generalized rotation matrices in $$n$$-dimensions, calculating $$\vec{a}'$$ and $$\vec{b}'$$ using Clifford Algebra using the answers from the posts below. However, these methods require many matrix operations and are too slow. I am wondering whether there is a neater solution without requiring the calculation of the two rotated $$\vec{a}'$$ and $$\vec{b}'$$ vectors first.

• Can you clarify what you mean by "in their own respective dimensions"? Do you mean they're not in the span of $a,b,c$? Dec 29, 2021 at 14:02
• @CyclotomicField Apologies for the confusion, $a$ simply moves away from $c$ by angle $\alpha$ and similar $b$ moves away from $c$ by angle $\alpha$, staying on the unit hypersphere. I meant to say, 'directions' I edited the question. Dec 29, 2021 at 14:08
• All the vectors, including $a'$ and $b'$ live in the 3D space spanned by $a,b, c$. The problem should be reducible to a problem in 3D. I suggest to use Gram-Schmidt process on $a, b, c$. Dec 29, 2021 at 14:17

Assuming that $$a, b, c$$ have norm 1, we have \begin{align} a' &= 2(a\cdot c)a - c\\ b' &= 2(b\cdot c)b - c\\ \end{align} Indeed, this implies $$a'\cdot a = a\cdot c$$ and $$a'\cdot c = 2(a\cdot c)^2-1$$ which is the cosine of the double angle. Alternatively, it is obvious geometrically that $$\frac{a'+c}{2}$$ is the orthogonal projection of $$c$$ on $$a$$, that is to say $$(a\cdot c) a$$.
Hence $$$$a'\cdot b' = 4 (a\cdot c)(b\cdot c)(a\cdot b) - 2(a\cdot c)^2 - 2(b\cdot c)^2 +1$$$$