Euclidean distance and dot product
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?
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)$$
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*} $$
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.