# Spreading vectors around an area

1. Aug 19, 2008

### wbrigg

hey all,

I was wandering if there was a way to spread vectors as evenly as possible through space (all originating from the same point.

In 2D, this is easy, i just divide a unit circle into the number of peices i require (or in the specific case i'm looking at it for, i divide the 1st quadrant into that many peices).

In 3D it gets harder though. i figured it's effectively the same thing as spreading dots evenly around a sphere, and it seems there's no way (on the internet) to do this other than via algorithms.

would it be possible to achieve what i'm looking for using Matrices?

i.e.

$$\begin{pmatrix} a1\\ a2\\ a3 \end{pmatrix} \begin{pmatrix} b1\\ b2\\ b3 \end{pmatrix} \begin{pmatrix} c1\\ c2\\ c3 \end{pmatrix}$$

are my vectors i want to spread out as much as possible (all the same length).

if i take
$$\begin{pmatrix} a1&b1&c1\\ a2&b2&c2\\ a3&b3&c3 \end{pmatrix}$$
and it's transpose, and multiply them, i'll get a symetric matrix with 1s down the leading diagonal (dot product with itself) and numbers less than one (other dot products) everywhere else.

what i'm asking is if there's a way to minimise all the entries of this matrix so that the sum of them all is as small as possible? And would that result in having my vectors evenly spread out around the space?

2. Aug 19, 2008

### wbrigg

have i put this in the wrong thread/forum thing?

3. Aug 20, 2008

### HallsofIvy

Staff Emeritus
I don't think anyone understands what you are trying to do. If it is just "find n points evenly distributed on a unit sphere" then you probably want to use polar coordinates with $\rho$ set equal to 1. Since a circle of lattitude $\phi$ has radius $sin(\phi)$ and so circumference $2\pi sin(\phi)$ you will want to distribute, say, n1 values of $\phi$ evenly between 0 and $\pi$ and distribute n2= floor(n1$sin(\phi)$ on each circle of "latitude" $\phi$ where $n_1n_2= n_1^2 sin(\phi)= n$.

4. Aug 20, 2008

### wbrigg

i'm looking for a way to distribute $$n$$ points so that they cover all directions evenly if you draw a line from the origin to each point. In 3 dimensions this corresponds to evenly spacing points around a sphere, and in two dimensions around a circle. In one dimension it's just left and right (or up and down, depends on what your one dimension is).

From browsing google and such i've found that the way people do it for a sphere is to have a spiral which goes from on point on the sphere to another on the other side, and then have the spiral such that the distance between the spirals is the same as the distance between the points. This method is a good approximation, but it's not ideal. And it cannot be altered (in anyway i see) to work in higher dimensions.

some numbers of vectors are easy to space around,

i.e. in 1D, the two unit vectors would be (1) and (-1)

So i'd have two matrices, (1,-1) and it's transpose. then I'd multiply the transpose by the first to get

$$\begin{pmatrix} 1&-1\\ -1&1 \end {pmatrix}$$

If i do it in 2D, then i'm now spacing points around a circle.
Spacing 2 Points around a circle gives the same matrix as above.

Spacing 3 points around a circle gives:
$$\begin{pmatrix} 1&-0.5&-0.5\\ -0.5&1&-0.5\\ -0.5&-0.5&1 \end {pmatrix}$$

4 Points:
$$\begin{pmatrix} 1&0&-1&0\\ 0&1&0&-1\\ -1&0&1&0\\ 0&-1&0&1 \end {pmatrix}$$

These matrices have the top values as $$Cos(a2Pi/b)$$ where $$b$$ is the number of points being spread an a just counts from 1 up to $$b$$.

No matter how many dimensions you do this in you always get a $$b$$ by $$b$$ matrix.

Extending the Cos thing from above to a sphere would give the matrix of

$$\begin{pmatrix} 1&0.5&-0.5&-1&-0.5&0.5\\ 0.5&1&0.5&-0.5&-1&-0.5\\ -0.5&0.5&1&0.5&-0.5&-1\\ -1&-0.5&0.5&1&0.5&-0.5\\ -0.5&-1&-0.5&0.5&1&0.5\\ 0.5&-0.5&-1&-0.5&0.5&1 \end {pmatrix}$$

Now what vectors would i need to create that matrix? Obviously there are Three pairs of vecotrs differing only in their magnitude. and a Dot product of 60 degrees corresponds to the two vectors being at 60 Degrees to one another. The best way to space 6 points aroudn a sphere would be to have two triangles top and bottom, with one rotated 30 degrees... And, and it seems like that is what these vectors suggest. I'm asking would this continue to work in Higher dimensions and with more points?

5. Aug 20, 2008

### olliemath

I get what you're saying. I think it's clear (although I could be wrong and it would be hard to prove it) that the optimum arangement is when the angle between each pair of vectors is the same - otherwise you have to introduce some sort of measure of 'spaced-outness' - which sounds like a drugs test to me.

If we just deal with unit vectors then for each pair we must have $$v_i\cdot v_j = \cos\theta$$, where theta is the angle we want. So if we have n of them we can form the 3 by n matrix $$A=(v_1,\ldots,v_n)$$, where we're using column vectors. Given what we have just said, we must have
$$A^TA=\left(\begin{array}{cccc} 1 & C & \ldots & C \\ C & 1 & \ldots & C \\ \vdots & & \ddots & \vdots \\ C & C & \ldots & 1 \\ \end{array} \right)$$,
where $$C=\cos\theta$$, since the ij-th entry is just the dot product of the i-th and j-th vectors.
So the problem reduces to finding a 3 by n matrix A (if it exists) with this property?

I think it should be do-able, but don't have the time right now (going to a 5-day music festival - and it just started pouring with rain, grr..) Have you tried looking at some chemistry (or related) sites? This reminds me of drawing e.g. the skeletal structure of CH_4 in highschool.. all the 'bonds' have to be equally spaced. Search for molecular geometry or VSEPR

Last edited: Aug 20, 2008
6. Aug 20, 2008

### wbrigg

$$\sum^{n}_{a=0}\sum^{n}_{b=0}\vec{x}_{a}\vec{x}_{b}$$ is Minimised.
If you have vectors with 3 Elements, it's 3D, 2 elements is 2D. 20 Elements would be a 20 Dimensional *thing*. The matrix you get in the end is always an $$n\times n$$ matrix, where $$n$$ is the number of vectors.