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โnโxiโyiโ>Example 1: Standard dot product on โโฟ
>โจ(x1โ,x2โ),(y1โ,y2โ)โฉ=2x1โy1โ+3x2โy2โ>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โฉ=โซโ11โp(x)q(x)dxCheck: โจp,pโฉ=โซโ11โp(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,jโaijโbijโ
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โฅ=โซโ11โp(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โฉ=โซโ11โp(x)q(x)dx.โจp,qโฉ=โซโ11โ1โ 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=[13โ24โ]>Q1: Weighted inner productFor โจ(x1โ,x2โ),(y1โ,y2โ)โฉ=2x1โy1โโx1โy2โโx2โy1โ+3x2โy2โ, 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โ)โฉ=x1โy1โ+x2โy2โ+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โฉ=โซ01โp(x)q(x)dx.Solution: โจp,qโฉ=โซ01โx3dx=41โ. โฅpโฅ2=โซ01โx2dx=31โ, so โฅpโฅ=3โ1โ. โฅqโฅ2=โซ01โx4dx=51โ, so โฅqโฅ=5โ1โ. โฅpโฅโฅqโฅ=15โ1โโ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โ)โฉ=x1โy1โ+2x2โy2โ.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โฉ=โซ01โfg.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 = 3โ1โ. 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โ)โฉ=x1โy1โ+2x2โy2โ.Solution: โจ(1,2),(3,k)โฉ=1(3)+2(2)(k)=3+4k=0โk=โ43โ. Q10: Frobenius inner productCompute โจA,Bโฉ where
>B=[0โ1โ10โ]>,
>AT=[12โ34โ]>using โจA,Bโฉ=tr(ATB).Solution:
>ATB=[12โ34โ][0โ1โ10โ]=[โ3โ4โ12โ]>,
. tr(ATB)=โ3+2=โ1. Check entry-wise: โaijโbijโ=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