logoalt Hacker News

bsolesyesterday at 6:07 PM2 repliesview on HN

> Summary: A dot product is a weighted sum of two vectors.

Nope. This is incorrect. The dot product is a weighted sum of a vector's elements, where the weights are the elements of the other vector. Weighted sum of two vectors would require a third entity to provide the weights.


Replies

evanbyesterday at 8:48 PM

A dot product is a weighted sum of two vectors, but not in the way the author suggested. The author's use is that one of the vectors is the weights and the other is 'the' vector, so the dot product is the weighted sum of ONE vector. It just so happens that because the author is not interested in the geometric interpretation of the dot product that they forgo the metric.

On the other hand, it is common to need a metric, which is actually the set of weights in the dot product. If `g` is the metric,

    dot(a, g, b) = np.einsum('x,xy,y->', np.conj(a), g, b)
g doesn't have to be diagonal, but if you want the dot product to be symmetric in a and b it ought to be self-adjoint. Then you can find a basis where g is diagonal with real diagonal elements, which you can interpret as the weights.
tptacekyesterday at 6:56 PM

It's an interesting callout; if you go Google "weighted sum of two vectors", it's not too hard to find more authoritative sources (nothing as authoritative as Axler or Strang, of course) describing either a dot product or a linear combination in those terms.