A real vector space only records addition and scalar multiplication. Rn has another important piece of structure: the distance between points and the property of vectors being orthogonal to each other. This note abstracts that structure.
1. The scalar product on Rn
Definition. The scalar product of v,w∈Rn is
⟨v,w⟩:=vTidw=vTw=v1w1+⋯+vnwn.
(Not to be confused with the scalar multiple of a vector, which is again a vector.)
Example. The scalar product can be positive, zero or negative. With v=(12):
so the scalar product of a vector with itself is non-negative, and
∥v∥:=⟨v,v⟩=v12+⋯+vn2
is a well-defined real number, the norm of v.
Lemma 1. The norm ∥v∥ is the length of the segment from the origin to v. For v,w∈R2,
∥v−w∥2=∥v∥2+∥w∥2−2∥v∥∥w∥cosθ,
where θ is the angle between v and w.
Proof. The formula for the norm follows by repeatedly applying the Pythagorean theorem. For n=3, the segment from O=(0,0,0) to (v1,v2,0) has length v12+v22; the segment from O to v=(v1,v2,v3) is the hypotenuse of a right triangle with legs of length v12+v22 and ∣v3∣, hence has length (v12+v22)2+v32=v12+v22+v32. The formula for ∥v−w∥2 is a reformulation of the law of cosines in the triangle with sides v, w, v−w. □
v - w
v <-------- w triangle with vertices O, v, w:
\ / sides ||v||, ||w||, ||v-w||,
\ / angle theta at O between v and w
||v|| \ th / ||w||
\ /
\ /
O
Scalar product with respect to a matrix. For A∈Matn×n define
⟨⋅,⋅⟩A:Rn×Rn→R,⟨v,w⟩A:=vTAw.
Here vT is a row vector (1×n), so vTAw is a 1×1 matrix, i.e. a real number.
Lemma 2 (fundamental properties of the scalar product).
Bilinearity: for fixed w, the maps v↦⟨v,w⟩ and v↦⟨w,v⟩ are linear; e.g. ⟨rv+r′v′,w⟩=r⟨v,w⟩+r′⟨v′,w⟩ for r,r′∈R, v,v′∈Rn.
Symmetry:⟨v,w⟩=⟨w,v⟩.
Proof.w↦vTw is linear (it is multiplication of a vector by a fixed matrix); linearity in the other argument is similar or follows from symmetry. For symmetry use (vTw)T=wT(vT)T=wTv, and note that a 1×1 matrix equals its transpose: the left side is ⟨v,w⟩, the right side is ⟨w,v⟩. □
Comparing with the law of cosines (Lemma 1) we get
⟨v,w⟩=∥v∥∥w∥cosθ.
The factor cosθ vanishes precisely when θ=±2π (±90∘). So ⟨v,w⟩=0 if the angle between v and w is 90∘, which motivates:
Definition. Two vectors v,w∈Rn are orthogonal if ⟨v,w⟩=∑i=1nviwi=0.
2. Positive definite matrices
Definition and Lemma. If A is a symmetricn×n matrix (A=AT), then ⟨v,w⟩A=vTAw is bilinear and symmetric, i.e. Lemma 2 holds verbatim for ⟨,⟩A (the standard scalar product is the case A=idn).
(Symmetry: ⟨v,w⟩A=(vTAw)T=wTATv=wTAv=⟨w,v⟩A.)
Example (Minkowski form). For A=100001000010000−1 we get Aw=(w1,w2,w3,−w4)T and
⟨v,w⟩A=vTAw=v1w1+v2w2+v3w3−v4w4.
This is the basis of Minkowski space of special relativity, R3,1 (3 space coordinates, 1 time coordinate). The standard basis vectors e1,…,e4 are orthogonal to each other, but ⟨e4,e4⟩A=−1 whereas ⟨ek,ek⟩A=1 for the other three: the form distinguishes the last direction from the others.
Definition. A symmetric matrix A is
positive definite if ⟨v,v⟩A>0 for all v∈Rn, v=0. Then we define the norm with respect to A: ∥v∥A:=⟨v,v⟩A;
negative definite if ⟨v,v⟩A<0 for all v=0;
indefinite if there exist v,w with ⟨v,v⟩A>0 and ⟨w,w⟩A<0.
idn is positive definite by (1). The Minkowski matrix is indefinite: ⟨e1,e1⟩A=1>0 and ⟨e4,e4⟩A=−1<0.
The following criterion tests positive definiteness without examining all vectors. For a square matrix A the principal submatrix of size r is A(r)=(aij)1≤i,j≤r, i.e. the first r rows and columns of A.
Proposition (criterion). Let A be a symmetric n×n matrix. The following are equivalent:
the bilinear form ⟨,⟩A is positive definite;
A is positive definite;
det(A(r))>0 for all 1≤r≤n.
In particular a positive definite matrix has detA>0, hence is invertible. (A proof of the criterion requires the methods of Section 3 and is not given here.)
Example. Let A=12t258t814, t∈R. We have detA(1)=1>0 and detA(2)=det(1225)=1>0, and
detA=detA(3)=−5t2+32t−50.
For t=3 this equals −45+96−50=1>0, so A is positive definite. For t=4 it equals −80+128−50=−2<0, so A is not positive definite; in fact it is indefinite (a negative determinant means an odd number of negative eigenvalues, and an eigenvector w for a negative eigenvalue μ has ⟨w,w⟩A=μ∥w∥2<0, while ⟨e1,e1⟩A=1>0).
Application in analysis. For a twice differentiable f:R2→R one considers the Hessian matrix of second partial derivatives. For f(x,y)=x2+y2 it is (2002), positive definite; for g(x,y)=x2−y2 it is (200−2), indefinite. In analysis one proves that, at a point where both first partial derivatives vanish, positive definiteness of the Hessian implies a local minimum. So f has a local minimum at (0,0) (moving in any direction increases f), but g does not: g has a saddle point at (0,0), increasing in the x-direction and decreasing in the y-direction.
3. Euclidean spaces
Definition. A Euclidean vector space is a real vector space V together with a map ⟨,⟩:V×V→R that is
bilinear (⟨v,⋅⟩ and ⟨⋅,v⟩:V→R are linear for every v∈V),
symmetric (⟨v,w⟩=⟨w,v⟩),
positive definite (⟨v,v⟩>0 for every v=0).
The map is also called the scalar product on V. Vectors v,w are orthogonal, written v⊥w, if ⟨v,w⟩=0. The norm is ∥v∥:=⟨v,v⟩(≥0) and the distance between v,w is d(v,w):=∥v−w∥.
Examples.
Rn with the standard scalar product is a Euclidean space. More generally, for a symmetric positive definite matrix A, Rn with ⟨,⟩A is a Euclidean space. This abstract definition turns the key properties of Rn with its scalar product into a definition, just as a vector space abstracts the key properties of Rn.
If (V,⟨,⟩) is Euclidean, so is every subspace of V. In particular every subspace of Rn (e.g. any plane in R3) is a Euclidean space.
The vector space C=C([−1,1]) of continuous functions f:[−1,1]→R with
⟨f,g⟩:=∫−11f(x)g(x)dx
is an (infinite-dimensional) Euclidean space, of fundamental importance in analysis. Bilinearity and symmetry come from elementary properties of the integral.
On V=Rn, ⟨v,w⟩:=v1w1+⋯+vn−1wn−1−vnwn is bilinear and symmetric but not positive definite, hence not a scalar product.
Proposition. Let (V,⟨,⟩) be Euclidean, v∈V, r∈R. Then (1) ∥v∥≥0; (2) ∥v∥=0⟺v=0; (3) ∥rv∥=∣r∣∥v∥.
Proof. (1) and (3) are immediate (∥rv∥2=⟨rv,rv⟩=r2⟨v,v⟩). (2) holds because ⟨,⟩ is positive definite. □
Throughout the rest of this note (V,⟨,⟩) is a Euclidean vector space.
Lemma 3 (one direction). Let e∈V with ∥e∥=1 and let v∈V. Then
v~:=v−⟨v,e⟩e
is orthogonal to e, and
v=v~+⟨v,e⟩e(2)
expresses v as the sum of a scalar multiple of e and a vector orthogonal to e.
Proof. By bilinearity:
⟨v~,e⟩=⟨v−⟨v,e⟩e,e⟩=⟨v,e⟩−⟨v,e⟩1⟨e,e⟩=0.
Equation (2) is obvious from the definition of v~. □
3.1 Orthogonal complement
Definition and Lemma. The orthogonal complement of a subset M⊆V is
M⊥:={v∈V∣⟨v,m⟩=0 for all m∈M}.
It is a subspace of V. For a subspace W,
W∩W⊥={0}.(3)
(Equation (3) says that the zero vector is the only element of W orthogonal to all of W; it follows from positive definiteness, specifically Proposition (2): if w∈W∩W⊥, then ⟨w,w⟩=0, so w=0. Colloquially, when W gets larger, W⊥ gets smaller; Corollary 2 below makes this precise.)
Example. Let W=L((1,2,4),(1,1,0))⊆R3. A vector x=(x1,x2,x3) is orthogonal to W iff it is orthogonal to v1=(1,2,4) and v2=(1,1,0) (by linearity of ⟨x,⋅⟩):
x⊥v1⟺x1+2x2+4x3=0,x⊥v2⟺x1+x2=0.
Solving the homogeneous system
(112140)⇝(102−14−4)⇝(102144)
shows that x3 is free, x2=−4x3, x1=4x3, so
W⊥=L((4,−4,1)).
3.2 Orthonormal systems and orthogonal projection
Definition. A family v1,…,vn is an orthonormal system if ∥vi∥=1 (i.e. ⟨vi,vi⟩=1) for all i, and vi⊥vj (i.e. ⟨vi,vj⟩=0) for all i=j. If in addition they form a basis of V, it is an orthonormal basis. The standard basis of Rn is an orthonormal basis for the standard scalar product. A system with only the orthogonality condition is an orthogonal system.
Theorem (orthogonal projection). Let u1,…,un be an orthonormal system and U=L(u1,…,un)⊆V. Then there is a unique linear map p:V→U, the orthogonal projection onto U, such that
p(u)=u for all u∈U;
p(v)−v∈U⊥ for all v∈V.
In particular every v∈V can be written as
v=∈Up(v)+∈U⊥(v−p(v)),
and this is the unique way to write v as a sum of a vector in U and a vector in U⊥. The map is
p(v)=k=1∑n⟨v,uk⟩uk.(4)
More generally, if u1,…,un is an orthogonal system (not necessarily normalized, all uk=0), then
p(v)=k=1∑n⟨uk,uk⟩⟨v,uk⟩uk(5)
is the orthogonal projection onto U=L(u1,…,un).
v
/|
/ | v - p(v) (in U-perp)
/ |
----O---p(v)------- U (a plane or line through O)
Example. In R3 take u1=(1,0,0), u2=(0,1,0), an orthonormal system. Then U is the xy-plane and U⊥=L((0,0,1)) is the z-axis. The projection sends v=(x,y,z) to p(v)=⟨v,u1⟩u1+⟨v,u2⟩u2=xu1+yu2=(x,y,0).
Proof. The map p of (4) is linear because ⟨⋅,uk⟩ is linear. It satisfies (1) and (2): one checks this using that the uk form an orthonormal system, exactly as in Lemma 3 (e.g. ⟨p(v)−v,ul⟩=∑k⟨v,uk⟩⟨uk,ul⟩−⟨v,ul⟩=⟨v,ul⟩−⟨v,ul⟩=0 for each l, hence p(v)−v⊥U).
Uniqueness of p. If q:V→U is another map with (1) and (2), then for all v∈V and u∈U⟨p(v)−q(v),u⟩=⟨∈U⊥(p(v)−v)−(q(v)−v),u⟩=0.
Since q(v),p(v)∈U, the vector p(v)−q(v) lies in U; taking u=p(v)−q(v) shows it is orthogonal to itself, so it is zero by (3). Hence p=q.
Uniqueness of the decomposition.v=p(v)+(v−p(v)) is such a representation. If v=u′+u′′ with u′∈U, u′′∈U⊥ is another, then u:=p(v)−u′=u′′−(v−p(v)) lies in U (left side) and in U⊥ (right side), so u=0 by (3); thus u′=p(v) and u′′=v−p(v).
Formula (5). For an orthogonal system uk, apply (4) to the orthonormal system uk/∥uk∥: ∥uk∥2⟨v,uk⟩uk. □
Corollary 1 (coordinates in an orthonormal basis). If u1,…,un is an orthonormal system that spans V, then
for every v∈Vv=k=1∑n⟨v,uk⟩uk;(6)
the vectors are necessarily linearly independent, i.e. an orthonormal basis.
Proof. Apply the theorem with U=V: then p=id and (4) gives (6). For independence suppose 0=∑kakuk and apply ⟨⋅,ul⟩ (any 1≤l≤n):
0=⟨0,ul⟩=k∑ak⟨uk,ul⟩=al,
since all terms with k=l vanish and ⟨ul,ul⟩=1. □
Example. For the standard basis of Rn and v=(v1,…,vn) we have ⟨ei,v⟩=vi, and (6) is the usual expansion v=v1e1+⋯+vnen. In general (6) is a convenient way of computing the coordinates of a vector with respect to an orthonormal basis: no linear system has to be solved, just scalar products.
Corollary 2. If U⊆V is a subspace of a finite-dimensional Euclidean space, then
dimU⊥=dimV−dimUandU=(U⊥)⊥.
Proof sketch. By the theorem every v decomposes uniquely as u+u′ with u∈U, u′∈U⊥, and U∩U⊥={0}: so V=U⊕U⊥ and the dimension formula follows. Every u∈U is orthogonal to all of U⊥, so U⊆(U⊥)⊥, and both have dimension dimV−dimU⊥=dimU, hence they agree. □
3.3 Gram-Schmidt orthogonalization
Proposition (Gram-Schmidt). Let v1,…,vr be linearly independent vectors in a Euclidean space. Define inductively
Then w1,…,wr is an orthonormal system and L(v1,…,vr)=L(w1,…,wr). In particular, if the vi form a basis, so do the wi (an orthonormal basis). Hence every finite-dimensional Euclidean space has an orthonormal basis.
Proof. In each step wr′ is constructed to be orthogonal to w1,…,wr−1 (it is vr minus its orthogonal projection (4) onto L(w1,…,wr−1)). Dividing by the norm makes ∥wr∥=1; this is possible since wr′=0 (otherwise vr would be a combination of w1,…,wr−1, hence of v1,…,vr−1, contradicting linear independence), so ∥wr′∥>0 by positive definiteness. At each step L(v1,…,vk)=L(w1,…,wk) because wk is a combination of vk and w1,…,wk−1 with nonzero coefficient on vk. □
Example. Standard scalar product on R2, v1=(11), v2=(21) (a basis of R2):
Geometrically w2′ is the vector on the line {v2+aw1} that is orthogonal to w1.
Corollary 3. For a subspace U of a finite-dimensional Euclidean space V there are two unique linear maps, the orthogonal projections pU:V→U and pU⊥:V→U⊥, such that every v∈V satisfies
v=pU(v)+pU⊥(v).(7)
Proof.U has an orthonormal basis (Gram-Schmidt), so the theorem gives pU. Define pU⊥(v):=v−pU(v); then (7) holds and pU⊥(v)∈U⊥ by the theorem; uniqueness of the decomposition is part of the theorem. □
4. Worked examples and computational methods
Task A: orthonormal basis of a subspace U⊆Rn. Compute any basis of U, then apply Gram-Schmidt.
Task B: orthogonal projection pU(x) of x∈Rn. Compute an orthonormal (or just orthogonal) basis u1,…,uk of U (Task A) and use (4) (or (5)): pU(x)=∑i⟨x,ui⟩ui. Alternatively compute U⊥ (Task C), then pU⊥(x) and pU(x)=x−pU⊥(x); this may be easier when dimU>dimU⊥.
Task C: orthogonal complement of U⊆Rn. Take a basis u1,…,uk of U and solve the homogeneous system ⟨x,u1⟩=0,…,⟨x,uk⟩=0; equivalently, form the matrix whose rows are u1,…,uk and compute its kernel.
Example 1 (Legendre polynomials). Let V=P≤2={at2+bt+c} with ⟨p,q⟩=∫−11p(x)q(x)dx, and the basis e1=1, e2=t, e3=t2. Scalar products:
So (21,23t,410(3t2−1)) is an orthonormal basis; such polynomials are called Legendre polynomials.
Example 2 (projection onto a plane in R3).U={x−y+3z=0}⊆R3, t=(0,1,5).
Basis of U. With free parameters y=a, z=b: x=a−3b, so U={(a−3b,a,b)}=L((1,1,0),(−3,0,1)).
Complement. The equation says U=L((1,−1,3))⊥, hence by Corollary 2, U⊥=L((1,−1,3)) and dimU⊥=1=3−2.
Projection via Gram-Schmidt.v1=(1,1,0), and v2′=v2−⟨v1,v1⟩⟨v2,v1⟩v1=(−3,0,1)+23(1,1,0)=(−23,23,1) (orthogonal to v1). Then by (5), with ⟨t,v1⟩=1, ⟨v1,v1⟩=2, ⟨t,v2′⟩=23+5=213, ⟨v2′,v2′⟩=49+49+1=211:
Example 3 (projection in R4).W={x−t=0,y+z−t=0}⊆R4 (coordinates x,y,z,t), u=(1,5,1,6).
Basis of W.x=t, y=t−z; with z=a, t=b we get (b,b−a,a,b)=a(0,−1,1,0)+b(1,1,0,1). So v1=(0,−1,1,0), v2=(1,1,0,1).
Complement. Impose ⟨x,v1⟩=0, ⟨x,v2⟩=0: −y+z=0, x+y+t=0. With x=a, y=b: z=b, t=−a−b, so W⊥=L((1,0,0,−1),(0,1,1,−1)).
Projection. Orthogonalize: ⟨v2,v1⟩=−1, so v2′=v2−2−1v1=(1,21,21,1); to avoid fractions take w2=2v2′=(2,1,1,2), still orthogonal to v1. By (5): ⟨u,v1⟩=−4, ⟨v1,v1⟩=2, ⟨u,w2⟩=20, ⟨w2,w2⟩=10, so
Scalar product on Rn.⟨v,w⟩=vTw=∑viwi. Bilinear, symmetric, ⟨v,v⟩=∑vi2≥0. Norm ∥v∥=⟨v,v⟩. ∥v−w∥2=∥v∥2+∥w∥2−2⟨v,w⟩, so ⟨v,w⟩=∥v∥∥w∥cosθ. Orthogonal: ⟨v,w⟩=0.
Matrix scalar product. For symmetric A: ⟨v,w⟩A=vTAw is bilinear and symmetric. A is positive definite if ⟨v,v⟩A>0 for all v=0 (negative definite: <0; indefinite: both signs occur). Criterion: A is positive definite ⟺detA(r)>0 for all r=1,…,n, where A(r) is the top-left r×r block. Positive definite ⇒detA>0⇒A invertible. Example: diag(1,1,1,−1) (Minkowski) is indefinite; Hessian of x2+y2 is positive definite (local minimum), of x2−y2 indefinite (saddle).
Euclidean space. Vector space with bilinear, symmetric, positive definite ⟨,⟩. Norm, distance d(v,w)=∥v−w∥, ∥rv∥=∣r∣∥v∥, ∥v∥=0⟺v=0. Examples: (Rn,⟨,⟩A) with A symmetric positive definite; subspaces; continuous functions on [−1,1] with ∫fg. Not a scalar product: v1w1+⋯+vn−1wn−1−vnwn.
Orthogonal complement.M⊥={v∣⟨v,m⟩=0∀m∈M} is a subspace; W∩W⊥={0} (positive definiteness); dimU⊥=dimV−dimU and (U⊥)⊥=U. To compute U⊥ in Rn: solve ⟨x,ui⟩=0 for a basis ui of U (kernel of the matrix with rows ui).
Orthonormal basis ⇒ coordinates v=∑⟨v,uk⟩uk (no linear system). An orthonormal system is automatically independent.
Gram-Schmidt. For independent v1,…,vr: wr′=vr−∑k<r⟨vr,wk⟩wk, wr=wr′/∥wr′∥; same span at each step. Hence every finite-dimensional Euclidean space has an orthonormal basis. Example: (1,1),(2,1)↦21(1,1),21(1,−1). Polynomials of degree ≤2 with ∫−11: 21,23t,410(3t2−1).
Typical mistakes.
Using the formula ∑⟨v,uk⟩uk with vectors that are orthogonal but not normalized (the denominators ⟨uk,uk⟩ are then needed).
Applying Gram-Schmidt to dependent vectors (wr′=0 appears), or forgetting to normalize at the end.
Computing ⟨v,w⟩A with a non-symmetric A and assuming symmetry; or declaring A positive definite from only detA>0 (all leading principal minors are needed).
Expecting dimU⊥=dimU (the correct relation is dimU+dimU⊥=dimV).