What exactly is the Dot Product?

Started by
16 comments, last by JuNC 19 years, 4 months ago
Hello, My book states that the dot product is an operation used through 3D graphics and its also called the inner product. My book also says that you could use the dot product to calculate the angle between two vectors like so :

Vector3 vA, vB ;

// Basically you get the dotProduct between both vectors divided by the 
// product of both magnitudes <b>and then</b> get the inverse cosine of that value.
float fAngle = acosf( vA*vB / vA.Length()*vB.Length() ) ;

// Note : Vector3::operator* returns the dotProduct
// and Vector3::Length() returns the magnitude.




Ok.........but what exactly is the dot product? What does it return? From the above equation all the dot product serves as is a small tool to find the angle between two vectors.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
Advertisement
Thats like saying 'what is multiplication' or 'what is addition'. The dot product is defined between two vectors as:

A dot B = |A| * |B| * cos( theta )

Where theta is the angle between A and B.

If A and B are represented by triples then:

A dot B = Ax * Bx + Ay * By + Az * Bz

(or Ax * Bx + Ay * By in two dimensions, similar for extension to other dimensions)

Also beware the term 'inner product'. There are many inner products, defined in different ways on different spaces. The dot product as above is the main inner product used in graphics though.

Try MathWorld for a more detailed treatment.
Alright. My apoligies for asking a real stupid question. Its just my book gave a very poor explanation of it and I was lost in the dark.

Thank you...
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
Hehe, give me a chance to finish editing :) It wasn't a stupid question, but a bit of google research would have answered it better than any post here.
a dot product is an operation between two elements of a vector space Rn (vector space of dimension n). it is called inner product as it operates on two elements of the same vector space and returns a scalar value k (element of R, real values). if it would not be an inner product it would operate an element of Rn on some element not in Rn (like for example scaling a vector with a value from R). the dot product is used to defined ortogonality. so if you've got a base of Rn (n vectors, non-linear-combinable) then you can define them beeing ortogonal if they all do pair-wise have a dot-product of 0.

i'm no native english speaker thus it's a bit tricky to find the correct terms. i hope i made no mistake here. ^_^

EDIT: duh... over-edited with 3 postings... some are quick at writing ^_^

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

I don't think you quite understand either, perhaps if you read the link I gave you'd get a better idea. The dot product is *one way* of multiplying vectors together to give a scalar, and you can't differentiate that meaning from all of the other ones we gave (they're all essentially equivalent, given the constraints that have been mentioned).

Simplistic answers to questions like this help absolutely noone, it is vitally important to understand the what and why in order to correctly use any concept.

Using the * operator is in general not a very good idea for the dot product because the semantics are different between vectors and scalars:

SCALAR = SCALAR * SCALAR
SCALAR = VECTOR dot VECTOR
VECTOR = SCALAR * VECTOR

The * is used between members of the field you're working in, and for operations between the field and vector space. The dot product is a fundamentally different operation and should use a different operator (or explicit function).
Quote:
a dot product is an operation between two elements of a vector space Rn (vector space of dimension n).


Nitpick: you can define inner products on other vector spaces than R^n, and there are other n-dimensional spaces than R^n.

Quote:
at the most fundamental level, that's what it "really is."


What on earth could be more fundamental than the actual definition (which was given in the first reply)?
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Quote:Original post by Muzzafarath
What on earth could be more fundamental than the actual definition (which was given in the first reply)?

RPTD's formal definition. The specific definition you refer to is just one consequence of that lemma. The OP's questiion was pretty ambigious, though [smile]
Quote:
Original post by shadow12345
No, it's the only way of multiplying a vector with another vector. Multiplying a vector by a scalar is different, and I'm pretty sure that's not called a dotproduct.


Read this link then come back and we'll discuss it.
Quote:
RPTD's formal definition. The specific definition you refer to is just one consequence of that lemma. The OP's questiion was pretty ambigious, though


RPTD didn't give the full definition anyway, any function that takes two vectors and spits out a real number is not an inner product. There's more to it than that.

And I assure you that the definition of the "usual" dot product in R^3 is not the consequence of any lemma (then it wouldn't be a definition).

Quote:
No, it's the only way of multiplying a vector with another vector. Multiplying a vector by a scalar is different, and I'm pretty sure that's not called a dotproduct.


I see. So I guess "weighted dot products" (that's probably not what they're called in English) don't exist then...

*edit*

Quote:
So, umm, doesn't this only back up what I was saying?


No. It says that the "usual" dot product is /A/ way to multiply two vectors. Not /the only/ way.
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement