Inner Products & Norms

1848 words
9 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Inner Products & Norms ## ๐ŸŽฏ Learning Objectives After this topic you will be able to: - Define an inner product and a norm axiomatically - Compute the inner product for vectors in $\mathbb{R}^n$, polynomials, and matrices - Use the Cauchy-Schwarz inequality to bound inner products - Prove the triangle inequality...

Inner Products & Norms

๐ŸŽฏ Learning Objectives

After this topic you will be able to:
  • Define an inner product and a norm axiomatically
  • Compute the inner product for vectors in Rn\mathbb{R}^n, polynomials, and matrices
  • Use the Cauchy-Schwarz inequality to bound inner products
  • Prove the triangle inequality from Cauchy-Schwarz
  • Compute distances and angles in arbitrary inner product spaces

๐Ÿ“‹ Prerequisites

  • Vector Spaces (Week 3) โ€” the abstract setting
  • Dot Product (Week 1) โ€” the motivating example
  • Inner products add geometry (lengths, angles) to vector spaces

1. Intuition: Adding Geometry to Vector Spaces

In Rn\mathbb{R}^n, we have the dot product to measure lengths and angles. But what about polynomials? Or matrices? Can we talk about the "angle" between two polynomials? An inner product is a way to define geometry on any vector space. Once we have an inner product, we can:
  • Define the length (norm) of a vector
  • Define the distance between two vectors
  • Define the angle between two vectors
  • Talk about orthogonality (Diagram)

2. Definition of an Inner Product

Definition (Inner Product). An inner product on a real vector space VV is a function โŸจโ‹…,โ‹…โŸฉ:Vร—Vโ†’R\langle \cdot, \cdot \rangle: V \times V \to \mathbb{R} satisfying:
  1. Linearity in first argument: โŸจau+bv,wโŸฉ=aโŸจu,wโŸฉ+bโŸจv,wโŸฉ\langle a\mathbf{u} + b\mathbf{v}, \mathbf{w} \rangle = a\langle \mathbf{u}, \mathbf{w} \rangle + b\langle \mathbf{v}, \mathbf{w} \rangle
  2. Symmetry: โŸจu,vโŸฉ=โŸจv,uโŸฉ\langle \mathbf{u}, \mathbf{v} \rangle = \langle \mathbf{v}, \mathbf{u} \rangle
  3. Positive definiteness: โŸจv,vโŸฉโ‰ฅ0\langle \mathbf{v}, \mathbf{v} \rangle \geq 0, and โŸจv,vโŸฉ=0\langle \mathbf{v}, \mathbf{v} \rangle = 0 iff v=0\mathbf{v} = \mathbf{0} A vector space equipped with an inner product is called an inner product space.

2.1 Examples

Example 1: Standard dot product on โ„โฟ
>โŸจx,yโŸฉ=xโ‹…y=โˆ‘i=1nxiyi>> \langle \mathbf{x}, \mathbf{y} \rangle = \mathbf{x} \cdot \mathbf{y} = \sum_{i=1}^n x_i y_i >
Example 2: Weighted inner product on โ„ยฒ
>โŸจ(x1,x2),(y1,y2)โŸฉ=2x1y1+3x2y2>> \langle (x_1, x_2), (y_1, y_2) \rangle = 2x_1 y_1 + 3x_2 y_2 >
Check: Positive definite? โŸจ(x1,x2),(x1,x2)โŸฉ=2x12+3x22โ‰ฅ0\langle (x_1, x_2), (x_1, x_2) \rangle = 2x_1^2 + 3x_2^2 \geq 0 and =0=0 only when x1=x2=0x_1=x_2=0. โœ“ Example 3: Inner product on polynomials
For p,qโˆˆPnp, q \in P_n: โŸจp,qโŸฉ=โˆซโˆ’11p(x)q(x)โ€‰dx\langle p, q \rangle = \int_{-1}^1 p(x) q(x) \, dx
Check: โŸจp,pโŸฉ=โˆซโˆ’11p(x)2dxโ‰ฅ0\langle p, p \rangle = \int_{-1}^1 p(x)^2 dx \geq 0, and =0=0 only if p=0p=0. โœ“ Example 4: Frobenius inner product on matrices
For A,BโˆˆRmร—nA, B \in \mathbb{R}^{m \times n}: โŸจA,BโŸฉ=tr(ATB)=โˆ‘i,jaijbij\langle A, B \rangle = \text{tr}(A^T B) = \sum_{i,j} a_{ij} b_{ij}

3. Norm

3.1 Definition

Definition (Norm). A norm on a vector space VV is a function โˆฅโ‹…โˆฅ:Vโ†’R\|\cdot\|: V \to \mathbb{R} satisfying:
  1. Positive definiteness: โˆฅvโˆฅโ‰ฅ0\|\mathbf{v}\| \geq 0, and โˆฅvโˆฅ=0\|\mathbf{v}\| = 0 iff v=0\mathbf{v} = \mathbf{0}
  2. Absolute homogeneity: โˆฅcvโˆฅ=โˆฃcโˆฃโˆฅvโˆฅ\|c\mathbf{v}\| = |c| \|\mathbf{v}\| for all cโˆˆRc \in \mathbb{R}
  3. Triangle inequality: โˆฅu+vโˆฅโ‰คโˆฅuโˆฅ+โˆฅvโˆฅ\|\mathbf{u} + \mathbf{v}\| \leq \|\mathbf{u}\| + \|\mathbf{v}\|

3.2 The Norm Induced by an Inner Product

Every inner product defines a norm:
โˆฅvโˆฅ=โŸจv,vโŸฉ\|\mathbf{v}\| = \sqrt{\langle \mathbf{v}, \mathbf{v} \rangle}
Example 5: Norms from inner products
  • โ„โฟ (standard): โˆฅxโˆฅ=x12+โ‹ฏ+xn2\|\mathbf{x}\| = \sqrt{x_1^2 + \cdots + x_n^2} (Euclidean norm)
  • Weighted โ„ยฒ: โˆฅ(x1,x2)โˆฅ=2x12+3x22\|(x_1, x_2)\| = \sqrt{2x_1^2 + 3x_2^2}
  • Polynomials: โˆฅpโˆฅ=โˆซโˆ’11p(x)2dx\|p\| = \sqrt{\int_{-1}^1 p(x)^2 dx}
  • Frobenius norm: โˆฅAโˆฅF=tr(ATA)=โˆ‘aij2\|A\|_F = \sqrt{\text{tr}(A^T A)} = \sqrt{\sum a_{ij}^2}

4. Cauchy-Schwarz Inequality

Theorem (Cauchy-Schwarz). For any u,v\mathbf{u}, \mathbf{v} in an inner product space:
>โˆฃโŸจu,vโŸฉโˆฃโ‰คโˆฅuโˆฅโˆฅvโˆฅ>> |\langle \mathbf{u}, \mathbf{v} \rangle| \leq \|\mathbf{u}\| \|\mathbf{v}\| >
Equality holds iff u\mathbf{u} and v\mathbf{v} are linearly dependent (one is a scalar multiple of the other). Proof
Consider โˆฅuโˆ’tvโˆฅ2โ‰ฅ0\|\mathbf{u} - t\mathbf{v}\|^2 \geq 0 for any tโˆˆRt \in \mathbb{R}:
>โˆฅuโˆฅ2โˆ’2tโŸจu,vโŸฉ+t2โˆฅvโˆฅ2โ‰ฅ0>> \|\mathbf{u}\|^2 - 2t\langle \mathbf{u}, \mathbf{v} \rangle + t^2\|\mathbf{v}\|^2 \geq 0 >
This is a quadratic in tt that is always โ‰ฅ0\geq 0, so its discriminant must be โ‰ค0\leq 0:
>(2โŸจu,vโŸฉ)2โˆ’4โˆฅuโˆฅ2โˆฅvโˆฅ2โ‰ค0>> (2\langle \mathbf{u}, \mathbf{v} \rangle)^2 - 4\|\mathbf{u}\|^2 \|\mathbf{v}\|^2 \leq 0 >
Dividing by 4: โŸจu,vโŸฉ2โ‰คโˆฅuโˆฅ2โˆฅvโˆฅ2\langle \mathbf{u}, \mathbf{v} \rangle^2 \leq \|\mathbf{u}\|^2 \|\mathbf{v}\|^2. Taking square roots gives the result. โˆŽ Example 6: Using Cauchy-Schwarz
For u=(1,2,3)\mathbf{u} = (1, 2, 3), v=(4,5,6)\mathbf{v} = (4, 5, 6): โŸจu,vโŸฉ=4+10+18=32\langle \mathbf{u}, \mathbf{v} \rangle = 4 + 10 + 18 = 32 โˆฅuโˆฅ=14โ‰ˆ3.74\|\mathbf{u}\| = \sqrt{14} \approx 3.74, โˆฅvโˆฅ=77โ‰ˆ8.77\|\mathbf{v}\| = \sqrt{77} \approx 8.77 โˆฅuโˆฅโˆฅvโˆฅโ‰ˆ32.83\|\mathbf{u}\|\|\mathbf{v}\| \approx 32.83 โˆฃโŸจu,vโŸฉโˆฃ=32โ‰ค32.83|\langle \mathbf{u}, \mathbf{v} \rangle| = 32 \leq 32.83 โœ“

5. Triangle Inequality

Theorem (Triangle Inequality). For any u,v\mathbf{u}, \mathbf{v} in an inner product space:
>โˆฅu+vโˆฅโ‰คโˆฅuโˆฅ+โˆฅvโˆฅ>> \|\mathbf{u} + \mathbf{v}\| \leq \|\mathbf{u}\| + \|\mathbf{v}\| >
Proof:
โˆฅu+vโˆฅ2=โŸจu+v,u+vโŸฉ=โˆฅuโˆฅ2+2โŸจu,vโŸฉ+โˆฅvโˆฅ2\|\mathbf{u}+\mathbf{v}\|^2 = \langle \mathbf{u}+\mathbf{v}, \mathbf{u}+\mathbf{v} \rangle = \|\mathbf{u}\|^2 + 2\langle \mathbf{u}, \mathbf{v} \rangle + \|\mathbf{v}\|^2 โ‰คโˆฅuโˆฅ2+2โˆฅuโˆฅโˆฅvโˆฅ+โˆฅvโˆฅ2=(โˆฅuโˆฅ+โˆฅvโˆฅ)2\leq \|\mathbf{u}\|^2 + 2\|\mathbf{u}\|\|\mathbf{v}\| + \|\mathbf{v}\|^2 = (\|\mathbf{u}\| + \|\mathbf{v}\|)^2
Taking square roots gives the result. (The inequality step uses Cauchy-Schwarz.)

6. Angle and Distance

6.1 Angle

Once we have an inner product, we can define the angle ฮธ\theta between u\mathbf{u} and v\mathbf{v}:
cosโกฮธ=โŸจu,vโŸฉโˆฅuโˆฅโˆฅvโˆฅ,ฮธโˆˆ[0,ฯ€]\cos\theta = \frac{\langle \mathbf{u}, \mathbf{v} \rangle}{\|\mathbf{u}\| \|\mathbf{v}\|}, \quad \theta \in [0, \pi]
Cauchy-Schwarz guarantees โˆฃcosโกฮธโˆฃโ‰ค1|\cos\theta| \leq 1, so the definition is valid.

6.2 Distance

The distance between u\mathbf{u} and v\mathbf{v} is:
d(u,v)=โˆฅuโˆ’vโˆฅd(\mathbf{u}, \mathbf{v}) = \|\mathbf{u} - \mathbf{v}\|
Example 7: Angle between polynomials
p(x)=1p(x) = 1, q(x)=xq(x) = x with inner product โŸจp,qโŸฉ=โˆซโˆ’11p(x)q(x)dx\langle p, q \rangle = \int_{-1}^1 p(x) q(x) dx.
โŸจp,qโŸฉ=โˆซโˆ’111โ‹…xdx=0\langle p, q \rangle = \int_{-1}^1 1 \cdot x dx = 0 (odd function over symmetric interval). So cosโกฮธ=0\cos\theta = 0, ฮธ=90โˆ˜\theta = 90^\circ โ€” the polynomials 1 and xx are orthogonal!

7. Edge Cases & Gotchas

SituationWhat Happens
Zero vectorโŸจ0,vโŸฉ=0\langle \mathbf{0}, \mathbf{v} \rangle = 0 for all v\mathbf{v} ; $\
** โŸจv,vโŸฉ=0\langle \mathbf{v}, \mathbf{v} \rangle = 0 **Forces v=0\mathbf{v} = \mathbf{0} (positive definiteness)
Non-standard inner productsDifferent inner products give different geometries

8. Common Pitfalls

โŒ Pitfall 1: Assuming all norms come from inner products

Not every norm comes from an inner product. The pp-norms (โˆฅxโˆฅp=(โˆ‘โˆฃxiโˆฃp)1/p\|x\|_p = (\sum |x_i|^p)^{1/p} for pโ‰ 2p \neq 2) do NOT satisfy the parallelogram law and so do not come from inner products.

โŒ Pitfall 2: Forgetting absolute value in Cauchy-Schwarz

โˆฃโŸจu,vโŸฉโˆฃโ‰คโˆฅuโˆฅโˆฅvโˆฅ|\langle \mathbf{u}, \mathbf{v} \rangle| \leq \|\mathbf{u}\| \|\mathbf{v}\| โ€” the absolute value matters. Negative inner products also satisfy the inequality.

โŒ Pitfall 3: Confusing inner product spaces with normed spaces

Every inner product induces a norm, but not every norm comes from an inner product.

9. Formula Summary Table

ConceptFormula
Inner product axiomsLinear, symmetric, positive definite
Induced norm$\
Cauchy-Schwarz$
Triangle inequality$\
Angle$\cos\theta = \frac{\langle \mathbf{u}, \mathbf{v} \rangle}{\
Distance$d(\mathbf{u}, \mathbf{v}) = \
Parallelogram law$\

10. ๐Ÿ“ Practice Questions

Q1: Weighted inner product
For โŸจ(x1,x2),(y1,y2)โŸฉ=2x1y1โˆ’x1y2โˆ’x2y1+3x2y2\langle (x_1,x_2), (y_1,y_2) \rangle = 2x_1y_1 - x_1y_2 - x_2y_1 + 3x_2y_2, compute โŸจ(1,2),(3,4)โŸฉ\langle (1,2), (3,4) \rangle.
Solution: 2(1)(3)โˆ’1(4)โˆ’2(3)+3(2)(4)=6โˆ’4โˆ’6+24=202(1)(3) - 1(4) - 2(3) + 3(2)(4) = 6 - 4 - 6 + 24 = 20. Q2: Checking inner product axioms
Is โŸจ(x1,x2),(y1,y2)โŸฉ=x1y1+x2y2+1\langle (x_1,x_2), (y_1,y_2) \rangle = x_1y_1 + x_2y_2 + 1 an inner product?
Solution: Fails linearity (the constant 1 breaks it). Also, โŸจ(0,0),(0,0)โŸฉ=1โ‰ 0\langle (0,0), (0,0) \rangle = 1 \neq 0, so positive definiteness fails. Q3: Norm from inner product
Compute โˆฅ(3,4)โˆฅ\|(3,4)\| using the standard inner product and the weighted inner product from Example 2.
Solution: Standard: 9+16=5\sqrt{9+16} = 5. Weighted (2x12+3x222x_1^2 + 3x_2^2): 2(9)+3(16)=18+48=66โ‰ˆ8.12\sqrt{2(9) + 3(16)} = \sqrt{18+48} = \sqrt{66} \approx 8.12. Q4: Cauchy-Schwarz verification
Verify Cauchy-Schwarz for p(x)=xp(x) = x, q(x)=x2q(x) = x^2 with โŸจp,qโŸฉ=โˆซ01p(x)q(x)dx\langle p,q \rangle = \int_0^1 p(x)q(x) dx.
Solution: โŸจp,qโŸฉ=โˆซ01x3dx=14\langle p,q \rangle = \int_0^1 x^3 dx = \frac{1}{4}. โˆฅpโˆฅ2=โˆซ01x2dx=13\|p\|^2 = \int_0^1 x^2 dx = \frac{1}{3}, so โˆฅpโˆฅ=13\|p\| = \frac{1}{\sqrt{3}}. โˆฅqโˆฅ2=โˆซ01x4dx=15\|q\|^2 = \int_0^1 x^4 dx = \frac{1}{5}, so โˆฅqโˆฅ=15\|q\| = \frac{1}{\sqrt{5}}. โˆฅpโˆฅโˆฅqโˆฅ=115โ‰ˆ0.258\|p\|\|q\| = \frac{1}{\sqrt{15}} \approx 0.258. โˆฃโŸจp,qโŸฉโˆฃ=0.25โ‰ค0.258|\langle p,q \rangle| = 0.25 \leq 0.258 โœ“ Q5: Triangle inequality
Verify the triangle inequality for u=(1,2)\mathbf{u} = (1,2), v=(3,4)\mathbf{v} = (3,4).
Solution: u+v=(4,6)\mathbf{u}+\mathbf{v} = (4,6), โˆฅ(4,6)โˆฅ=16+36=52โ‰ˆ7.21\|(4,6)\| = \sqrt{16+36} = \sqrt{52} \approx 7.21. โˆฅuโˆฅ=5โ‰ˆ2.24\|\mathbf{u}\| = \sqrt{5} \approx 2.24, โˆฅvโˆฅ=5\|\mathbf{v}\| = 5. 2.24+5=7.24>7.212.24 + 5 = 7.24 > 7.21 โœ“ Q6: Angle in weighted inner product
Find the angle between (1,0)(1,0) and (0,1)(0,1) using the inner product โŸจ(x1,x2),(y1,y2)โŸฉ=x1y1+2x2y2\langle (x_1,x_2), (y_1,y_2) \rangle = x_1y_1 + 2x_2y_2.
Solution: โŸจ(1,0),(0,1)โŸฉ=0\langle (1,0), (0,1) \rangle = 0. So cosโกฮธ=0\cos\theta = 0, ฮธ=90โˆ˜\theta = 90^\circ. They are orthogonal. Q7: Distance between functions
Find the distance between f(x)=1f(x)=1 and g(x)=xg(x)=x on [0,1][0,1] using โŸจf,gโŸฉ=โˆซ01fg\langle f,g \rangle = \int_0^1 fg.
Solution: fโˆ’g=1โˆ’xf-g = 1-x. โˆฅfโˆ’gโˆฅ2=โˆซ01(1โˆ’x)2dx=โˆซ01(1โˆ’2x+x2)dx=[xโˆ’x2+x3/3]01=1โˆ’1+1/3=1/3\|f-g\|^2 = \int_0^1 (1-x)^2 dx = \int_0^1 (1 - 2x + x^2) dx = [x - x^2 + x^3/3]_0^1 = 1 - 1 + 1/3 = 1/3. Distance = 13\frac{1}{\sqrt{3}}. Q8: Parallelogram law
Verify the parallelogram law for u=(1,2)\mathbf{u} = (1,2), v=(3,4)\mathbf{v} = (3,4).
Solution: u+v=(4,6)\mathbf{u}+\mathbf{v} = (4,6), โˆฅu+vโˆฅ2=52\|\mathbf{u}+\mathbf{v}\|^2 = 52. uโˆ’v=(โˆ’2,โˆ’2)\mathbf{u}-\mathbf{v} = (-2,-2), โˆฅuโˆ’vโˆฅ2=8\|\mathbf{u}-\mathbf{v}\|^2 = 8. LHS: 52+8=6052 + 8 = 60. RHS: 2โˆฅ(1,2)โˆฅ2+2โˆฅ(3,4)โˆฅ2=2(5)+2(25)=10+50=602\|(1,2)\|^2 + 2\|(3,4)\|^2 = 2(5) + 2(25) = 10 + 50 = 60 โœ“ Q9: Orthogonal vectors in weighted inner product
Find kk such that (1,2)(1,2) and (3,k)(3,k) are orthogonal in the inner product โŸจ(x1,x2),(y1,y2)โŸฉ=x1y1+2x2y2\langle (x_1,x_2), (y_1,y_2) \rangle = x_1y_1 + 2x_2y_2.
Solution: โŸจ(1,2),(3,k)โŸฉ=1(3)+2(2)(k)=3+4k=0โ‡’k=โˆ’34\langle (1,2), (3,k) \rangle = 1(3) + 2(2)(k) = 3 + 4k = 0 \Rightarrow k = -\frac{3}{4}. Q10: Frobenius inner product
Compute โŸจA,BโŸฉ\langle A, B \rangle where
>A=[1234]>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} >
,
>B=[01โˆ’10]>> B = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} >
using โŸจA,BโŸฉ=tr(ATB)\langle A, B \rangle = \text{tr}(A^T B).
Solution:
>AT=[1324]>> A^T = \begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix} >
,
>ATB=[1324][01โˆ’10]=[โˆ’31โˆ’42]>> A^T B = \begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix} \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} = \begin{bmatrix} -3 & 1 \\ -4 & 2 \end{bmatrix} >
. tr(ATB)=โˆ’3+2=โˆ’1\text{tr}(A^T B) = -3 + 2 = -1. Check entry-wise: โˆ‘aijbij=1(0)+2(1)+3(โˆ’1)+4(0)=0+2โˆ’3+0=โˆ’1\sum a_{ij}b_{ij} = 1(0) + 2(1) + 3(-1) + 4(0) = 0 + 2 - 3 + 0 = -1 โœ“

๐Ÿ”— Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.