Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Linear Algebra: Least Squares and vectors

  1. Nov 27, 2005 #1
    Hi, I was working on a problem and I can't figure out what I'm supposed to do.

    It reads, find the vector in subspace S that is closest to v; write v as the sum of a vector in S and a vector in S^a; and find the distance from v to S.

    S spanned by {(1,3,4)} v = (2,-5,1)

    Ok, what I did was I used some equation to find a least squares solution to Ax = b, where b is v and A is S.

    So I took S and multiplied it by (1,3,4) and obtained 26.

    And I then multiplied v by (1,3,4) and obtained -17

    So the equation became:

    26x = -17

    x = -17/26

    So when I multiply what I obtained for x and the vector that spans S together, I should get the point closest to v in/on S right?

    Now, to find v as a sum of a vector in S and a vector in S^a, I just did the gram schmidt process.

    Its long so instead of writing it out I'll just give you my answer:

    This vector is orthogonal to the vector that spans S, the dot product is 0.

    So, assuming all of that is correct, I reached the point where I have to tell how far v is from S. I know where they're closest, when the vector in S is multiplied by the constant we obtained for x (-17/26). I have an orthogonal vector to S, but what am I supposed to do now? How do I write v as a sum of vectors in S and S^a , and how do I find the distance?
    Last edited: Nov 27, 2005
  2. jcsd
  3. Nov 28, 2005 #2


    User Avatar
    Science Advisor

    S is a subspace. How do you multiply a vector times a subspace??

    ?? The dot product of (1,3,4) and (2,-5,1) is 2- 15+ 4= -9.
    I can't make heads or tails out of what you are doing. Since S is spanned by a single vector, it is a straight line in R3. What you are really doing is projecting v onto that straight line.
    I suspect that when you say "So I took S and multiplied it by (1,3,4) and obtained 26" what you really did was take the dot product of (1,3,4) (I'm going to call that "u") with itself, getting 26 as the square of its length. Okay, you want that because the length of the projection of v onto S is the dot product of u with v divided by the length of v:

    The projection vector is a unit vector in the direction of (1,3,4), which is just (1,3,4) divided by [itex]\sqrt{26}[/itex] times that: That is
    [tex]\frac{-9}{26}(1,3,4)= \left(\frac{-9}{26},\frac{-27}{26},\frac{-36}{26}\right)[/tex]
    I'm going to call that "w".
    Since w is the orthogonal projection of v in S, v- w is orthogonal to S.
    v-w=[itex]\left(2+\frac{9}{26},-5+\frac{27}{26},1+\frac{36}{26}\right)= \left(\frac{61}{26},-\frac{103}{26},\frac{62}{26}\right)[/tex]

    The length of that vector is the "distance" from v to its orthogonal projection on S, w.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook