Skip to main content

Vector

A vector are elements that can be added together and scaled by a constant. It is represented as a list of numbers. The dimension of a vector is the number of elements in the list. An example of a vector of size 3.

(147)\begin{pmatrix} 1 \\ 4 \\ 7 \end{pmatrix}

Vectors can be through of as points in a high dimensional space. You can compute the L2L_2 distance (meaning regular distance) between vectors using the formula (for 2 vectors of the same size aa and bb):

d=(aβˆ—xβˆ’bx)2+(azβˆ’bz)2+(azβˆ’bz)2d = \sqrt{(a*x - b_x)^2 + (a_z - b_z)^2 + (a_z - b_z)^2}

Or, in general, for vectors with nn dimensions:

d=βˆ‘nβˆ—i=0(aiβˆ’bi)2d = \sqrt{\sum^{n}*{i=0} (a_i - b_i)^2}

Or, even more in general, you can compute the LkL_k distance (with kβ‰₯1k \geq 1) as:

dk=(βˆ‘i=0n(aiβˆ’bi)k)1/kd_k = \biggl(\sum^{n}_{i=0} (a_i - b_i)^k\biggr)^{1/k}