30
Setup Norms Conditioning Computing Condition Number Sensitivity and Conditioning CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Sensitivity and Conditioning 1 / 23

Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Sensitivity and Conditioning

CS 205A:Mathematical Methods for Robotics, Vision, and Graphics

Justin Solomon

CS 205A: Mathematical Methods Sensitivity and Conditioning 1 / 23

Page 2: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Questions

Gaussian elimination works in theory, but what

about floating point precision?

How much can we trust ~x0 if

0 < ‖A~x0 −~b‖ � 1?

CS 205A: Mathematical Methods Sensitivity and Conditioning 2 / 23

Page 3: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Recall: Backward Error

Backward ErrorThe amount a problem statement would have to changeto realize a given approximation of its solution

Example 1:√x

Example 2: A~x = ~b

CS 205A: Mathematical Methods Sensitivity and Conditioning 3 / 23

Page 4: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Perturbation Analysis

How does ~x change if we solve

(A + δA)~x = ~b + δ~b?

Two viewpoints:

I Thanks to floating point precision, A and ~b

are approximate

I If ~x0 isn’t the exact solution, what is the

backward error?

CS 205A: Mathematical Methods Sensitivity and Conditioning 4 / 23

Page 5: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

What is “Small?”

What does it mean for a statement to hold for

small δ~x?

Vector norm

A function ‖ · ‖ : Rn → [0,∞) satisfying:

1. ‖~x‖ = 0 iff ~x = 0

2. ‖c~x‖ = |c|‖~x‖ ∀c ∈ R, ~x ∈ Rn

3. ‖~x+ ~y‖ ≤ ‖~x‖+ ‖~y‖ ∀~x, ~y ∈ Rn

CS 205A: Mathematical Methods Sensitivity and Conditioning 5 / 23

Page 6: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

What is “Small?”

What does it mean for a statement to hold for

small δ~x?

Vector norm

A function ‖ · ‖ : Rn → [0,∞) satisfying:

1. ‖~x‖ = 0 iff ~x = 0

2. ‖c~x‖ = |c|‖~x‖ ∀c ∈ R, ~x ∈ Rn

3. ‖~x+ ~y‖ ≤ ‖~x‖+ ‖~y‖ ∀~x, ~y ∈ Rn

CS 205A: Mathematical Methods Sensitivity and Conditioning 5 / 23

Page 7: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Our Favorite Norm

‖~x‖2 ≡√x21+ x22+ · · ·+ x2n

CS 205A: Mathematical Methods Sensitivity and Conditioning 6 / 23

Page 8: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

p-Norms

For p ≥ 1,

‖~x‖p ≡ (|x1|p + |x2|p + · · · + |xn|p)1/p

Taxicab norm: ‖~x‖1

CS 205A: Mathematical Methods Sensitivity and Conditioning 7 / 23

Page 9: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

∞ Norm

‖~x‖∞ ≡ max (|x1|, |x2|, . . . , |xn|)

CS 205A: Mathematical Methods Sensitivity and Conditioning 8 / 23

Page 10: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

How are Norms Different?

<unit circles>

CS 205A: Mathematical Methods Sensitivity and Conditioning 9 / 23

Page 11: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

How are Norms the Same?

Equivalent norms

Two norms ‖ · ‖ and ‖ · ‖′ are equivalent if there existconstants clow and chigh such thatclow‖~x‖ ≤ ‖~x‖′ ≤ chigh‖~x‖ for all ~x ∈ Rn.

TheoremAll norms on Rn are equivalent.

(10000, 1000, 1000) vs. (10000, 0, 0)?

CS 205A: Mathematical Methods Sensitivity and Conditioning 10 / 23

Page 12: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

How are Norms the Same?

Equivalent norms

Two norms ‖ · ‖ and ‖ · ‖′ are equivalent if there existconstants clow and chigh such thatclow‖~x‖ ≤ ‖~x‖′ ≤ chigh‖~x‖ for all ~x ∈ Rn.

TheoremAll norms on Rn are equivalent.

(10000, 1000, 1000) vs. (10000, 0, 0)?

CS 205A: Mathematical Methods Sensitivity and Conditioning 10 / 23

Page 13: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

How are Norms the Same?

Equivalent norms

Two norms ‖ · ‖ and ‖ · ‖′ are equivalent if there existconstants clow and chigh such thatclow‖~x‖ ≤ ‖~x‖′ ≤ chigh‖~x‖ for all ~x ∈ Rn.

TheoremAll norms on Rn are equivalent.

(10000, 1000, 1000) vs. (10000, 0, 0)?

CS 205A: Mathematical Methods Sensitivity and Conditioning 10 / 23

Page 14: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Matrix Norms:“Unrolled” Construction

A ∈ Rm×n↔ a(:) ∈ Rmn

‖A‖Fro ≡√∑

ij

a2ij

CS 205A: Mathematical Methods Sensitivity and Conditioning 11 / 23

Page 15: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Matrix Norms:“Induced” Construction

‖A‖ ≡max{‖A~x‖ : ‖~x‖ = 1}

What is the norm inducedby ‖ · ‖2?

CS 205A: Mathematical Methods Sensitivity and Conditioning 12 / 23

Page 16: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Matrix Norms:“Induced” Construction

‖A‖ ≡max{‖A~x‖ : ‖~x‖ = 1}

What is the norm inducedby ‖ · ‖2?

CS 205A: Mathematical Methods Sensitivity and Conditioning 12 / 23

Page 17: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Other Induced Norms

‖A‖1 ≡maxj

∑i

|aij|

‖A‖∞ ≡maxi

∑j

|aij|

CS 205A: Mathematical Methods Sensitivity and Conditioning 13 / 23

Page 18: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Question

Are all matrix normsequivalent?

CS 205A: Mathematical Methods Sensitivity and Conditioning 14 / 23

Page 19: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Recall: Condition Number

Condition numberRatio of forward to backward error

Root-finding example:

1

f ′(x∗)

CS 205A: Mathematical Methods Sensitivity and Conditioning 15 / 23

Page 20: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Model Problem

(A+ ε · δA)~x(ε) = ~b+ ε · δ~b

CS 205A: Mathematical Methods Sensitivity and Conditioning 16 / 23

Page 21: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Simplification (on the board!)

d~x

∣∣∣ε=0

= A−1(δ~b− δA · ~x(0))

‖~x(ε)− ~x(0)‖‖~x(0)‖

≤ |ε|‖A−1‖‖A‖

(‖δ~b‖‖~b‖

+‖δA‖‖A‖

)+O(ε2)

CS 205A: Mathematical Methods Sensitivity and Conditioning 17 / 23

Page 22: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Condition Number

Condition numberThe condition number of A ∈ Rn×n for a given

matrix norm ‖ · ‖ is condA ≡ κ ≡ ‖A−1‖‖A‖.

Relative change: D ≡ δ~b

‖~b‖+ ‖δA‖‖A‖

‖~x(ε)− ~x(0)‖‖~x(0)‖

≤ ε ·D · κ +O(ε2)

Invariant to scaling (unlike determinant!);

equals one for the identity.

CS 205A: Mathematical Methods Sensitivity and Conditioning 18 / 23

Page 23: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Condition Number

Condition numberThe condition number of A ∈ Rn×n for a given

matrix norm ‖ · ‖ is condA ≡ κ ≡ ‖A−1‖‖A‖.

Relative change: D ≡ δ~b

‖~b‖+ ‖δA‖‖A‖

‖~x(ε)− ~x(0)‖‖~x(0)‖

≤ ε ·D · κ +O(ε2)

Invariant to scaling (unlike determinant!);

equals one for the identity.

CS 205A: Mathematical Methods Sensitivity and Conditioning 18 / 23

Page 24: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Condition Number

Condition numberThe condition number of A ∈ Rn×n for a given

matrix norm ‖ · ‖ is condA ≡ κ ≡ ‖A−1‖‖A‖.

Relative change: D ≡ δ~b

‖~b‖+ ‖δA‖‖A‖

‖~x(ε)− ~x(0)‖‖~x(0)‖

≤ ε ·D · κ +O(ε2)

Invariant to scaling (unlike determinant!);

equals one for the identity.CS 205A: Mathematical Methods Sensitivity and Conditioning 18 / 23

Page 25: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Condition Number of Induced Norm

condA =

(max~x6=~0

‖A~x‖‖~x‖

)(min~y 6=~0

‖A~y‖‖~y‖

)−1

CS 205A: Mathematical Methods Sensitivity and Conditioning 19 / 23

Page 26: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Chicken ⇐⇒ Egg

condA ≡ ‖A‖‖A−1‖

Computing ‖A−1‖ typically requires solving

A~x = ~b, but how do we know the reliability of ~x?

CS 205A: Mathematical Methods Sensitivity and Conditioning 20 / 23

Page 27: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

To Avoid...

What is the condition number of computing the

condition number of A?

What is the condition number of computing what

the condition number is of computing the

condition number of A?

...

CS 205A: Mathematical Methods Sensitivity and Conditioning 21 / 23

Page 28: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

To Avoid...

What is the condition number of computing the

condition number of A?

What is the condition number of computing what

the condition number is of computing the

condition number of A?

...

CS 205A: Mathematical Methods Sensitivity and Conditioning 21 / 23

Page 29: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Instead

Bound the conditionnumber.

I Below: Problem is at least this hard

I Above: Problem is at most this hard

CS 205A: Mathematical Methods Sensitivity and Conditioning 22 / 23

Page 30: Sensitivity and Conditioning - Computer Graphics...Setup Norms Conditioning Computing Condition Number How are Norms the Same? Equivalent norms Two norms kkand kk0are equivalent if

Setup Norms Conditioning Computing Condition Number

Potential for Approximation

‖A−1~x‖ ≤ ‖A−1‖‖~x‖⇓

condA = ‖A‖‖A−1‖ ≥ ‖A‖‖A−1~x‖

‖~x‖Next

CS 205A: Mathematical Methods Sensitivity and Conditioning 23 / 23