## Dot Product's imaginary component (dot.m)

### Dot Product's imaginary component (dot.m)

Hi, I am just learning about dot products. Why is the built in function dot(u,v) returning the complex conjugate of what I think the right answer is (and the answer in my Professors notes).

x = (2; 1 + i; i)
y = (2 - i; 2; 1 + 2i)

< x; y >= 2(2 + i) + (1 + i)(2) + i(1 - 2i) = 4 + 2i + 2 + 2i + i - 2i^2 = 8 + 5i

but:
EDU>> x=[2,1+i,i]; y=[2-i,2,1+2i];
EDU>> dot(x,y)
ans =
8 - 5i <-- wrong answer

note, though:
EDU>> dot(y,x) <-- backwards
ans =
8 + 5i <-- right answer

### Dot Product's imaginary component (dot.m)

For two column vectors x and y, dot is defined as x' * y. The first vector is conjugated. In addition to MATLAB, that is also the way the dot product is defined in other languages as well, e.g. Fortran. So MATLAB is being consistent with other languages.

James Tursa

### Dot Product's imaginary component (dot.m)

If I remember correctly, for a Hermitian product, the choice of which vector to conjugate is arbitrary. I have seen it both ways.

### Dot Product's imaginary component (dot.m)

Thanks.

My textbook and teacher conjugates the second one (or I'm reading it wrong - I haven't had anything to do with complex numbers since HS over a decade ago). I guess learning which one to conjugate is a subject for the future (or a question for my prof).

### Dot Product's imaginary component (dot.m)

Oh wait (don't read that last post!). You can define many dot products in a vector space. :D.