Quiz 2

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×VR\langle \cdot, \cdot \rangle: V \times V \to \mathbb{R} satisfying:
  1. Linearity in first argument: au+bv,w=au,w+bv,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,v0\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=xy=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+3x220\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,qPnp, 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)2dx0\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,BRm×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 :VR\|\cdot\|: V \to \mathbb{R} satisfying:
  1. Positive definiteness: v0\|\mathbf{v}\| \geq 0, and v=0\|\mathbf{v}\| = 0 iff v=0\mathbf{v} = \mathbf{0}
  2. Absolute homogeneity: cv=cv\|c\mathbf{v}\| = |c| \|\mathbf{v}\| for all cRc \in \mathbb{R}
  3. Triangle inequality: u+vu+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: AF=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,vuv>> |\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 utv20\|\mathbf{u} - t\mathbf{v}\|^2 \geq 0 for any tRt \in \mathbb{R}:
>u22tu,v+t2v20>> \|\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:
>(2u,v)24u2v20>> (2\langle \mathbf{u}, \mathbf{v} \rangle)^2 - 4\|\mathbf{u}\|^2 \|\mathbf{v}\|^2 \leq 0 >
Dividing by 4: u,v2u2v2\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=143.74\|\mathbf{u}\| = \sqrt{14} \approx 3.74, v=778.77\|\mathbf{v}\| = \sqrt{77} \approx 8.77 uv32.83\|\mathbf{u}\|\|\mathbf{v}\| \approx 32.83 u,v=3232.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+vu+v>> \|\mathbf{u} + \mathbf{v}\| \leq \|\mathbf{u}\| + \|\mathbf{v}\| >
Proof:
u+v2=u+v,u+v=u2+2u,v+v2\|\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 u2+2uv+v2=(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,vuv,θ[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)=uvd(\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=111xdx=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 vector0,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 (xp=(xip)1/p\|x\|_p = (\sum |x_i|^p)^{1/p} for p2p \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,vuv|\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)=2x1y1x1y2x2y1+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)=646+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)=10\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=668.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}. p2=01x2dx=13\|p\|^2 = \int_0^1 x^2 dx = \frac{1}{3}, so p=13\|p\| = \frac{1}{\sqrt{3}}. q2=01x4dx=15\|q\|^2 = \int_0^1 x^4 dx = \frac{1}{5}, so q=15\|q\| = \frac{1}{\sqrt{5}}. pq=1150.258\|p\|\|q\| = \frac{1}{\sqrt{15}} \approx 0.258. p,q=0.250.258|\langle p,q \rangle| = 0.25 \leq 0.258Q5: 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=527.21\|(4,6)\| = \sqrt{16+36} = \sqrt{52} \approx 7.21. u=52.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.21Q6: 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: fg=1xf-g = 1-x. fg2=01(1x)2dx=01(12x+x2)dx=[xx2+x3/3]01=11+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+v2=52\|\mathbf{u}+\mathbf{v}\|^2 = 52. uv=(2,2)\mathbf{u}-\mathbf{v} = (-2,-2), uv2=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 = 60Q9: 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=0k=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=[0110]>> 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][0110]=[3142]>> 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+23+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
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.