Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Euclidean distance and dot product

Writer Emily Wong
$\begingroup$

I've been reading that the Euclidean distance between two points, and the dot product of the two points, are related. Specifically, the Euclidean distance is equal to the square root of the dot product. But this doesn't work for me in practice.

For example, let's say the points are $(3, 5)$ and $(6, 9)$. The Euclidean distance is $\sqrt{(3 - 6)^2 + (5 - 9)^2}$, which is equal to $\sqrt{9 + 16}$, or $5$. However, the dot product is $(3 * 6 + 5 * 9)$, which is $63$, and the square root of this is not $5$.

What am I getting wrong?

$\endgroup$ 2

4 Answers

$\begingroup$

Apart of the other anwers, there is indeed a relation between Euclidean distance $d(X,Y)$ and the inner product $\langle X, Y \rangle$ if the vectors $X, Y \in \mathbb{R}^N$ are normalized, that is $\langle X, X \rangle=\langle Y, Y \rangle = 1$, in particular $$\frac{d(X,Y)^2}{2} = 1 - \langle X, Y \rangle.$$ This can be shown as $$d(X,Y)^2 = \langle X - Y, X - Y \rangle = \langle X, X \rangle + \langle Y, Y \rangle - 2 \langle X, Y \rangle = 2 (1 - \langle X, Y \rangle)$$

$\endgroup$ 2 $\begingroup$

In $\mathbb{R}^{2}$, the distance between $\displaystyle X = \begin{pmatrix} x_{1} \\ x_{2} \end{pmatrix}$ and $\displaystyle Y = \begin{pmatrix} y_{1} \\ y_{2} \end{pmatrix}$ is defined as :

$$ d(X,Y) = \Vert Y - X \Vert = \sqrt{\left\langle Y-X,Y-X \right\rangle}. $$

with $\left\langle Y-X,Y-X \right\rangle = (y_{1}-x_{1})^{2} + (y_{2}-x_{2})^{2}.$

So, if $\displaystyle X=\begin{pmatrix} 3 \\ 5 \end{pmatrix}$ and $\displaystyle Y = \begin{pmatrix} 6 \\ 9 \end{pmatrix}$,

$$\begin{align*} d(X,Y) &= {} \sqrt{\left\langle \begin{pmatrix} 3 \\ 4 \end{pmatrix},\begin{pmatrix} 3 \\ 4 \end{pmatrix}\right\rangle} \\[2mm] &= \sqrt{9 + 16} \\[2mm] &= \sqrt{25} \\[2mm] &= 5. \end{align*} $$

$\endgroup$ 4 $\begingroup$

The squareroot of dot product formula is for the distance to $(0,0).$ So one has to get the difference of the two vectors first, then apply.

$\endgroup$ $\begingroup$

distance=$D=\sqrt{((|A|^2-(A\cdot B)^2)+(|B|-(A\cdot B))^2)}$

I found this geometrically like this:an image showing how I found this formula for D geometrically

sorry for the lousy formatting, this is my first time posting here. I needed to find D in terms of norms and dot products for my linear algebra homework, as I assume most people asking this question are, and the other answers weren't helpful to me. I don't know where the original asker got that $D=\sqrt{A\cdot B}$, but hopefully the equation I found for my homework will be useful to others trying to find how D is related to the dot product.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy