Friday, May 21, 2010

How can I find a constant c such that norm(c*v1 - v2) is as close to 0 as possible?

I have two vectors, they are nearly linearly dependent. I would like to normalize them in a least squared sense. How can I do this?

How can I find a constant c such that norm(c*v1 - v2) is as close to 0 as possible?
The square of the norm of c*v_1 -v_2 is the inner product


%26lt;c_1 -v2, c v1 -v2%26gt;


=c^2 %26lt;v1,v1%26gt;-2c%26lt;v1,v2%26gt;+%26lt;v2,v2%26gt;.


This is a quadratic in c so is minimized when


c=%26lt;v1,v2%26gt;/%26lt;v1,v1%26gt;
Reply:Project vector v2 on v1. The projection is the c*v1 you are looking for.





Algebraic derivation: minimize the squared norm.





[1] ... |c*v1 - v2|^2 is minimal


[2] ... c^2|v1|^2 - 2c(v1.v2) + |v2|^2 is minimal





The minimum of ax^2 + bx + c is found when x = -b/2a; here:





[3] ... c = (v1.v2) / |v1|^2
Reply:write it out (this depends on your norm i use euclidean)


: r(c) = (cx1-x2)^2 +(cy1 - y2)^2





v1 =(x1,y1), v2=(x2,y2) all given.


r(c) is a parabole minimize for c.
Reply:c*v1 -v2 Set this to 0


c*v1 -v2 =0 Add v2 to both sides


c*v1 = v2 Now divide both sides by v1


c = v2/v1 Now plug this value into c and when you do the original problem it should equal 0.


No comments:

Post a Comment