16
$\begingroup$

When I run dot(a,b) in MATLAB, I get a very different number than $\sum a_i \times b_i$, but is that not how one takes a dot product? For instance:

A = [1+i 1-i -1+i -1-i];
B = [3-4i 6-2i 1+2i 4+3i];
dot(A,B)
% => 1.0000 - 5.0000i
A(1)*B(1)+A(2)*B(2)+A(3)*B(3)+A(4)*B(4)
% => 7.0000 -17.0000i
$\endgroup$
1
  • 1
    $\begingroup$ I've got to say: what prompted this is that I found that BLAS' zdotu does not take the complex conjugate the second operand. $\endgroup$
    – Jellicle
    Oct 25, 2017 at 18:55

2 Answers 2

20
$\begingroup$

There is a different definition when you work with complex vectors. The dot product for complex vectors is defined as: $$\mathbf{A}\cdot\mathbf{B}=\sum_i a_i\overline{b_i}$$ Maybe this link could help: Complex dot product

$\endgroup$
0
12
$\begingroup$

The Wikipedia page Isai linked to basically says it all, but I think it is worth unpacking some of the definitions given there here with a bit more motivation.

To generalize the usual $\mathbb{R}^n$ dot product, what we can do is to look at the properties of that dot product, and then see if we can come up with something in $\mathbb{C}^n$ that has similar properties.

One characterization of the regular dot product is as being a "symmetric positive-definite bilinear form". Let's unpack:

  • symmetric: $\vec{v} \cdot \vec{w}$ = $\vec{w} \cdot \vec{v}$. This is linked to the notion of the angle between two vectors being the same regardless of order.

  • positive definite: $\forall \vec{v} \ne \vec{0}, \vec{v} \cdot \vec{v} > 0$. This corresponds to our usual notion of the "size of a vector being a positive real number". Remember that a inner product like the dot product naturally induces a norm

  • bilinear: linear in both arguments, i.e. $(a \vec{v}) \cdot \vec{w}$ = $a (\vec{v} \cdot \vec{w})$ and $(\vec{v} + \vec{u}) \cdot \vec{w} = (\vec{v} \cdot \vec{w}) + (\vec{u} \cdot \vec{w})$

  • form: in the context of linear algebra, a form is a (multi-)linear map that has codomain as the underlying field of a vector space, e.g. from $\mathbb{R}^n$ to $\mathbb{R}$, $\mathbb{C}^n$ to $\mathbb{C}$

    Note however that the complex are not orderable, so this definition of "form" won't work well with "positive definiteness" for the complex numbers, unless we pick a form that maps $\mathbb{C}^n$ to $\mathbb{R}$

The standard definition of the complex product mentioned by Isai:

$$\vec{v} \cdot \vec{w} = \sum_i v_i\overline{w_i}$$

is one that does what it can to salvage the positive definiteness, but it has to sacrifice some of the other properties in the process:

  • symmetric: sacrificed, obviously, since $v_i \overline{w_i} \ne w_i \overline{v_i}$ in general.

    What is maintained however is $\vec{v} \cdot \vec{w} = \overline{\vec{w} \cdot \vec{v}}$. And we also note that this version is also valid for the real forms, since for real numbers $a = \overline{a}$, so we could use it as a more general version of symmetry that is maintained in both cases.

  • positive definite: maintained. E.g. if we consider $\mathbb{C}^1$:

    $$(a + bi) \cdot (a + bi) = (a + bi)(a - bi) = (aa + -abi + bia -bbii) = a^2 + b^2$$

    So we see that this form always maps to positive real numbers, not arbitrary complex numbers, and so it makes sense to talk about positive definiteness.

    As mentioned by boojum in the comments, a huge motivation for keeping this property is quantum mechanics, where $\psi \cdot \psi$ is the sum of the probabilities of every possible outcome of an experiment, which we want to always be the real positive number 1.

  • bilinear: for addition is maintained:

    $$\vec{v} \cdot \overline{\vec{w} + \vec{u}} = \vec{v} \cdot \overline{\vec{w}} + \vec{v} \cdot \overline{\vec{u}}$$

    but for scalar multiplication, it is maintained only if the scalars are real, otherwise:

    $$v_i \overline{(a + bi) w_i} = (a - bi) v_i \overline{w_i} \ne (a + bi) v_i \overline{w_i}$$

    We could however cheat here once again as for symmetry, and say that the real multiplication linearity on the second argument should actually be defined as:

    $$\vec{v} \cdot a \vec{w} = \overline{a} \vec{v} \cdot \vec{w}$$

    which would work on both real and complex cases.

  • form: maintained obviously

This complex "dot product" is sometimes called a Hermitian form. This specific separate term serves as a way to make it clear that it might not comply with the usual definition of a dot product, if you don't generalize that definition as shown above.

$\endgroup$
3
  • 1
    $\begingroup$ Anyone who has taken quantum mechanics has likely seen this as $ \ \langle \ \phi | \psi \ \rangle \ = \ \phi \psi^{\ast} \ \ , \ $ with the "star" denoting complex conjugation. (So they were using this "dot product" perhaps not being aware of it.) The square of the "magnitude" of a wavefunction, $ \ \psi \psi^{*} \ $ is a real number treated as a "state probability" (the sum for "all events" "normalized" to 1). $\endgroup$
    – user882145
    Aug 4, 2022 at 7:51
  • 1
    $\begingroup$ An aging mathematician with failing eyesight begs you to avoid using “$a$” and “$\alpha$” in the same formula, and most especially, as here, next to each other. $\endgroup$
    – Lubin
    Aug 14, 2022 at 15:28
  • $\begingroup$ @Lubin I always thought that mathematicians were a bit mad to use non ASCII characters (e.g. compared to software identifiers), and especially weird fonts, to differentiate their symbols. But now that I get a chance to torture them with it, I see it is not so bad after all ;-) $\endgroup$ Aug 18, 2022 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .