I've been playing around with the Pythagorean theorem trying to find equivalent metrics for distance that don't involve squaring and rooting.
From the definition of cosine it's easy to see that, given a triangle with sides $a, b, c$ and angles $A, B, C$, the length $c$ is simply $a*\cos(B) + b*\cos(A)$.
This works on any triangle, not just right triangles.
Now suppose we want to use this formula as a distance metric in Euclidean space. We'll now label the sides $x, y, d$ where we are given x and y and wish to find d.
According to the above, $d = x*\cos(Y) + y*\cos(X)$ if we can find the angles $X, Y$. If we're given orthogonal axes then it is easy to determine that those angles are $X = \tan^{-1}(x/y)$ and $Y =\tan^{-1}(y/x)$.
This gives us the generalized $d = x*\cos(\tan^{-1}(y/x)) + y*\cos(\tan^{-1}(x/y))$ metric for distance.
I have a few questions about this metric:
- This should work even if x and y do not fall on orthogonal axes (though you'll have to find X and Y differently). Is that useful in any way? If so, I'm sure it's been used before. What have I stumbled upon?
- Is there any (elegant) way to show that the above reduces to $\sqrt{x^2+y^2}$ when $x$ and $y$ are on orthogonal axes?
- how can this be generalized to $n$-space? (it's easy to scale the Pythagorean theorem up to $\sqrt{x^2+y^2+z^2}$ and beyond, but I imagine it would be more complex to scale this).