Starting from the usual inner product axioms,

  1. Linear: $(a\vec u + b\vec v)\cdot \vec w = (a\vec u \cdot \vec w) + (b \vec v \cdot \vec w)$
  2. Symmetric: $\vec u \cdot \vec v = \vec v \cdot \vec u$
  3. Positive definite: $\vec u \cdot \vec u \geq 0$ and is equal to zero when $\vec u = \vec 0$

Due to the Cauchy-Schwartz inequality, we know that

$$ -1 \leq \frac{\vec u \cdot \vec v}{\|\vec u\|\|\vec v\|} \leq 1$$

so it is safe define the angle $\theta$ between $\vec u$ and $\vec v$ using

$$ \theta := \cos^{-1} \left(\frac{\vec u \cdot \vec v}{\|\vec u\|\|\vec v\|} \right)$$

The inner product axioms (via the Cauchy-Schwartz inequality) guarantee this to be well-defined because the argument to $\cos^{-1}$ is between -1 and 1.

But why couldn't we say something like:

$$ \theta := 5\cos^{-1} \left(\frac{\vec u \cdot \vec v}{\|\vec u\|\|\vec v\|} \right)$$

As far as I can see, this doesn't violate any of the inner product axioms, but it breaks the link between our intuition of vectors as "oriented lengths".

Is there an ironclad reason (other than not wishing to go against geometric intuition) that the angle between vectors must be defined as $\cos^{-1} (\vec u \cdot \vec v\ /\ \|\vec u\|\|\vec v\|)$? Or, is it instead the case that there is no unique definition of the angle?

  • $\begingroup$ Are you sure theat linearity holds? $\endgroup$
    – Randall
    Commented Aug 31, 2021 at 14:25
  • 2
    $\begingroup$ In an abstract space we could identify $\frac{u \cdot v}{\| u \| \| v |}$ with any function taking values in $[-1,1]$, but it does in fact coincide with $\cos(\theta)$ in the cases where we have another way to define $\cos(\theta)$. This is an argument for defining it to be $\cos(\theta)$ when we have no prior notion of geometry. $\endgroup$
    – Ian
    Commented Aug 31, 2021 at 14:30
  • 3
    $\begingroup$ $\mathbb{R}^2$ and $\mathbb{R}^3$, really. $\endgroup$
    – Ian
    Commented Aug 31, 2021 at 14:34
  • 2
    $\begingroup$ Well no, we can define things however we want as long as we're consistent. It is motivated by our prior knowledge of geometry in two and three dimensions. $\endgroup$
    – Ian
    Commented Aug 31, 2021 at 14:38
  • 7
    $\begingroup$ You can. It is just the same as using different 'unit' for measuring an angle. As a concrete example, defining $$\theta=\frac{180}{\pi}\arccos\left(\frac{\vec{u}\cdot\vec{v}}{\|\vec{u}\|\vec{v}\|}\right) $$ gives the angle measured in degrees. As long as the unit conversion is consistently applied, nothing will be contradictory. $\endgroup$ Commented Aug 31, 2021 at 14:40

3 Answers 3


The reason why the formula for angle is the way it is happens to be due to the law of cosines. For any two independent vectors, say $u$ and $v$, you can represent the subspace formed by their span as a plane with coordates $[x,y]=xu + yv$ . So you can form a triangle in the coordinate representation for this plane. You can connect the end points with a third vector, the difference between the two $u-v$. Then from the law of cosines,

$|u-v|^2 = |u|^2 + |v|^2 - 2|u||v| \cos(\theta) $

The left hand side is

$|u-v|^2 = <u-v,u-v> = |u|^2 - 2<u,v> + |v|^2 $

So you can cancel the common terms with the right hand side to find

$-2<u,v> = -2|u||v|\cos(\theta) $

Then $\cos(\theta) = \frac{<u,v>}{|u||v|}$.

Essentially, the "angle" between two vectors regardless of what your definition of vectors are or what your inner product is comes down to planar trig in the coordinate space spanned by them. The reason this works is because the inner product in terms of coordinates becomes the dot product after finding an orthonormal basis to the for the coordinate space.

  • $\begingroup$ I see... so for a vector field, there is a 1-1 mapping between any vector and a point in R^n (the coordinates for that vector). So when we talk about the "angle between vectors" what we really mean is "the angle between points in the coordinate space". In which case our notions of geometry still apply, and different ways of assigning coordinates to vectors could change the measured "angle" between two vectors. Is this right? $\endgroup$ Commented Feb 1, 2023 at 14:17
  • $\begingroup$ Not necessarily. A vector may not have a finite representation, i.e. something like a vector in R^n. For example, you usually cannot represent a continuous function as a coordinate in R^n in general. But for a finite number of independent vectors say $u_1, ... , u_n$, you can take the combation $v= r_1 u_1 +... + r_n u_n$ and represent the combination as a coordinate in terms of its coefficients $(r_1,...,r_n)$. So you can represent the span of n independent vectors in any real vector space as R^n. So for finite dimensional subspaces of Hilbert Spaces, Euclidean geometry can be applied. $\endgroup$
    – Doge Chan
    Commented Feb 1, 2023 at 18:33

Let me give you a simple reason why we define the angle between the vectors $u$ and $v$ as $\theta = \cos^{-1} \left(\frac{u \cdot v }{\lVert u \rVert \lVert v \rVert}\right)$.

When we have defined an inner product in a vector space, we also have a notion of orthogonality: we say that $u$ and $v$ are orthogonal iff $\langle u,v\rangle =0$.

Substituting this in the formula for $\theta$, we get that the angle between orthogonal points $u$ and $v$ is $\pi/2$, so this really looks like a generalization of orthogonality.

  • $\begingroup$ (edit: this is a mistake) Not sure I understand what you mean. If the inner product of $\vec u$ and $\vec v$ is 0 (i.e. they are orthogonal) the angle $\theta$ still comes back as zero. $\endgroup$ Commented Aug 31, 2021 at 14:31
  • $\begingroup$ This doesn't answer OP's question about generalizing the angle and maintaining an inner product. $\endgroup$
    – Randall
    Commented Aug 31, 2021 at 14:32
  • 1
    $\begingroup$ @MarcoMerlini $cos^{-1}(0)= \frac{\pi}{2}$. $\endgroup$
    – Amelian
    Commented Aug 31, 2021 at 14:33
  • 1
    $\begingroup$ @Randall It's not that bad an answer: the argument is similar to Ian's comment above, i.e., it does look like orthogonality in cases where the angle is not defined by other means. Maybe it should be stated more clearly. $\endgroup$ Commented Aug 31, 2021 at 14:34
  • 3
    $\begingroup$ If you are focused on orthogonality, the problem arises on the other end: when the inverse cosine gives you $\pi/10$, your notion of angle with this extra $5$ makes it look like the vectors should be perpendicular (since there is an "angle" of $\pi/2$ between them) even though they are not orthogonal. $\endgroup$
    – Ian
    Commented Aug 31, 2021 at 14:37


  1. The notion of angle arrives only when you have a geometric concept.

The function $\cos(x)$ came from geometry, but its concept was extended and the cosine of a complex number doesn't make any geometric sense, at least for me

$$\cos (i) = \cos \left(\sqrt{-1}\right) = \cosh 1 = \dfrac{e + \frac{1}{e}}{2} \approx 1.54 $$

  1. The concept of inner product arrives only when you define it, and you can have it without geometry.

You can define the inner product of two vectors (which have geometric sense):

$$\langle \vec{u}, \ \vec{v}\rangle = \sum_{i} u_i \cdot v_i$$

But you can also define the inner product of two functions $f$ and $g$ (which don't have a geometric sense)

$$\langle f, \ g\rangle = \int_{-1}^{1} f \cdot g \ dx$$

If you get something like that

$$\langle \vec{u}, \ \vec{u}\rangle = \|\vec{u}\|\|\vec{u}\| \cdot \cos \theta \label{1}\tag{1}$$

It's implicit that it's about a geometric problem, cause of the similarity with the law of cosines.

But if you want to generalize the law of cosines, it's up to you to say what $\cos \theta$ means:

$$\cos \theta = \dfrac{\langle u, \ v \rangle}{\sqrt{\langle u, \ u\rangle} \cdot \sqrt{\langle v, \ v \rangle}}$$

So, in $\mathbb{R}^{2}$ and $\mathbb{R}^{3}$, $\theta$ is indeed an angle, but for $\mathbb{R}^{n}$ the concept of geometry (the euclidean geometry's sense) is vague, which implies that the concept of an angle in $\mathbb{R}^{n}$ is also vague. What comes from the equations are mathematical generalizations.

The notion of an angle:

An angle, using Euclidean geometry, is the aperture between two rays $l_1$ and $l_2$. The way to translate this aperture from geometry to algebra is by giving this angle a value $\theta$. The way we measure it depends on the definition, for example:

  • Using radians
    • $l_2 \equiv l_1 \Rightarrow \theta = 0$
    • $l_2 \perp l_2 \Rightarrow \theta = \dfrac{\pi}{2}$
  • Using degrees
    • $l_2 \equiv l_1 \Rightarrow \theta = 0$
    • $l_2 \perp l_2 \Rightarrow \theta = 90$

In the same way that we translated the aperture to a numeric value, many things from geometry were transformed into algebra. For example, the function $\cos(\alpha)$ was created to relate the ratio of a segment's projection into a line:

$$\cos \alpha = \dfrac{b}{h}$$

enter image description here

Rhetorical question 1: If $b$ is always positive, why does the function $\cos (\alpha)$ gives negative values? Rhetorical question 2: For complex numbers, why does $\cos \left(\sqrt{-1}\right) > 1$?

Coordinate system:

To treat geometry in a more algebraic way, Analytic Geometry was created, normally to work on a euclidean space.

  • Points ($0$ dimensional entity) are described using coordinates: $$\vec{p} = \left(p_x, \ p_y, p_z\right)$$
  • Lines ($1$ dimensional entity) are described using a point $\vec{p}_0$, a direction vector $\vec{v}$ and a scalar parameter $t$: $$\vec{p}(t) = \left(p_{0x} + t \cdot v_{x}, \ p_{0y} + t \cdot v_{y}, \ p_{0z} + t \cdot v_{z}\right) := \vec{p}_0 + t \cdot \vec{v}$$
  • Plane ($2$ dimensional entity) are described using a point $\vec{p}_0$, two direction vector $\vec{u}$ and $\vec{v}$, and two scalar parameter $t$ and $\mu$: $$\vec{p}(t) := \vec{p}_0 + t \cdot \vec{v} + \mu \cdot \vec{u}$$

PS: I use the notation $\vec{p}$ to explicit say that $\vec{p}$ has more than one scalar value inside.

For example, we represent a triangle $ABC$ using coordinates. The point $B$ is made by the vector $\vec{u}$ and the point $A$ is made by the vector $\vec{v}$. $$\|\vec{u}\| = a \ \ \ \ \ \ \ \ \ \ \ \ \ \ \|\vec{v}\| = b$$

enter image description here

The Law of cosines from geometry

$$c^2 = a^2 + b^2 - 2ab \cdot \cos \theta\label{2}\tag{2}$$

is translated to

$$\|\vec{u}-\vec{v}\|^2 = \|\vec{u}\|^2 + \|\vec{v}\|^2 - 2\langle \vec{u}, \vec{v} \rangle \label{3}\tag{3}$$

There's a similarity between \eqref{2} and \eqref{3}, which seems to be

$$ab \cdot \cos \theta = \langle \vec{u}, \ \vec{v}\rangle$$

Perpendicular vs Orthogonal

From \eqref{3} we can relate the notion of inner product into the angle of two lines $l_1$ and $l_2$:

$$\vec{u} = (u_x, \ u_y, \ u_z)$$ $$\vec{v} = (v_x, \ v_y, \ v_z)$$ $$l_1: \left\{\left(t u_x, \ t u_y, \ t u_z\right) \in \mathbb{R}^{3} : t \in \mathbb{R}\right\}$$ $$l_2: \left\{\left(t v_x, \ t v_y, \ t v_z\right) \in \mathbb{R}^{3} : t \in \mathbb{R}\right\}$$

  • $l_1 \equiv l_2 \Rightarrow \langle \vec{u}, \ \vec{v}\rangle = \|\vec{u}\|\cdot \|\vec{v}\|$
  • $l_1 \perp l_2 \Rightarrow \langle \vec{u}, \ \vec{v}\rangle = 0$

But the inverse can also be true:

  • $\langle \vec{u}, \ \vec{v}\rangle = \|\vec{u}\|\cdot \|\vec{v}\| \Rightarrow l_1 \equiv l_2$
  • $ \langle \vec{u}, \ \vec{v}\rangle = 0 \Rightarrow l_1 \perp l_2$

Which brings the question: What comes first? Linear algebra can be thought of as a generalization of Analytic Geometry, then if I find $\langle \vec{u}, \ \vec{v} \rangle = 0$ somewhere, it seems that $\vec{u}$ and $\vec{v}$ are perpendicular even if they don't represent lines?

The idea of perpendicularity ($l_1 \perp l_2$) exists only for geometry. But in linear algebra, there is a concept of orthogonality which is the generalization of the geometric notion of perpendicularity

$$l_1 \perp l_2 \Leftrightarrow l_1 \ \text{is perpendicular to} \ l_2$$ $$\langle \vec{u}, \ \vec{v} \rangle = 0 \Leftrightarrow \vec{u} \ \text{is orthogonal to} \ \vec{v}$$

The concept of orthogonal is more powerful than perpendicular, and it doesn't apply only to vectors. Saying two things are orthogonal is not the same as saying they are perpendicular, cause perpendicular arrives only when the concept of geometry exists.

For example, saying two functions $f$ and $g$ are perpendicular is vague, but saying $f$ and $g$ are orthogonal makes sense:

$$\langle f, \ g \rangle = 0 \Leftrightarrow \int_{\Omega} f \cdot g \ d\Omega = 0$$ This concept is used for Fourier transform:

$$\langle \cos \left(m \pi x\right), \ \cos \left(n \pi x\right) \rangle = \int_{-1}^{1} \cos \left(m \pi x\right) \cos \left(n \pi x\right) \ dx = \delta_{mn} = \begin{cases} 1 \ \ \ \text{if} \ m = n \\ 0 \ \ \ \text{else}\end{cases}$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .