Innerproduct Print
Innerproduct Print
In calculus, the “dot product” of two vectors ~x = h2, −3i and ~y = h5, 1i is
(multiply corresponding entries and add). In linear algebra we write these same
vectors as
2 5
x= and y = ,
−3 1
and express the dot product as
T
5
x y= 2 −3 = 7 (or just 7)
1
y becomes xT y).
(so ~x · ~
Length
The length of a vector x is denoted kxk. A formula for this length comes from
the Pythagorean theorem. For instance, if x = [3, 4]T , then
p
kxk = 32 + 42
√
= 25
= 5.
Note that
3
xT x = 3 4 = 32 + 42 ,
4
which is what appears under the square root. In general we have
√
kxk = xT x
1
9 INNER PRODUCT 2
Angle
The angle θ between two vectors x and y is related to the dot product by the
formula
xT y = kxkkyk cos θ
9.1.1 Example Find the angle between x = [2, −3]T and y = [3, 2]T .
0
= = 0,
13
so θ = cos−1 0 = 90◦ .
x⊥y ⇐⇒ xT y = 0
9.2 Definition
We have seen that in R2 the length of a vector and the angle between two
vectors can be expressed using the dot product. So in a sense the dot product
is what gives rise to the geometry of vectors. It is certain properties of the dot
product that make this work.
9 INNER PRODUCT 3
Note that, combining (iii) and (iv) with (ii), we get the properties
An inner product space is a vector space with an inner product. Each of the
vector spaces Rn , Mm×n , Pn , and FI is an inner product space:
hx, yi = xT y.
To verify that this is an inner product, one needs to show that all four properties
hold. We check only two of them here.
(i) We have
hx, xi = xT x = x21 + x22 + · · · + x2n ≥ 0,
with equality if and only if xi = 0 for all i, that is, x = 0.
(iii) We have
(i) We have
Z b Z b
hf, f i = f (x)f (x) dx = [f (x)]2 dx.
a a
This last integral gives the (signed) area between the graph of y = [f (x)]2
and the x-axis from x = a to x = b. Since [f (x)]2 does not drop below
the x-axis, the integral is ≥ 0 with equality if and only if f (x) = 0 for all
x, that is, f is the zero function.
Solution We have
Z π
hsin x, cos xi = sin x cos x dx
−π
Z 0
= u du (u = sin x, du = cos x dx)
0
=0
Since the inner product generalizes the dot product, it is reasonable to say that
two vectors are “orthogonal” (or “perpendicular”) if their inner product is zero.
With this definition, we see from the preceding example that sin x and cos x are
orthogonal (on the interval [−π, π]).
9.7 Geometry
Let V be an inner product space and let v ∈ V . The norm (or length) of v is
denoted kvk and is defined by
p
kvk = hv, vi
9.7.1 Example With the inner product on M2×2 defined as in Section 9.4
find kAk, where
1 2
A= .
−1 4
9 INNER PRODUCT 6
Solution We have
s
p 1 2 1 2
kAk = hA, Ai = h , i
−1 4 −1 4
p √
= (1)(1) + (2)(2) + (−1)(−1) + (4)(4) = 22.
In the preceding example, kAk is called the “Frobenius norm” of the matrix A.
The distance between two vectors in V is the norm of their difference:
dist(v, w) = kv − wk
dist(x, x2 ) = kx − x2 k = hx − x2 , x − x2 i
p
s s
Z 1 Z 1
= (x − x2 )(x − x2 ) dx = (x2 − 2x3 + x4 ) dx
0 0
s 1
x3 2x4 x5
= − +
3 4 5 0
1
=√
30
9 INNER PRODUCT 7
and
Therefore, x3 is closer to x2 .
The distance between functions is a measure of the space between the graphs
of the functions (although it is not the exact area). One can see that the space
between x3 and x2 (yellow) is less than the space between x and x2 (green).
Cauchy-Schwarz theorem.
For all v, w ∈ V ,
|hv, wi| ≤ kvkkwk.
Proof. If w = 0, then both sides are zero and the inequality holds. Assume that
w 6= 0 and put
hv, wi
α= .
hw, wi
9 INNER PRODUCT 8
hv, wi
θ = cos−1
kvkkwk
(This gives hv, wi = kvkkwk cos θ which generalizes the dot product formula
in Section 9.1.) Since θ = 90◦ if and only if hv, wi = 0, we say that v is
orthogonal (or perpendicular) to w if and only if hv, wi = 0:
v⊥w ⇐⇒ hv, wi = 0
so
hp, qi 2 2
θ = cos−1 = cos−1 √ √ = cos−1 √ ≈ 51◦
kpkkqk 2 5 10
Pythagorean theorem.
Let v, w ∈ V . If v ⊥ w, then kv + wk2 = kvk2 + kwk2 .
kv + wk2 = hv + w, v + wi
= hv, vi + hv, wi + hw, vi + hw, wi (iii)
= hv, vi + 0 + 0 + hw, wi v⊥w
= kvk2 + kwk2 .
9.7.4 Example Verify the Pythagorean theorem for sin x, cos x ∈ C[−π,π] .
Solution In Example 9.6.1 we found that hsin x, cos xi = 0 so sin x ⊥ cos x and
the Pythagorean theorem applies. We have
Z π
k sin xk2 = hsin x, sin xi = sin2 x dx.
−π
so k sin xk2 = π. Similarly, using the identity cos2 x = 12 (1 + cos 2x) we get
k cos xk2 = π. On the other hand,
Z π
k sin x + cos xk2 = hsin x + cos x, sin x + cos xi = (sin x + cos x)2 dx
−π
Z π Z π Z π
= sin2 x dx + 2 sin x cos x dx + cos2 x dx
−π −π −π
= π + 0 + π = 2π,
where we have used Example 9.6.1 to see that the second integral is 0. Therefore,
9 – Exercises
9–1 Find the angle between x = [1, 2, −1, 2]T and y = [2, −1, 1, 3]T using the
inner product of Section 9.3.
9–2 Show that x ⊥ x2 in P5 using the inner product of Section 9.5 with
x1 = −2, x2 = −1, x3 = 0, x4 = 1, and x5 = 2.
9–3 Verify the Pythagorean theorem for the functions 1 and x in C[−1,1] using
the inner product of Section 9.6. (The theorem requires that 1 ⊥ x so this needs
to be checked first.)