Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know how the angle between two n-vectors is defined. I mean whether it is unique and how we may compute it (is the inner product a valid method in the n-dimensional space?). I have found very little information on this issue on the internet. Thanks

share|cite|improve this question
Did you want the acute angle or the obtuse angle (that is, if your vectors weren't perpendicular)? – J. M. Jul 23 '11 at 13:40
@J.M.: Did you mean the non-reflex ($0\le\theta\le\pi$) angle or the reflex ($\pi\lt\theta\lt2\pi$) angle? – Isaac Jul 23 '11 at 14:55
@Isaac: Tsk, I was thinking of "vertical angles" at the time I wrote the comment... so the first one, yes. – J. M. Jul 23 '11 at 14:57

If your two vectors $v$ and $w$ are not collinear then they span a two-dimensional plane $E\subset{\mathbb R}^n$. This plane inherits the given scalar product in ${\mathbb R}^n$ and so becomes an ordinary euclidean plane like the sheet of paper you are drawing on. The angles in this plane are related to the scalar product as they are in two-dimensional vector geometry, namely by $$\cos\bigl(\angle(v,w)\bigr)={\langle v, w\rangle\over|v|\ |w|}\ .$$

share|cite|improve this answer
+1 this is the simplest explanation I've seen for why the law of cosines extends to higher dimensions. – R.. Jul 24 '11 at 2:43

In the $n$-dimensional real space the angle between two vectors is defined by the inner-product: $$\cos\theta=\frac{\langle v,w \rangle}{||v||\cdot||w||}$$ Where $||v||$ is the length of the vector.

share|cite|improve this answer
I just want to point out that this is basically taking the Law of cosines and solving for the angle. – Willie Wong Jul 23 '11 at 13:25

While you can certainly compute the angle using the usual inner product formula, it's also possible and perfectly acceptable to use the same flavor of geometric definition of angles as is done in $\mathbb{R}^2$ and $\mathbb{R}^3$. Radially project two given nonzero vectors onto the unit sphere via the map $\vec{x}\to\vec{x}/\|\vec{x}\|$. Any two nonidentical points on a hypersphere determine a unique "great circle" containing both of them; the angle in radians can be defined as the length of the shorter arc between the two. (Of course, this raises the question, "How is arclength defined in higher dimensions?" - but this is moot given that the 2 and 3-dimensional definitions immediately generalize to any dimension.)

Demonstrating the inner product formula works in higher dimensions given this definition is fairly easy: the general idea is to use an orthonormal change-of-base matrix $M$ which takes the plane determined by the great circle containing two unit vectors to the $xy$-plane (inner products are unchanged under $M$'s action: $\langle Mx,My\rangle = \langle x,M^TMy\rangle = \langle x,Iy\rangle=\langle x,y\rangle$) and then the formula's validity is reduced to the two-dimensional case.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.