Docsity

Solving Overcomplete Systems with Least Squares, Study notes of Computer Graphics

Partial preview of the text

Download Solving Overcomplete Systems with Least Squares and more Study notes Computer Graphics in PDF only on Docsity!

Math for CS

Lecture 4

1

Linear Least Squares Problem

Consider an equation for a stretched beam:Y = x

  • x 1 2
T

Where x

is the original length, T is the force applied and x 1 is the inverse coefficient of stiffness.Suppose that the following measurements where taken:T 10

Y 11.60 11.

Corresponding to the overcomplete system:11.60 = x1 + x2 1011.85 = x1 + x2 15

  • can not be satisfied exactly

12.25 = x1 + x2 20

Math for CS

Lecture 4

Linear Least Squares Problem

Problem: Given A(m x n), m

ïn, b(m x 1) find

x (n x 1) to minimize

||A x -b||

-^ If

m > n

, we have more equations than the number of unknowns, there is generally no x satisfying Ax=bexactly.• This is an overcomplete

system

Math for CS

Lecture 4

0LQLPL]HWKHVTXDUHG(XFOLGHDQQRUPRIWKHUHVLGXDOYHFWRU 7RPLQLPL]HZHWDNHWKHGHULYDWLYHZLWKUHVSHFWWR[DQGVHWLWWR]HUR:KLFKUHGXFHVWRDQ

Q[Q

OLQHDUV\VWHPFRPPRQO\

NQRZQDV1250$/(48$7,216

Normal Equations 1

Math for CS

Lecture 4

Normal Equations 2

11.60 = x1 + x2 1011.85 = x1 + x2 1512.25 = x1 + x2 20

A^

x^

b min||A

x -b||

2

Math for CS

Lecture 4

QR factorization 1

-^ A matrix Q is said to be orthogonal if its columns areorthonormal, i.e. Q

T·Q=I.

-^ Orthogonal transformations preserve the Euclidean normsince •^ Orthogonal matrices can transform vectors in variousways, such as rotation or reflections but they do notchange the Euclidean length of the vector. Hence, theypreserve the solution to a linear least squares problem.

Math for CS

Lecture 4

QR factorization 2

Any matrix

A^ (m·n)

can be represented as

A = Q
·R

,where

Q(m·n)

is orthonormal and

R(n·n)

is upper triangular:

^

@^ >^

@

∫ ª ª ª ª º ™ ´ ´ò ´ ´ ¨

n nn

n n

r r

r rr q q a a

(^00) 0 00 0 |...| |...|

11

1 (^1211) 1 1

! !!^ !!

Math for CS

Lecture 4

Singular Value Decomposition • Normal equations and

QR^ decomposition only work

for fully-ranked matrices (i.e. rank( A) = n). If A isrank-deficient, that there are infinite number ofsolutions to the least squares problems and we canuse algorithms based on SVD's. • Given the SVD: U (m x m)^

, V(n x n)

are orthogonal is an (m x n) diagonal matrix (singular values of A)The minimal solution corresponds to:

Math for CS

Lecture 4

Singular Value Decomposition

Matlab Code:

Math for CS

Lecture 4

13

$SSUR[LPDWLRQE\DORZ

UDQNPDWUL[

(^

) (^

) {^

}^

(^

)^

1 2

2 2 )(rank:

2

(^21)

1

(^21)

1

min

in ion to approximat rankbest theIs

~diag( , ~

Then

,of SVDthe be

let

rankhave let:II Fact

= = × =

= ∑

∑

r

r

r

r i

T ii i

p

p i

T ii i nm r

pr

p

T

XX

T

T

V
U
AA
XA
V A
U

vu A

A

vu VU A

A

Math for CS

Lecture 4

*HRPHWULF,QWHUSUHWDWLRQRIWKH

69'

x Ab nm^

òu

The image of the unit sphere under any m

x n matrix is a

hyperellipse

v^1

v^2

·v^2

·v^1

Math for CS

Lecture 4

6LQJXODU9DOXH'HFRPSRVLWLRQ

A v = i

u^ , i^ i

(^1) î^ i^ î^ n

),( 1 2 ),( (^21) ),( (^21) ), (

n^ nn

n nm n nn nm

uu u

A

∫ ª ª ª ª º ™∫´ª´ª´ª´º¨ ™∫ ´ª ´ª ´ª¨º

∫ ª™ª´ª´ª´¨ª ªº ™ ´ ´ ´ ´ ´ ´¨

V V V

QQQ

! ! !^6 UAV Matrices U,V are orthogonal and

is diagonal *****^ - Singular Value decomposition VU A^

6

Math for CS

Lecture 4

0DWULFHVLQWKH'LDJRQDO)RUP Every matrix is diagonal in appropriate basis:Any vector

b can be expanded in the basis of left singular vectors of A {u(m,1)^

};i

Any vector

x can be expanded in the basis of right singular vectors of A {v(n,1)^

};i

Their coordinates in these new expansions are:Then the relation b=Ax can be expressed in terms of b

’ and x’: x Ab nm^

òu

xV x bU b^

ò

ò^


*****^

’ ; ’

’


***^

x b xV UU xA Ub U xA b^

6 ú 6

ò ú

Math for CS

Lecture 4

'HWHUPLQDQWRI$

For A

,(m,m) Proof:The^

determinant

of a

product

of^ square

matrices

is^ the

product of their determinants. The determinant of a Unitarymatrix is 1 in absolute value, since: U

m ñ i i *^ U=I. Therefore,

A^

|^1

det(|

V

6 ñ

6

6

m i i V U VU A^

**1


*****^

|) det(||) det(||) det(||) det(||) det(||) det(|

V

Math for CS

Lecture 4

For A

, can be written as a sum of r rank-one matrices:(m,n)

Proof:If we write

as a sum of

, wherei

=diag(0,..,i^

,..0), theni^

(1) Follows from

$LQWHUPVRIVLQJXODUYHFWRUV

rj

vujjj A^

1


V

***** V U A^

6