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

Dot, Scalar, Inner Product Question

  1. Dec 4, 2008 #1
    I have been searching for a way to relate known concepts (known to me) to the computation of the dot product in an effort to understand why it takes the form it does. I ran into a little snippet in a classical dynamics book that seems like it just may be the ticket.

    Here is what it says:
    From analytical geometry we recall that the formula for the cosine of the angle between two line segments is ​

    [tex]cos (\theta) = \frac{A_{x}B_{x}+A_{y}B_{y}+A_{z}B_{z}}{(A_{x}^{2}+A_{y}^{2}+A_{z}^{2})^{1/2}(B_{x}^{2}+B_{y}^{2}+B_{z}^{2})^{1/2}}[/tex]

    Then by rearranging and using a definition of dot product we get:

    [tex]\vec{A}\bullet\vec{B} := A_{x}B_{x}+A_{y}B_{y}+A_{z}B_{z}[/tex]

    [tex]\vec{A}\bullet\vec{B} = cos(\theta)(A_{x}^{2}+A_{y}^{2}+A_{z}^{2})^{1/2}(B_{x}^{2}+B_{y}^{2}+B_{z}^{2})^{1/2}[/tex]

    So the real question is: where in analytical geometry can I find this formula for the cosine of the angle between two line segments?
  2. jcsd
  3. Dec 4, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

    Hi Prologue! :smile:

    it's the cosine rule:

    (a - b).(a - b) = a.a + b.b - 2√(a.a)√(b.b)cos(c) :wink:
  4. Dec 4, 2008 #3


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I just tried it and it is pretty straightforward. Start with two vectors [itex]\vec{A}[/itex] and [itex]\vec{B}[/itex]. Normalize [itex]\vec{B}[/itex] by setting [itex]\vec{B'}:=\vec{B}/||\vec{B}||[/itex] and let c be the constant such that [itex]||\vec{cA}||^2+||\vec{B'}-(cA)||^2=1[/itex]. This means that c is the scaling constant such that B' and cA form a right angled triangle with B' as the hypothenuse. Now by definition of the cosine of an angle (if I remember my high school math correctly), [itex]\cos\theta = ||c\vec{A}||[/itex].

    So just solve for c in the equation above and inject in the defining equation for cos\theta. I tried it and it works!
  5. Dec 5, 2008 #4
    I see, but it isn't what I was looking for *deflation*. But even though that didn't lead me to a satifying conclusion, maybe I can and pose it differently.

    I am really just trying to figure out why it is so darn simple. To find a dot product, you just take the contributions of the vectors in the same direction, multiply, then repeat, then sum. Why should it be (hopefully based on a visual/spatial argument *fingers crossed*) that this is the way that works?

    We say things like, the projection of A onto B, or something of the sort. And when you break them into components, it literally is THE projection of each component onto the others component, then sum them. Why is it that this works?

    It's so simple that it is begging for a simple explanation.
  6. Dec 5, 2008 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Possibly interesting reading:
    "The Geometry of Dot and Cross Products" by Tevian Dray and Corinne A. Manogue
    [URL [Broken]
    Last edited by a moderator: May 3, 2017
  7. Dec 7, 2008 #6


    User Avatar
    Science Advisor
    Homework Helper

    Hi Prologue! :smile:

    I think it's ultimately because perpendicular vectors have zero dot-product, and components in different directions are perpendicular, so when you multiply two vectors, you end up just multiplying the "same-direction" component-pairs, and adding:

    (∑i aiei).(∑i biei) = ∑ijaibj(ei.ej) = ∑iaibi(ei.ei) = ∑iaibi :smile:
  8. Dec 7, 2008 #7


    User Avatar
    Science Advisor
    Homework Helper

    do you want to know why the law of cosines is true or why math is beautiful?

    the law of cosines appears in euclid, and is a corollary of pythagoras.

    learning to phrase the law of cosines as a kind of multiplication of vectors is probably due to some obscure genius.

    math is beautiful because........?
  9. Dec 7, 2008 #8
    Thank you for the replies everyone.

    I would like to come at it a little different way. I'd like to look at the line of logic that starts with, 'We need something called a Dot Product because we would like to multiply vectors and this is how it works out.', and ends up with the dot prduct identity.

    So, we want to multiply vectors. Then, I suppose, we decide that the only sensible way to do that is to say 'we only want to multiply the parts of the vectors that go in the same direction' (say that we put this constraint on as a result of a physical situation, maybe work). We then work out the geometry to find that no matter which vector we use as the reference we end up with the same result (B onto A or A onto B). Well, that is handy but now what is the best way to compute this with our contraint and with the rule we just found about commutation?

    Let's say that we have two vectors A and B. A = [Ax,Ay] and B = [Bx,By].

    http://img168.imageshack.us/img168/4715/dotproduct1es8.png [Broken]

    Now let us presume that for the purpose of finding the dot product we can rotate the coordinate axes that we use to measure the vectors, in any direction we please, as long as we preserve the positioning of the vectors relative to each other.

    http://img168.imageshack.us/img168/1315/dotproduct2dh7.png [Broken]

    We now have an easy way to find the dot product in 2d. In this case it is merely the component of the vector A in the x' direction, times the magnitude of the vector B.

    http://img166.imageshack.us/img166/2082/dotproduct4th1.png [Broken]

    Now we just have to show that

    (1) [tex]A_{x'}|\vec{B}| = A_{x}B_{x}+A_{y}B_{y}[/tex]

    or equivalently

    (2) [tex]|\vec{A}||\vec{B}| cos(t)= A_{x}B_{x}+A_{y}B_{y}[/tex]

    Using (2):

    [tex]\sqrt{A_{x}^{2}+A_{y}^{2}}\sqrt{B_{x}^{2}+B_{y}^{2}} cos(t)= A_{x}B_{x}+A_{y}B_{y}[/tex]

    Now I just need a way to find cos(t). It's late so I'll quit now and fumble with it some more later.
    Last edited by a moderator: May 3, 2017
  10. Dec 8, 2008 #9


    User Avatar
    Science Advisor
    Homework Helper

    Hi Prologue!

    I wish you well on your quest. :smile:

    Here's a few comments to help/hinder you:

    i] you've specified a.b = b.a (commutativity) … but why not a.b = -b.a? :wink:

    ii] you've specified rotational invariance

    iii] shouldn't you specify distributivity: a.(b+c) = a.b + a.c?

    iv] what's wrong with a scalar product defined as a.b = absin? :smile:
  11. Dec 8, 2008 #10


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

  12. Dec 8, 2008 #11

    i] I think this is shown to not be true numerically in the geometric interpretation and generally when you convert it to algebra. In other words there is no direction associated with the dot product, only whether or not the two vectors have >90 degrees or < 90 degrees between them (the projected components point in 'opposite' directions). :)

    ii] Yeah and I think it is clear that it works when looked at geometrically.

    iii] Yeah that could be done (as you know) but I struggle to see how it would help. It seems to me that breaking things down into a math notation is good for computing the result, but is not good in this case for visualizing.

    iv]Nothing is wrong with it, it just doesn't fit physically (as in trying to find work).

    The last post shows basically what I understand of the argument and I think it demonstrates the problem I am having.

    Fundamental disconnection:


    Why is this true?

    I see that it works in certain cases (see below) but what is the generality that makes it all click?

    http://img373.imageshack.us/img373/3695/dotproduct6fg1.png [Broken]

    You can see from this diagram that


    But how is there some visual/geometric generalization that pulls it all together for every relationship?
    Last edited by a moderator: May 3, 2017
  13. Dec 8, 2008 #12

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    It comes from the law of cosines and the Euclidean distance in R3 (or more generally in Rn). Given a triangle with sides a, [/i]b[/i], and c, the angle between the sides a and b is given by

    [tex]\cos\theta = \frac{a^2+b^2-c^2}{2ab}[/tex]

    Now imagine a triangle with one vertex at the origin, another at point a and another at point b. Using the Euclidean norm,

    a^2 &= \sum_i a_i^2 \\
    b^2 &= \sum_i b_i^2 \\
    c^2 &= \sum_i (a_i-b_i)^2

    With the above the numerator in the law of cosines becomes

    a^2+b^2-c^2 &= \sum_i a_i^2 + b_i^2 - (a_i-b_i)^2 \\
    &= 2\sum_i a_i b_i

    and thus

    [tex]\cos\theta = \frac{\sum_i a_i b_i}{\sqrt{\sum_i a_i^2}\,\sqrt{\sum_i b_i^2}}[/tex]
  14. Dec 8, 2008 #13
    Well, D H, I think that pretty much takes care of all of my confusion. Thank you!

    And thanks to everyone else, I know it was said many times that it comes from the law of cosines but I just couldn't see where it happened. Now I do, thanks again.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook