# Clarification on the Proof of $\cos \theta=\frac{a^{\mathrm{T}} b}{\|a\|\|b\|}$ for higher dimensions

Below is the proof given by Gilbert strang on pg 154 ,of the Cosine Formula :$$\cos \theta=\frac{a^{\mathrm{T}} b}{\|a\|\|b\|}$$

Before the proof, the only relevant thing the author defines is the inner product of two vectors $$a, b$$ given by $$a^T.b$$ and the orthogonality condition $$a^Tb =0$$

Authors proof:

Law of Cosines: $$\quad\|b-a\|^{2}=\|b\|^{2}+\|a\|^{2}-2\|b\|\|a\| \cos \theta$$

For angle $$\theta$$, the expression $$\|b-a\|^{2}$$ is $$(b-a)^{T}(b-a)$$, and above equation becomes $$b^{\top} b-2 a^{\mathrm{T}} b+a^{\mathrm{T}} a=b^{\mathrm{T}} b+a^{\mathrm{T}} a-2\|b\|\|a\| \cos \theta$$ Canceling $$b^{\top} b$$ and $$a^{\top} a$$ on both sides of this equation, you recognize the formula for cosine: $$a^{\top} b=\|a\|\|b\| \cos \theta .$$ In fact, this proves the cosine formula in $$n$$ dimension since we only have to worry about the plane triangle $$\mathrm{Oab}$$

Question: How does this prove the cosine formula in $$n$$ dimensions ? The author assumes that the law of cosines works for all higher dimensional vectors without proving it .

Furthermore what does "we only have to worry about the plane triangle $$\mathrm{Oab}$$" mean in higher dimensions?

Can anyone please help me understand this? It has been a day but I'm not getting it, if you can only hint, I'd be glad.
Thank you

In this light, it also makes sense that we can apply the law of cosines. As our vectors lie inside a 2D plane and we already know the law of cosines holds for triangles in 2D space, we can apply the law of cosines to the lengths of the vectors $$a$$, $$b$$ and $$b - a$$.
• How can you say that , two vectors say $[1,2,2,3,5]^T$and $[2,3,6,9,8]^T$ form a triangle? We can't visualise these vectors, then how come you say they form a triangle?? May 18 at 14:28
• If we consider two vectors in 3D space, we can see that the vectors span a 2D plane. This also holds in higher dimensions, so we can say that 2 5D vectors $v_1$ and $v_2$ form a 2D plane: namely the collection of all linear combinations of $v_1$ and $v_2$. May 18 at 14:54