Skip to main content
Logo image

Section 5.1 Inner product spaces

An inner product is an additional layer of structure we can define on a vector space V. It takes a pair of elements v,wV and returns a scalar v,wR. As with the vector addition and scalar multiplication, we define inner products axiomatically, taking as our model the dot product on R2 and R3. Our definition (5.1.1) simply promulgates a few important properties enjoyed by the dot product that may be familiar to you from studying calculus.
The addition of an inner product enriches the structure of a vector space considerably, and gives rise to a number of additional useful analytic tools. We highlight a few below.
Distance and angle
A notion of distance and angle between two vectors can be defined relative to a given inner product. These provide a numeric measurement of how “close” (distance) or “closely oriented” (angle) two vectors in our space are.
Orthogonality
Two vectors v,wV are orthogonal, relative to a given inner product, if v,w=0. Orthogonality leads further to a general notion of orthogonal projection onto a subspace WV.
Orthogonal bases
An orthogonal basis of a vector space V, relative to a given inner product, is one whose elements are pairwise orthogonal. As we will see there are many computational advantages of working with an orthogonal basis.

Subsection 5.1.1 Inner products

Definition 5.1.1. Inner product.

Let V be a vector space. An inner product on V is an operation that takes as input a pair of vectors v,wV and outputs a scalar v,wR. Using function notation:
 ,:V×VR(v1,v2)v1,v2.
Furthermore, this operation must satisfy the following axioms.
  1. Symmetry.
    For all v,wV we have
    v,w=w,v.
  2. Linearity.
    For all v,w,uV and c,dR we have :
    cv+dw,u=cv,u+dw,u.
    It follows by (i) (symmetry) that
    u,cv+dw=cu,v+du,w.
  3. Positive definiteness.
    For all vV we have
    v,v0, and(positivity)v,v=0 if and only if v=0(definiteness).
An inner product space is a pair (V,,), where V is a vector space, and , is a choice of inner product on V.

Remark 5.1.2. Inner products of linear combinations.

We will have many opportunities to “expand out” an inner product of two linear combinations of vectors. Using axioms (i) and (ii) in series, this process resembles the procedure for multiplying two polynomials. For example, we have
cv+dw,ev+fw=cv,ev+fw+dw,ev+fw(5.1.1,(ii))=cev,v+cfv,w+dew,v+dfw,w(5.1.1,(ii))=cev,v+(cf+de)v,w+dfw,w(5.1.1,(i)).
Note how in the last step we are able to group the “cross terms”, v,w=w,v using the symmetry axiom.
More generally, given linear combinations
v=c1v1+c2v2++cnvn=i=1nciviw=d1v1+d2v2++dnvn=i=1ndivi,
the same reasoning shows that
v,w=c1d1v1,v1+c2d2v2,v2++cndnvn,vn+(c1d2+c2d1)v1,v2+cross terms=i=1ncidivi,vi+1i<jn(cidj+cjdi)vi,vjcross terms.
In particular, we have
v,v=i=1nci2vi,vi+1i<jn2cicjvi,vj.
We now present a series of important examples of inner products defined on our various inner product spaces. Each is presented as a theorem, as we must prove that the proposed operation satisfies the axios of an inner product. The first example, the weighted dot product is itself a vast generalization of the familiar dot product operations defined on R2 and R3.
First we show that axioms (i) and (ii) are satsified for any choice of ki. Let
K=[k1000k2000kn],
the diagonal matrix whose i-th diagonal entry is ki. Then for all x=(x1,x2,,xn),y=(y1,y2,,yn)Rn we have
x,y=xTKy=[x1x2xn]K[y1y2yn].
Here we treat x,y as column vectors, and we treat the resulting 1×1 matrix xTKy as a scalar. Axioms (i)-(ii) now follow from various matrix properties. For linearity, for example, we have
cx1+dx2,y=(cx1+dx2)TKy=(cx1T+dx2T)Ky(2.2.11)=cx1TKy+dx2TKy=cx1,y+dx2,y.
Symmetry requires a little more trickery:
y,x=yTKx=yTKTx(KT=K)=(xTKy)T(Theorem 2.2.11)=xTKy=x,y.
Note that (xTKy)T=xTKy as xTKy is just a 1×1 matrix.
Lastly, we show that axiom (iii) is satisfied if and only if ki>0 for all i. To this end consider the formula
x,x=k1x12+k2x22+knxn2.
If ki>0, then since xi20 for all i, we have x,x0 for any x, and x,x=0 if and only if xi=0 for all i if and only if x=0.
For the other direction suppose ki0 for some i. Let x=ei, the i-th element of the standard basis of Rn. Then x,x=ki0: a counterexample to the definiteness property of axiom (iii).

Definition 5.1.4. (Weighted) Euclidean space.

Fix a positive integer n. Euclidean n-space is the inner product space with underlying vector space Rn and inner product given by the dot product. More generally, a weighted Eulidean space is an inner product space of the form (Rn,,), where , is a weighted dot product.

Example 5.1.5. Dot product on R4.

Let x=(1,2,0,1),y=(1,2,1,1). Then
xy=1+4+0+1=4,
and
xx=1+4+0+1=6.

Example 5.1.6. Weighted dot product.

The dot product with weights 2,1,3 on R3 is defined as
x,y=2x1y1+x2y2+3x3y3.
Let x=(1,1,1) and y=(1,0,1). We have
x,y=2(1)+03=5,
and
x,x=2(1)2+1(1)2+3(1)2=2+1+3=6.

Example 5.1.7. Why the weights must be positive.

Consider the operation on R2 defined as
x,y=(1)x1y1+2x2y2
where x=(x1,x2),y=(y1,y2). This operation satisfies axioms (i) and (ii) of Definition 5.1.1. (See proof of Theorem 5.1.3.) However, it fails both the positivity and definiteness properties of axiom (iii):
(3,1),(3,1)=9+2=7<0(1,1/2),(1,1/2)=1+2/2=0.

Remark 5.1.8.

It is worth highlighting the observation in the proof of Theorem 5.1.3 that a dot product with weights k1,k2,,kn can be expressed as a matrix product:
x,y=i=1nkixiyi=xTKy,
where K is the diagonal n×n matrix whose i-th diagonal entry is ki. Here x,y are treated as column vectors, and we identify the resulting 1×1 matrix xTKy with a scalar.
In particular for the standard dot product this matrix formula reduces to
xy=xTIy=xTy.
Conversely, the dot product gives another way to formulate general matrix multiplication. as the next theorem articulates.
  1. See Remark 5.1.8 and the proof of Theorem 5.1.3.
Let A=[aij]m×n and B=[bij]n×r. Then
(AB)ij=k=1naikbkj=ricj,
since ri=(ai1,ai2,,ain) and cj=(bj1,b2j,,bnj).
Next we introduce an important family of inner products defined on polynomials spaces called evaluation inner products. These are useful when we wish to compare polynomials by how they behave at a specified list of inputs.
That axioms (i)-(ii) are satisfied is left as an exercise. For axiom (iii), note that
p(x),p(x)=p(c0)2+p(c1)2++p(cn)20,
and we have equality if and only if p(c0)=p(c1)=p(cn)=0. Since a nonzero polynomial of degree n or less has at most n distinct roots, we conclude that p(x)=0, the zero polynomial.

Example 5.1.11. Evaluation at 1,0,1.

Let V=P2, and let p(x),q(x) be the evaluation at 1,0,1 inner product. Compute x21,x2+2x+1 and x21,x21.
Solution.
Let p(x)=x21, q(x)=x2+2x+1. We have
p(x),q(x)=p(1)q(1)+p(0)q(0)+p(1)q(1)=0+(1)1+0=1
and
p(x),p(x)=p(1)2+p(0)2+p(1)2=0+(1)2+0=1.
Our last example defines an integral inner product on the space C([a,b]) of continuous functions on an interval [a,b]. This inner product plays an important role in Fourier analysis, which studies the approximation of arbibitrary continuous functions with linear combinations of certain trigonometric funtions.
First observe that the integral defining the inner product always exists since the product fg is a continuous function on the closed interval [a,b].
Axioms (i)-(ii) follow directly from the definition and various properties of the integral. This is left as an exercise. As for (iii), we have
f,f=abf2(x) dx0,
since f2(x)0 for all x[a,b]. (This is a property of integration.) Furthermore, since f2 is continuous and f2(x)0, we have
f,f=abf2(x) dx=0
if and only if f2(x)=0 for all x[a,b] (a property of integrals of continuous functions) if and only if f(x)=0 for all x[a,b] if and only if f=0, the zero function.

Example 5.1.13. Integral inner product.

Let V=C([0,1]), equipped with integral inner product. Let f(x)=x, g(x)=ex. Compute f,g and f,f.
Solution.
We have
f,g=01xex dx=(xex|0101ex dx)=e(e1)=1
and
f,f=01x2 dx=13.

Subsection 5.1.2 Norm and distance

As mentioned above, once an inner product is established, we can define further notions like norm (or length), distance, and angle in terms of the given inner product. When the inner product in question is the standard dot product on R2 or R3, then these are precisely the familiar notions you may have met in multivariable calculus. Things get really interesting when we treat a more exotic inner product space. For example, consider V=C([a,b]): the integral inner product on V (Theorem 5.1.12) gives rise to useful notions of the length of a function fC([a,b]), as well as the distance or angle between two functions f,gC([a,b]).

Definition 5.1.14. Norm (or length) of a vector.

Let (V,,) be an inner product space. Given vV we define its norm (or length), denoted v, as
v=v,v.
A unit vector is a vector v of length one: i.e., a vector v satisfying v=1.

Example 5.1.15. Norm with respect to dot product.

Consider V=R4 with the standard dot product. Compute (1,1,2,1).
Solution.
We have
(1,1,2,1)=(1,1,2,1)(1,1,2,1)=1+1+4+1=7.

Example 5.1.16. Norm with respect to weighted dot product.

Consider V=R3 equipped with the dot product with weights 1,2,3. Compute (3,1,2).
Solution.
We have
(3,1,2)=(3,1,2),(3,1,2)=1(32)+2(12)+3((2)2)=23.

Example 5.1.17. Norm with respect to integral inner product.

Consider V=C([0,1]) equipped with the integral inner product. Compute f, where f(x)=ex
Solution.
We have
f=f,f=01(ex)2dx=01e2xdx=(e21)/2.

Remark 5.1.18. Unit vectors.

Given any v0V, the vector u=1vv is a unit vector. To verify this, let c=v and compute
u=1cv,1cv=1c2v,v(Definition 5.1.1,(ii))=1|c|v,v=1cv,v(c=v0)=vv=1.

Example 5.1.19. Unit vectors.

For each inner product space (V,,) and vV compute the associated unit vector u=1vv
  1. V=R4 with dot product, v=(1,1,2,1)
  2. V=R3 with dot product with weights 1,2,3, v=(3,1,2)
  3. V=C([0,1]) with integral inner product, v=ex
Solution.
The norms of the vectors in each case were computed in Example 5.1.15–5.1.17. We simply scale to compute the corresponding unit vectors.
  1. u=17(1,1,2,1)=(7/7,7/7,27/7,7/7)
  2. u=123(3,1,2)=(323/23,23/23,223/23)
  3. u=1(e21)/2ex=2(e21)e21ex
Next, we define the distance between two vectors in an inner product space as the length of their vector difference.

Definition 5.1.20. Distance between vectors.

Let (V,,) be an inner product space. The distance between v,wV, denoted d(v,w), is defined as
d(v,w)=vw=vw,vw.

Example 5.1.21.

For each inner product space V, compute the distance between the given vectors.
  1. V=R3 with the dot product, x=(x1,x2,x3), y=(y1,y2,y3)
  2. V=P2 with the evaluation at 1,1,0 inner product, p1(x)=x2+1, p2(x)=x+2
  3. V=C([π,π]) with the integral inner product, f(x)=sinx+x, g(x)=x
Solution.
  1. We have
    d(x,y)=xy=xy,xy=(x1y1,x2y2,x3y3)(x1y1,x2y2,x3y3)=(x1y1)2+(x2y2)2+(x3y3)2.
  2. We have
    d(p1,p2)=p1p2=p1p2,p1p2=(p1(1)p2(1))2+(p1(1)p2(1))2+(p1(0)p2(0))2=(1)2+(1)2+(1)2=3
  3. We have
    d(f,g)=fg=fg,fg=sinx,sinx=pipisin2xdx=π
We prove (2) and leave the rest as an exercise (Exercise 5.1.5.16).
Given cR and vV we have
cv=cv,cv=c2v,v(Definition 5.1.1)=|c|v,v(c2=|c|).

Subsection 5.1.3 Cauchy-Schwarz inequality, triangle inequalities, and angles between vectors

The famous Cauchy-Schwarz inequality has a knack of cropping up all over the world of science: from properties of covariance in statistics, to the Heisenberg uncertainty principle of quantum mechanics. More directly pertinent to our discussion, the Cauchy-Schwarz inequality implies the triangle inequalities (5.1.24) and ensures that our notion of the angle between two nonzero vectors (Definition 5.1.25) is well-defined.
Fix vectors v and w. For any tR we have by positivity
0tvw,tvw=v,vt22v,wt+w,w=at22bt+c,
where
(5.1.1)a=v,v, b=v,w, c=w,w=w2.
Since at22bt+c0 for all tR the quadratic polynomial p(t)=at22bt+c has at most one root. Using the quadratic formula we conclude that we must have 4b24ac0, since otherwise p(t) would have two distinct roots. It follows that
4v,w24v2w20,
or equivalently
v,w2v2w2.
Taking square-roots yields the desired inequality.
The same reasoning shows that the Cauchy-Schwarz inequality is an actual equality if and only if p(t)=0 for some t if and only if 0=tvw,tvw if and only if v=tw for some t (by positivity).
The following triangle inequalities are more or less direct consequences of the Cauchy-Schwarz inequality.
This is an elementary exercise of unpacking the definitions of norm and distance in terms of the inner product, and then applying the Cauchy-Schwarz inequality appropriately. The proof is left as an exercise.
Let (V,,) be an inner product space. For any nonzero vectors v,w, the Cauchy-Schwarz inequality tells us that
|v,w|vw,
or equivalently,
1v,wvw1.
It follows that there is a unique real number θ[0,π] satisfying
cosθ=v,wvw.
We call θ the angle between v and w.

Definition 5.1.25. Angle between vectors.

Let (V,,) be an inner product space. Given nonzero vectors v,wV, the angle between v and w is defined to be the unique θ[0,π] satisfying
cosθ=v,wvw.
Equivalently, we have
θ=arccos(v,wvw).

Remark 5.1.26.

Our definition of the angle between two vectors may remind you of the dot product angle formula for vectors in R3:
(5.1.2)cosθ=xyxy.
Interestingly, whereas (5.1.2) is typically treated as a theorem, derived from properties of the dot product and the law of cosines, in a general inner product space the equation
cosθ=v,wvw
is understood as the definition of the angle between two vectors.

Example 5.1.27.

Consider R2 along with the dot product. Verify that our definition of the angle θ between (1,1) and (1,0) is consistent with our planar geometry notion of angle.
Solution.
According to Definition 5.1.25, θ is the unique element of [0,π] satisfying
cosθ=(1,1)(1,0)(1,1)(1,0)=12=22.
We recognize θ as the familiar angle π/4, as expected.

Example 5.1.28.

Consider R2 with the weighted dot product
(x1,x2),(y1,y2)=2x1x2+y1y2
Compute the angle θ between (1,1) and (0,0) with respect to this inner product
Solution.
First compute
(1,1),(1,0)=2(1)+1(0)=2(1,1)=(1,1),(1,1)=2+1=3(1,0)=(1,0),(1,0)=2
By definition θ is the unique value in [0,π] satisfying
cosθ=(1,1),(1,0)(1,1)(1,0)=232=63.
We see that θ is not one of our familiar angles from the unit circle (e.g., π/6,π/4, etc.) and so express θ in terms of the arccos function:
θ=arccos(6/3)35.3.

Example 5.1.29.

Consider V=C([π,π]) with the integral inner product. Compute the angle θ between f(x)=sinx and g(x)=sin2x with respect to this inner product.
Solution.
First compute
f,g=ππsinxsin2xdx=12ππcos(x2x)cos(x+2x)dx(trig. identity)=12ππcos(x)cos3xdx=0
It follows that
cosθ=f,gfg=0,
and hence that θ=π/2.

Subsection 5.1.4 Choosing your inner product

Why, given a fixed vector space V, would we prefer one inner product definition to another? One way of understanding a particular choice of inner product is to ask what its corresponding notion of distance measures.

Example 5.1.30. Weighted dot product distance.

Consider Rn with a choice of weighted dot product
(x1,x2,,xn),(y1,y2,,yn)=k1x1y1+k2x2y2++knxnyn,
where k1,k2,,kn are fixed positive constants. With respect to this inner product the distance between two vectors x=(x1,x2,,xn) and y=(y1,y2,,yn) is
d(x,y)=xy=k1(x1y1)2+k2(x2y2)2++kn(xnyn)2.
Thus d(x,y) is an aggregate measure of the difference between the corresponding entries of x and y, as weighted by our choice of the constants ki.
Imagine that each element of xRn is a data point collected by measuring n different properties of a sample s : i.e., xi is the measured value of property Pi on s for all 1in. Given samples s and s with corresponding measurement vectors x and y, the weighted distance d(x,y) is then a quantitative way of saying how “close” the two samples are to one another. The choice of weights ki allows us to adjust the relative influence of a given property Pi in determining this closeness. For example, the standard dot product (ki=1 for all i) yields a notion of distance that gives each property equal standing.

Example 5.1.31. Evaluation inner product distance.

Consider Pn with the evaluation inner product at a fixed choice of inputs x=c0,c1,,cn. Given two polynomials p(x),q(x), the distance between them with respect to this inner product is
p(x)q(x)=(p(c0)q(c0))2+(p(c1)q(c1))2++(p(cn)q(cn))2.
We see that with respect to this inner product, the distance between two polynomials is a measure of how much their values at the inputs x=c0,c1,,cn differ. This inner product may be useful if you are interested in how a polynomial behaves at this finite list of inputs.

Example 5.1.32. Integral inner product and distance.

Take C[a,b] with the standard inner product f,g=abf(x)g(x) dx. Here the distance between two functions is defined as
fg=ab(f(x)g(x))2 dx,
which we can think of as an aggregate measure of the difference of values f(x)g(x) for all x[a,b]. Thus d(f,g) is a global measure of the similarity between f and g that takes into account their values over the entire interval [a,b].

Exercises 5.1.5 Exercises

WeBWork Exercises

1.
Find the norm of x and the unit vector u in the direction of x if
x=[5525].
x= ,
u= (4 × 1 array)
2.
Find the angle α between the vectors
[443]  and  [123].
α= .
Answer.
cos1(0.876523)
3.
If f(x) and g(x) are arbitrary polynomials of degree at most 2, then the mapping
f,g=f(3)g(3)+f(0)g(0)+f(1)g(1)
defines an inner product in P2. Use this inner product to find f,g, f, g, and the angle αf,g between f(x) and g(x) for
f(x)=3x2+4x5  and  g(x)=2x22x+7.
f,g= ,
f= ,
g= ,
αf,g= .
Answer 1.
289
Answer 2.
11.3578
Answer 3.
32.5423
Answer 4.
0.673078
4.
If A and B are arbitrary real m×n matrices, then the mapping
A,B=trace(ATB)
defines an inner product in Rm×n. Use this inner product to find A,B, the norms A and B, and the angle αA,B between A and B for
A=[133223]  and  B=[113113].
A,B= ,
A= ,
B= ,
αA,B= .
Answer 1.
2
Answer 2.
6
Answer 3.
4.69042
Answer 4.
1.64192
5.
Use the inner product
f,g=01f(x)g(x)dx
in the vector space C0[0,1] of continuous functions on the domain [0,1] to find f,g, f, g, and the angle αf,g between f(x) and g(x) for
f(x)=5x29  and  g(x)=6x10.
f,g= ,
f= ,
g= ,
αf,g .
Answer 1.
141.167
Answer 2.
10.7703
Answer 3.
13.1149
Answer 4.
0.0346695

6.

For each of the following operations on R2, determine whether it defines an inner product on R2. If it fails to be an inner product, identify which of the three inner product axioms (if any) it does satisfy, and provide explicit counterexamples for any axiom that fails.
  1. (x1,x2), (y1,y2)=x1y2+x2y1.
  2. (x1,x2), (y1,y2)=2x1y1+x1y2+x2y1+3x2y2.
  3. (x1,x2), (y1,y2)=x12y12+x22y22.
Hint.
The operation in (b) is an inner product. Use that fact that
x, y=xT[2113]y,
where we treat x,y as column vectors. This helps to prove axioms (i)-(ii). For axiom (iii), use either a “complete the square” or quadratic formula argument on the expression x,x=2x12+2x1x2+3x22.

7.

We work within the inner product space given by V=P2 together with the evaluation at 0, 1, 2 inner product.
Let q(x)=x. Give a parametric description of the set
W={p(x)P2:p(x),q(x)=0}.

8.

We work in the inner product space given by V=C([π,π]) together with the integral inner product.
  1. Let f(x)=cosx,g(x)=sinx. Compute f,g and g.
  2. Show that if f(x) is an odd function (i.e., f(x)=f(x) for all x) and g(x) is an even function (g(x)=g(x) for all x), then f,g=0. Hint: use the area interpretation of the integral and properties of even/odd functions.

.

Compute the angle between the given vectors with respect to the given inner product. The exercises are designed to be done by hand: i.e., do not express your answer in terms of arccos.
9.
V=R4 with the standard dot product; v=(1,1,1,1),w=(1,1,1,1)
10.
V=R2 with the dot product with weights 1,2; v=(1,0),w=(2,2)
11.
V=C([0,1]) with the integral inner product; f(x)=1,g(x)=x
12.
V=P2 with evaluation at 1,1 inner product; p(x)=12x+12,q(x)=2x

13.

Let (V,,) be an inner product space. Prove that v,0=0 for all vV.

14.

Let v and w be nonzero vectors of the inner product space (V,,), and let θ be the angle between them. Prove the following equivalence:
v+w=v+w if and only if θ=0.
Your proof should be a chain of equivalences with each step justified.
Hint.
The equality is true if and only if it is true after squaring both sides. (Why?) Use the definition
v+w2=v+w,v+w
and expand the inner product.

15.

Let (V,,) be an inner product space. Suppose vectors v,wV satisfy v=2 and w=3. Using the Cauchy-Schwarz inequality (5.1.23) find the maximum and minimum possible values of vw, and give explicit examples where those values occur.

17.

Prove each inequality below using the Cauchy-Schwarz inequality (5.1.23) applied to a judicious choice of inner product space, and possibly a judicious choice of vector in said inner product space.
  1. For all f,gC([a,b])
    (abf(x)g(x) dx)2abf2(x) dxabg2(x) dx.
  2. For all (x1,x2,,xn)Rn,
    (x1+x2++xn)x12+x22++xn2n.
  3. For all a,b,θR
    (acosθ+bsinθ)2a2+b2.

18. Isometries of inner product spaces.

Let (V, ,) be an inner product space. An isometry of V is a function f:VV that preserves distance: i.e.,
d(f(v),f(w))=d(v,w) for all v,wV .
In this exercise we will show that any isometry that maps 0 to 0 is a linear transformation. This is a very useful fact. For example, it implies the linearity of many geometric transformations we have considered: rotation about the origin in R2, reflection through a line in R2, etc..
In what follows assume that f is an isometry of V satisfying f(0)=0.
  1. Prove that f(v)=v: i.e., f preserves norms.
  2. Prove f(v),f(w)=v,w: i.e., f preserves inner products. Hint: first prove that v,w=12(v2+w2vw2).
  3. To prove f is linear it is enough to show f(v+cw)=f(v)+cf(w) for all v,wV, cR. To do so, use the above parts to show that
    f(v+cw)(f(v)+cf(w))=0.