---
title: "K-means on six 2-D instances (K=2)"
subject: "Data Mining"
chapter: 5
key: "semester_7/data_mining:kmeans-x-y-k2"
source: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-x-y-k2
site: BCT Engineering
---

# K-means on six 2-D instances (K=2)

Data Mining · Chapter 5: Cluster Analysis

- Asked in: year not given
- Video: [K Means Clustering Solved Example K Means Clustering Algorithm in Machine Learning by Mahesh Huddar](https://www.youtube.com/watch?v=5aBjP9Tn2lc) — 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-x-y-k2
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-5

## Question

Identify the cluster of the following instances using K-Means clustering algorithm (Take K=2).

| Instance | X | Y |
| --- | --- | --- |
| 1 | 1.0 | 1.5 |
| 2 | 2.5 | 5.5 |
| 3 | 1.5 | 1.0 |
| 4 | 2.0 | 3.0 |
| 5 | 2.5 | 3.5 |
| 6 | 4.0 | 6.2 |

## Short answer

Using K=2 and initial centroids (1,2), K-means after two iterations converges to Cluster 1: instances 1,3,4, centroid (1.50, 1.83); Cluster 2: instances 2,5,6, centroid (3.00, 5.07).

## Answer

**Data**

| Instance | X | Y |
| --- | --- | --- |
| 1 | 1.0 | 1.5 |
| 2 | 2.5 | 5.5 |
| 3 | 1.5 | 1.0 |
| 4 | 2.0 | 3.0 |
| 5 | 2.5 | 3.5 |
| 6 | 4.0 | 6.2 |

**Assumption**: K = 2, and the first two instances are the initial centroids: C1 = (1.0, 1.5) and C2 = (2.5, 5.5). Euclidean distance d = √[(x − cx)² + (y − cy)²].

**Iteration 1** (centroids C1 = (1.0, 1.5), C2 = (2.5, 5.5))
| Instance | (X, Y) | d to C1 | d to C2 | Cluster |
| --- | --- | --- | --- | --- |
| 1 | (1.0, 1.5) | 0.00 | 4.27 | C1 |
| 2 | (2.5, 5.5) | 4.27 | 0.00 | C2 |
| 3 | (1.5, 1.0) | 0.71 | 4.61 | C1 |
| 4 | (2.0, 3.0) | 1.80 | 2.55 | C1 |
| 5 | (2.5, 3.5) | 2.50 | 2.00 | C2 |
| 6 | (4.0, 6.2) | 5.58 | 1.66 | C2 |

Clusters: C1 = {1, 3, 4}, C2 = {2, 5, 6}.
New centroids: C1 = ((1.0 + 1.5 + 2.0)/3, (1.5 + 1.0 + 3.0)/3) = **(1.50, 1.83)**; C2 = ((2.5 + 2.5 + 4.0)/3, (5.5 + 3.5 + 6.2)/3) = **(3.00, 5.07)**.

**Iteration 2** (centroids C1 = (1.50, 1.83), C2 = (3.00, 5.07))
| Instance | d to C1 | d to C2 | Cluster |
| --- | --- | --- | --- |
| 1 | 0.60 | 4.09 | C1 |
| 2 | 3.80 | 0.66 | C2 |
| 3 | 0.83 | 4.33 | C1 |
| 4 | 1.27 | 2.30 | C1 |
| 5 | 1.94 | 1.64 | C2 |
| 6 | 5.03 | 1.51 | C2 |

The assignment is unchanged, so the algorithm has converged (the centroids would stay the same).

**Answer: Cluster 1 = {instances 1, 3, 4} with centroid (1.50, 1.83); Cluster 2 = {instances 2, 5, 6} with centroid (3.00, 5.07).**

## Check yourself

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

1. Which distance is used to assign each instance to a centroid in this solution?
   A. Manhattan distance
   B. Hamming distance
   C. Euclidean distance sqrt[(x-cx)^2+(y-cy)^2]
   D. Cosine similarity
   Answer: C. Each instance is assigned to the nearest centroid by Euclidean distance. (Key point: Distance used)

2. With C1 = (1.0, 1.5) and C2 = (2.5, 5.5), instance 4 (2.0, 3.0) is at 1.80 from C1 and 2.55 from C2. Where does it go?
   A. C2, the larger distance
   B. C1, the nearer centroid
   C. Both clusters
   D. It becomes noise
   Answer: B. The smaller distance (1.80 to C1) decides, so instance 4 joins C1. (Key point: First assignment)

3. After iteration 1, C1 = {1, 3, 4}. What is its new centroid?
   A. (1.0, 1.5)
   B. (2.0, 3.0)
   C. (1.50, 1.83)
   D. (3.00, 5.07)
   Answer: C. Mean X = (1.0+1.5+2.0)/3 = 1.5; mean Y = (1.5+1.0+3.0)/3 = 1.83. (Key point: Centroid recomputation)

4. What are the final clusters?
   A. {1, 3, 4} and {2, 5, 6}
   B. {1, 3} and {2, 4, 5, 6}
   C. {1, 2, 3} and {4, 5, 6}
   D. {1, 3, 4, 5} and {2, 6}
   Answer: A. Iteration 2 leaves the assignment unchanged, giving {1,3,4} and {2,5,6}. (Key point: Final result)

## Close variants set in other exams

- [K-means on 1-D data, K=2 and K=3](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-1d-k2-k3) — Data Mining, chapter 5

## Related in Data Mining

- [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
- [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
- [Short note: K-means clustering](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-note) — Data Mining, chapter 5
