MathOverflow is a question and answer site for professional mathematicians. 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

This came up in a practical problem (physics).

In the following, we work with real numbers only, and consider every vector to be normalized to 1.

To find how "similar" two vectors are (actually, two lines passing through the origin, I don't care about the direction), one can use the scalar product. If the two lines are the same, then the scalar product of the corresponding vectors is 1 or -1. If they are "similar", it's close to 1. If they're perpendicular, it's 0.

I need a generalization of this "similarity measure" to $k$-dimensional subspaces.

For example, for $k=2$ I have the following problem: I have vectors $a_1 \perp a_2$ which define a plane in an $n$-dimensional space, and vectors $b_1 \perp b_2$. I need a measure that 1. tells me how close these planes are to each other, in terms of $a_1, a_2, b_1, b_2$. is a generalization of the simple scalar product (i.e. it's the same as the scalar product for $k=1$).

share|cite|improve this question
up vote 4 down vote accepted

Let $V$ be an $n$-dimensional real vector space with an inner product $\langle \cdot,\cdot \rangle$. Then $\Lambda^k (V)$, the $k^{\text{th}}$ exterior product of $V$, inherits an induced inner product defined as follows.

If $\alpha = v_1 \wedge \cdots \wedge v_k$ and $\beta = w_1 \wedge \cdots \wedge w_k$, then $\langle \alpha , \beta \rangle = \det \langle v_i , w_j \rangle$ on decomposable vectors, and then extend by linearity to all of $\Lambda^k(V)$. Now a $k$-dimensional subspace $P$ of $V$ can be represented by a decomposable element $\alpha_P = v_1 \wedge \cdots \wedge v_k$ of $\Lambda^k(V)$, where $v_1, \ldots, v_k$ is a basis for $P$. If the basis is taken to be oriented and orthonormal, then the element $\alpha_P$ is uniquely determined. (Otherwise it is only determined up to a non-zero real scalar, so in general it defines a point in the projectivization $\mathbb P (\Lambda^k(V))$. Since this is a real inner product on a finite-dimensional vector space, it does indeed give you a measure of "how far" two vectors are from being parallel, or in this case, how far two $k$-dimensional subspaces are from being the same.

If $k = 2$ and $a_1, a_2$ and $b_1, b_2$ are two oriented orthonormal bases for two planes $P_a$ and $P_b$ in $V$, then

$$ \langle P_a, P_b \rangle = \det{\langle a_i, b_j \rangle} = \langle a_1, b_1 \rangle \langle a_2, b_2 \rangle - \langle a_1, b_2 \rangle \langle a_2, b_1 \rangle. $$

You can search for "induced inner product on exterior algebra" or look at any book on differential forms for more details.

share|cite|improve this answer
@Spiro, thank you, this is also a very useful answer. Are you aware of any more or less intuitive ways to picture/interpret this measure? (Or some useful properties of it, in particular: what happens when both $P_a$ and $P_b$ are extended to $k+1$ dimensions by adding one more vector to their orthonormal bases? This will depend on the relationship of the two extra vectors used to extend $P_a$ and $P_b$.) – Szabolcs May 31 '11 at 13:13
You should "visualize" this exactly as you do the inner product on $V$. We've just replaced the space $V$ with $\Lambda^k(V)$, but we still have a positive definite inner product on a finite dimensional real vector space, so all the same "geometric intuition" still applies. The two $k$-dimensional subspaces are "close" if their inner product is close to 1 or -1 (with the opposite orientation) and "far" if their inner product is close to 0. – Spiro Karigiannis May 31 '11 at 19:09
@Spiro, thanks! However, $\langle P'_a , P'_b \rangle = \langle P_a, P_b \rangle \, \langle a', b' \rangle$ is not correct (successively building a subspace by adding new basis vectors would result in a simple product (not determinant) for the final formula). Unfortunately I don't think there exists a reasonably simple expression for this. – Szabolcs May 31 '11 at 22:05
oops. I was implicitly assuming that $b'$ was orthogonal to $P_a$ and that $a'$ was orthogonal to $P_b$, which of course they do not need to be. (If they are, then the formula above is correct, since one gets a block diagonal matrix with one $k \times k$ block and one $1 \times 1$ block. You are correct, in general the formula is more complicated. I will delete that one of my two above comments. – Spiro Karigiannis Jun 1 '11 at 22:47

There is a very simple way to do this which is to consider the projector onto each subspace, $\Pi_A$ and $\Pi_B$, where we have $$\Pi_A = \sum_j a_j a_j^T$$ and similarly for $\Pi_B$. Since all of your vectors spanning your subspace are orthogonal and normalized, this is indeed a rank-$k$ projector. Then you can just consider the Hilbert-Schmidt inner product, $$\langle A , B \rangle = \mathrm{Tr}(A^T B)$$ and this will give you a measure of how similar the two spaces are. If you first divide each projector by the square root of it's rank, then this quantity is normalized so that it is 1 if and only if the two subspaces are equal.

share|cite|improve this answer
Actually, this reduces to the squared inner product when $k=1$. So perhaps this isn't what you want. – Steve Flammia May 30 '11 at 13:58
@Steve, thanks. I managed to find a semi-intuitive interpretation for this. Take a unit vector in subspace $A$, project it to subspace $B$, then re-project it to $A$. Its magnitude will be reduced by a certain factor depending on the direction of the unit vector. Your measure is the average of these factors. For my practical application it seems to be more useful to take the smallest factor, i.e. the $k$-th eigenvalue of $\Pi_A \Pi_B$, but the application is beyond the scope of the question. – Szabolcs May 31 '11 at 11:14
The "problem" with this measure is that it gives very high (i.e. close to 1) values when the intersection of the subspaces is large, but the remaining parts (after intersection) are (near-)orthogonal. Taking the smallest factor solves this. – Szabolcs May 31 '11 at 13:20

The set of all $k$-dimensional subspaces of $\mathbb{R}^n$ is called Grassmannian $\mathrm{Gr}(k,n)$ and can be given a structure of a smooth manifold. That gives you a topological notion of nearness, but there is more. There is a homogeneous Riemannian metric on this manifold that can be expressed quite explicitly - details can be found in this article by Yuri Neretin. Or you can try this one by Sheng Jiang which may be more accessible for you.

share|cite|improve this answer

Let $V$ be an inner product space. The tensor product $V^{\otimes k}$ is equipped with an inner product induced from that of $V$ (obtained by contracting via the inner product $k$ times). Concretely, if $e_1, ... e_n$ is an orthonormal basis for $V$ then all sequences of tensor products of the $e_i$ form an orthonormal basis for $V^{\otimes k}$. Now, $V^{\otimes k}$ has a canonical subspace, the space of antisymmetric tensors $\text{Alt}^k(V)$ (not to be confused with the exterior power, which is a quotient of $V^{\otimes k}$ rather than a subspace), and the above inner product induces an inner product on antisymmetric tensors. Finally, given an orthonormal basis $f_1, ... f_k$ of a $k$-dimensional subspace $W$ of $V$, the antisymmetrization

$$f_1 \wedge ... \wedge f_k = \frac{1}{\sqrt{k!}} \sum_{\sigma \in S_k} \text{sgn}(\sigma) f_{\sigma(1)} \otimes ... \otimes f_{\sigma(k)}$$

associates to $W$ an element of $\text{Alt}^k(V)$ invariant up to oriented change of orthonormal basis. I think the inner product of these elements has the property you want.

share|cite|improve this answer
You beat me to it by 22 seconds. I should learn to TeX faster... – Spiro Karigiannis May 30 '11 at 13:31

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.