---
title: "K-means on eight points into 3 clusters"
subject: "Data Mining"
chapter: 5
key: "semester_7/data_mining:kmeans-eight-points-k3"
source: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-eight-points-k3
site: BCT Engineering
---

# K-means on eight points into 3 clusters

Data Mining · Chapter 5: Cluster Analysis

- Asked in: year not given
- Video: [K Means Clustering Algorithm | K Means Solved Numerical Example Euclidean Distance by Mahesh Huddar](https://www.youtube.com/watch?v=KzJORp8bgqs) — Mahesh Huddar
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-eight-points-k3
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-5

## Question

Use K-means algorithm and Euclidean distance to cluster the following 8 examples into 3 clusters:
A1=(2, 10), A2=(2, 5), A3=(8, 4), A4=(5, 8), A5=(7, 5), A6=(6, 4), A7=(1, 2), A8=(4, 9)

## Short answer

K-means with Euclidean distance, initial centroids A1(2,10), A4(5,8), A7(1,2). After 4 iterations: Cluster 1 = {A1,A4,A8} centroid (3.67,9); Cluster 2 = {A3,A5,A6} centroid (7,4.33); Cluster 3 = {A2,A7} centroid (1.5,3.5). Algorithm converged with no further assignment changes.

## Answer

K-means with Euclidean distance d = √[(x₂ − x₁)² + (y₂ − y₁)²], k = 3.

**Assumption**: the initial centroids are A1 = (2, 10), A4 = (5, 8) and A7 = (1, 2) (the choice is not given in the question).

**Iteration 1** (C1 = (2, 10), C2 = (5, 8), C3 = (1, 2))
| Point | d to C1 | d to C2 | d to C3 | Cluster |
| --- | --- | --- | --- | --- |
| A1 (2, 10) | 0.00 | 3.61 | 8.06 | C1 |
| A2 (2, 5) | 5.00 | 4.24 | 3.16 | C3 |
| A3 (8, 4) | 8.49 | 5.00 | 7.28 | C2 |
| A4 (5, 8) | 3.61 | 0.00 | 7.21 | C2 |
| A5 (7, 5) | 7.07 | 3.61 | 6.71 | C2 |
| A6 (6, 4) | 7.21 | 4.12 | 5.39 | C2 |
| A7 (1, 2) | 8.06 | 7.21 | 0.00 | C3 |
| A8 (4, 9) | 2.24 | 1.41 | 7.62 | C2 |

C1 = {A1}, C2 = {A3, A4, A5, A6, A8}, C3 = {A2, A7}.
New centroids: C1 = (2, 10); C2 = ((8 + 5 + 7 + 6 + 4)/5, (4 + 8 + 5 + 4 + 9)/5) = (6, 6); C3 = ((2 + 1)/2, (5 + 2)/2) = (1.5, 3.5).

**Iteration 2** (C1 = (2, 10), C2 = (6, 6), C3 = (1.5, 3.5))
| Point | d to C1 | d to C2 | d to C3 | Cluster |
| --- | --- | --- | --- | --- |
| A1 | 0.00 | 5.66 | 6.52 | C1 |
| A2 | 5.00 | 4.12 | 1.58 | C3 |
| A3 | 8.49 | 2.83 | 6.52 | C2 |
| A4 | 3.61 | 2.24 | 5.70 | C2 |
| A5 | 7.07 | 1.41 | 5.70 | C2 |
| A6 | 7.21 | 2.00 | 4.53 | C2 |
| A7 | 8.06 | 6.40 | 1.58 | C3 |
| A8 | 2.24 | 3.61 | 6.04 | C1 |

C1 = {A1, A8}, C2 = {A3, A4, A5, A6}, C3 = {A2, A7}.
New centroids: C1 = (3, 9.5); C2 = (6.5, 5.25); C3 = (1.5, 3.5).

**Iteration 3** (C1 = (3, 9.5), C2 = (6.5, 5.25), C3 = (1.5, 3.5))
| Point | d to C1 | d to C2 | d to C3 | Cluster |
| --- | --- | --- | --- | --- |
| A1 | 1.12 | 6.54 | 6.52 | C1 |
| A2 | 4.61 | 4.51 | 1.58 | C3 |
| A3 | 7.43 | 1.95 | 6.52 | C2 |
| A4 | 2.50 | 3.13 | 5.70 | C1 |
| A5 | 6.02 | 0.56 | 5.70 | C2 |
| A6 | 6.26 | 1.35 | 4.53 | C2 |
| A7 | 7.76 | 6.39 | 1.58 | C3 |
| A8 | 1.12 | 4.51 | 6.04 | C1 |

C1 = {A1, A4, A8}, C2 = {A3, A5, A6}, C3 = {A2, A7}.
New centroids: C1 = (3.67, 9); C2 = (7, 4.33); C3 = (1.5, 3.5).

**Iteration 4**: with these centroids every point stays in the same cluster (e.g. A4: 1.67 to C1, 4.18 to C2; A2: 1.58 to C3), so the algorithm has converged.

**Answer: Cluster 1 = {A1, A4, A8}, centroid (3.67, 9); Cluster 2 = {A3, A5, A6}, centroid (7, 4.33); Cluster 3 = {A2, A7}, centroid (1.5, 3.5).**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. With initial centroids A1, A4 and A7, which cluster has just one point after iteration 1?
   A. C1 = {A1}
   B. C2 = {A4}
   C. C3 = {A7}
   D. None
   Answer: A. A1 is the only point nearest to (2,10); C2 gets five points and C3 gets two. (Key point: Initial centroids)

2. C2 = {A3, A4, A5, A6, A8} gives which new centroid?
   A. (5, 8)
   B. (6, 6)
   C. (7, 4.33)
   D. (6.5, 5.25)
   Answer: B. X mean = (8+5+7+6+4)/5 = 6 and Y mean = (4+8+5+4+9)/5 = 6. (Key point: Centroid update)

3. What are the converged clusters?
   A. {A1,A4,A8}, {A3,A5,A6}, {A2,A7}
   B. {A1,A8}, {A3,A4,A5,A6}, {A2,A7}
   C. {A1}, {A2,A7}, rest
   D. {A1,A2}, {A3,A4}, rest
   Answer: A. After iteration 3, A4 moves to C1, giving the stable result. (Key point: Final clusters)

## Related in Data Mining

- [Cluster analysis; K-means on height/width](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-height-width) — Data Mining, chapter 5
- [Cluster analysis applications; K-means](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Acluster-application-kmeans) — Data Mining, chapter 5
- [Likelihood and distance; K-means drawbacks](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Alikelihood-distance-clustering-kmeans-drawbacks) — Data Mining, chapter 3
- [K-means on six 2-D instances (B65)](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-b65) — Data Mining, chapter 5
- [Need of clustering; hierarchical vs partitioning; K-means](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Acluster-need-hier-vs-partition-kmeans) — Data Mining, chapter 5
- [K-means on six 2-D instances (K=2)](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-x-y-k2) — Data Mining, chapter 5

## Related in other subjects

- [Algorithm and flowchart: distance between points](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgo-flowchart-distance) — Computer Programming, chapter 2
- [Huffman code for symbols A0 to A4](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahuffman-a0-a4) — Data Communication, chapter 8
- [Huffman and Shannon-Fano coding of A0–A4](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahuffman-sf-a0-a4-compare) — Communication Systems, chapter 6
- [8255 mode 1 keyboard and printer with decoding](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-keyboard-printer-mode1-fig) — Instrumentation II, chapter 2
