Inner Products & Norms
1848 words
9 min read
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, 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, 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 V is a function ⟨⋅,⋅⟩:V×V→R satisfying:
- Linearity in first argument: ⟨au+bv,w⟩=a⟨u,w⟩+b⟨v,w⟩
- Symmetry: ⟨u,v⟩=⟨v,u⟩
- Positive definiteness: ⟨v,v⟩≥0, and ⟨v,v⟩=0 iff v=0 A vector space equipped with an inner product is called an inner product space.
2.1 Examples
>⟨x,y⟩=x⋅y=i=1∑nxiyi>Example 1: Standard dot product on ℝⁿ
>⟨(x1,x2),(y1,y2)⟩=2x1y1+3x2y2>Example 2: Weighted inner product on ℝ²
Check: Positive definite? ⟨(x1,x2),(x1,x2)⟩=2x12+3x22≥0 and =0 only when x1=x2=0. ✓ Example 3: Inner product on polynomialsFor p,q∈Pn: ⟨p,q⟩=∫−11p(x)q(x)dxCheck: ⟨p,p⟩=∫−11p(x)2dx≥0, and =0 only if p=0. ✓ Example 4: Frobenius inner product on matricesFor A,B∈Rm×n: ⟨A,B⟩=tr(ATB)=∑i,jaijbij
3. Norm
3.1 Definition
Definition (Norm). A norm on a vector space V is a function ∥⋅∥:V→R satisfying:
- Positive definiteness: ∥v∥≥0, and ∥v∥=0 iff v=0
- Absolute homogeneity: ∥cv∥=∣c∣∥v∥ for all c∈R
- Triangle inequality: ∥u+v∥≤∥u∥+∥v∥
3.2 The Norm Induced by an Inner Product
Every inner product defines a norm:
Example 5: Norms from inner products
- ℝⁿ (standard): ∥x∥=x12+⋯+xn2 (Euclidean norm)
- Weighted ℝ²: ∥(x1,x2)∥=2x12+3x22
- Polynomials: ∥p∥=∫−11p(x)2dx
- Frobenius norm: ∥A∥F=tr(ATA)=∑aij2
4. Cauchy-Schwarz Inequality
>∣⟨u,v⟩∣≤∥u∥∥v∥>Theorem (Cauchy-Schwarz). For any u,v in an inner product space:
>∥u∥2−2t⟨u,v⟩+t2∥v∥2≥0>Equality holds iff u and v are linearly dependent (one is a scalar multiple of the other). ProofConsider ∥u−tv∥2≥0 for any t∈R:
>(2⟨u,v⟩)2−4∥u∥2∥v∥2≤0>This is a quadratic in t that is always ≥0, so its discriminant must be ≤0:
Dividing by 4: ⟨u,v⟩2≤∥u∥2∥v∥2. Taking square roots gives the result. ∎ Example 6: Using Cauchy-SchwarzFor u=(1,2,3), v=(4,5,6): ⟨u,v⟩=4+10+18=32 ∥u∥=14≈3.74, ∥v∥=77≈8.77 ∥u∥∥v∥≈32.83 ∣⟨u,v⟩∣=32≤32.83 ✓
5. Triangle Inequality
>∥u+v∥≤∥u∥+∥v∥>Theorem (Triangle Inequality). For any u,v in an inner product space:
Proof:
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 θ between u and v:
Cauchy-Schwarz guarantees ∣cosθ∣≤1, so the definition is valid.
6.2 Distance
The distance between u and v is:
Example 7: Angle between polynomialsp(x)=1, q(x)=x with inner product ⟨p,q⟩=∫−11p(x)q(x)dx.⟨p,q⟩=∫−111⋅xdx=0 (odd function over symmetric interval). So cosθ=0, θ=90∘ — the polynomials 1 and x are orthogonal!
7. Edge Cases & Gotchas
| Situation | What Happens |
|---|---|
| Zero vector | ⟨0,v⟩=0 for all v ; $\ |
| ** ⟨v,v⟩=0 ** | Forces v=0 (positive definiteness) |
| Non-standard inner products | Different 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 p-norms (∥x∥p=(∑∣xi∣p)1/p for p=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∥ — 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
| Concept | Formula |
|---|---|
| Inner product axioms | Linear, 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
>A=[1324]>Q1: Weighted inner productFor ⟨(x1,x2),(y1,y2)⟩=2x1y1−x1y2−x2y1+3x2y2, compute ⟨(1,2),(3,4)⟩.Solution: 2(1)(3)−1(4)−2(3)+3(2)(4)=6−4−6+24=20. Q2: Checking inner product axiomsIs ⟨(x1,x2),(y1,y2)⟩=x1y1+x2y2+1 an inner product?Solution: Fails linearity (the constant 1 breaks it). Also, ⟨(0,0),(0,0)⟩=1=0, so positive definiteness fails. Q3: Norm from inner productCompute ∥(3,4)∥ using the standard inner product and the weighted inner product from Example 2.Solution: Standard: 9+16=5. Weighted (2x12+3x22): 2(9)+3(16)=18+48=66≈8.12. Q4: Cauchy-Schwarz verificationVerify Cauchy-Schwarz for p(x)=x, q(x)=x2 with ⟨p,q⟩=∫01p(x)q(x)dx.Solution: ⟨p,q⟩=∫01x3dx=41. ∥p∥2=∫01x2dx=31, so ∥p∥=31. ∥q∥2=∫01x4dx=51, so ∥q∥=51. ∥p∥∥q∥=151≈0.258. ∣⟨p,q⟩∣=0.25≤0.258 ✓ Q5: Triangle inequalityVerify the triangle inequality for u=(1,2), v=(3,4).Solution: u+v=(4,6), ∥(4,6)∥=16+36=52≈7.21. ∥u∥=5≈2.24, ∥v∥=5. 2.24+5=7.24>7.21 ✓ Q6: Angle in weighted inner productFind the angle between (1,0) and (0,1) using the inner product ⟨(x1,x2),(y1,y2)⟩=x1y1+2x2y2.Solution: ⟨(1,0),(0,1)⟩=0. So cosθ=0, θ=90∘. They are orthogonal. Q7: Distance between functionsFind the distance between f(x)=1 and g(x)=x on [0,1] using ⟨f,g⟩=∫01fg.Solution: f−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. Distance = 31. Q8: Parallelogram lawVerify the parallelogram law for u=(1,2), v=(3,4).Solution: u+v=(4,6), ∥u+v∥2=52. u−v=(−2,−2), ∥u−v∥2=8. LHS: 52+8=60. RHS: 2∥(1,2)∥2+2∥(3,4)∥2=2(5)+2(25)=10+50=60 ✓ Q9: Orthogonal vectors in weighted inner productFind k such that (1,2) and (3,k) are orthogonal in the inner product ⟨(x1,x2),(y1,y2)⟩=x1y1+2x2y2.Solution: ⟨(1,2),(3,k)⟩=1(3)+2(2)(k)=3+4k=0⇒k=−43. Q10: Frobenius inner productCompute ⟨A,B⟩ where
>B=[0−110]>,
>AT=[1234]>using ⟨A,B⟩=tr(ATB).Solution:
>ATB=[1234][0−110]=[−3−412]>,
. tr(ATB)=−3+2=−1. Check entry-wise: ∑aijbij=1(0)+2(1)+3(−1)+4(0)=0+2−3+0=−1 ✓
🔗 Cross-References
- Next topic: Orthogonality
- Week 8 (Gram-Schmidt): Uses inner products to build orthonormal bases
- Week 12 (Eigenvalues): Symmetric matrices have orthogonal eigenvectors
- BSCS2004 (ML Foundations): Kernel methods use inner products in feature spaces
- BSMA1001 (Maths 1): Dot product review Join Discord Previous7.2 Affine SubspacesNext8.1 Orthogonality