# Is it possible to use k-means algorithm with just one vector

Suppose I have a vector $$X = (x_1, x_2 , . . . ,x_n)$$, $$x_i$$ is the maximum of $$X$$ and $$x_k$$ is the minimum. Is it possible to use k-means algorithm to cluster the values in vector $$X$$ into two cluster. First, the values which are near to maximum value and the other cluster includes the values which are near to minimum value? If not, Is there another algorithm can do that task?

Thank you

• The answer by @Tolga Birdal says it all, it is possible. However, if you want to cluster the data with regards to the distance of the extreme values of your vector, you can also calculate the distances of all your entries to the minimum and maximum, and group them by thresholding them. The threshold could be set as (min+max)/2. – Irreducible Apr 29 '19 at 5:41

## 1 Answer

Certainly possible. You can think of it in the way you described but I would say it just becomes an adaptive thresholding assuming a bimodal distribution: We admit that there are two main modes in the data and we try to identify those by grouping the values around the means of the clusters. These groups form clusters. The means are positioned such that each element contributes to the average of the cluster it belongs and thus creating a mode nearby. It is almost sure that the minimum and maximum will go to separate clusters.