---
title: "Cluster analysis; K-means on height/width"
subject: "Data Mining"
chapter: 5
key: "semester_7/data_mining:kmeans-height-width"
source: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-height-width
site: BCT Engineering
---

# Cluster analysis; K-means on height/width

Data Mining · Chapter 5: Cluster Analysis

- Asked in: year not given, 2+8 marks
- 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-height-width
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-5

## Question

Why do we perform cluster analysis in Data Mining? With K-means clustering algorithm, find out the clusters based on the following instances. (Choose K at least 2)

| Instances | Height | Width |
| --- | --- | --- |
| 1 | 0.5 | 2.2 |
| 2 | 1.5 | 3.5 |
| 3 | 0.7 | 1.5 |
| 4 | 2.0 | 1.0 |
| 5 | 3.2 | 2.5 [?] |
| 6 | 1.0 | 1.8 |

## Short answer

Cluster analysis discovers natural groups, summarizes data, and detects outliers. With K=2 and initial centroids (1,2), K-means converges to Cluster 1: instances 1,3,4,6, centroid (1.05, 1.625); Cluster 2: instances 2,5, centroid (2.35, 3.00).

## Answer

#### Why cluster analysis?
Cluster analysis groups unlabelled data into clusters of similar objects. In data mining it is used to **discover natural groupings** and structure (e.g. customer segmentation), to **summarise and compress** large data by cluster representatives, to **detect outliers**, and as a preprocessing step for other tasks such as classification and indexing. It requires no class labels, so it is useful for exploring new data.

#### K-means on the data
**Assumptions**: the value for instance 5 is read as Width = 2.5; K = 2; the initial centroids are instances 1 and 2: C1 = (0.5, 2.2), C2 = (1.5, 3.5).

| Instance | Height | Width |
| --- | --- | --- |
| 1 | 0.5 | 2.2 |
| 2 | 1.5 | 3.5 |
| 3 | 0.7 | 1.5 |
| 4 | 2.0 | 1.0 |
| 5 | 3.2 | 2.5 |
| 6 | 1.0 | 1.8 |

**Iteration 1**
| Instance | d to C1 (0.5, 2.2) | d to C2 (1.5, 3.5) | Cluster |
| --- | --- | --- | --- |
| 1 | 0.00 | 1.64 | C1 |
| 2 | 1.64 | 0.00 | C2 |
| 3 | 0.73 | 2.15 | C1 |
| 4 | 1.92 | 2.55 | C1 |
| 5 | 2.72 | 1.97 | C2 |
| 6 | 0.64 | 1.77 | C1 |

C1 = {1, 3, 4, 6}, C2 = {2, 5}.
New centroids: C1 = ((0.5 + 0.7 + 2.0 + 1.0)/4, (2.2 + 1.5 + 1.0 + 1.8)/4) = **(1.05, 1.625)**; C2 = ((1.5 + 3.2)/2, (3.5 + 2.5)/2) = **(2.35, 3.00)**.

**Iteration 2**
| Instance | d to C1 (1.05, 1.625) | d to C2 (2.35, 3.0) | Cluster |
| --- | --- | --- | --- |
| 1 | 0.80 | 2.02 | C1 |
| 2 | 1.93 | 0.99 | C2 |
| 3 | 0.37 | 2.23 | C1 |
| 4 | 1.14 | 2.03 | C1 |
| 5 | 2.32 | 0.99 | C2 |
| 6 | 0.18 | 1.81 | C1 |

No change, so the algorithm has converged.

**Answer: Cluster 1 = {instances 1, 3, 4, 6}, centroid (1.05, 1.625); Cluster 2 = {instances 2, 5}, centroid (2.35, 3.00).**

## Check yourself

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

1. Which is a reason for performing cluster analysis?
   A. To predict a known class label from labelled training data
   B. To discover natural groupings in unlabelled data, such as customer segments
   C. To guarantee the data have no outliers
   D. To sort records alphabetically
   Answer: B. Clustering needs no class labels and is used to find natural groups, summarise data and detect outliers. (Key point: Purpose of cluster analysis)

2. With K = 2 and initial centroids instances 1 (0.5, 2.2) and 2 (1.5, 3.5), which cluster does instance 5 (3.2, 2.5) join in iteration 1?
   A. C1, since 2.72 < 1.97
   B. C2, since its distance to C2 (1.97) is smaller than to C1 (2.72)
   C. C1, because it is the first cluster
   D. It forms a new cluster
   Answer: B. Each point goes to the nearest centroid; instance 5 is 1.97 from C2 and 2.72 from C1. (Key point: Initial centroids)

3. After iteration 1 the clusters are C1 = {1, 3, 4, 6} and C2 = {2, 5}. What is the new centroid C2?
   A. (2.35, 3.00)
   B. (1.05, 1.625)
   C. (3.2, 2.5)
   D. (1.5, 3.5)
   Answer: A. The new centroid is the mean: ((1.5+3.2)/2, (3.5+2.5)/2) = (2.35, 3.00). (Key point: Centroid update)

4. Why does the algorithm stop after iteration 2?
   A. The maximum of two iterations is fixed
   B. All distances became zero
   C. No instance changed cluster, so the clustering is stable
   D. Only two clusters are allowed
   Answer: C. K-means stops when assignments (and so centroids) no longer change; final clusters are {1,3,4,6} and {2,5}. (Key point: Convergence)

## Related in Data Mining

- [Cluster analysis applications; K-means](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Acluster-application-kmeans) — 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
- [K-means on eight points into 3 clusters](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-eight-points-k3) — Data Mining, chapter 5
- [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
- [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 other subjects

- [Numerical: cluster size and users in service area](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Acluster-size-users-service-area) — Wireless Communication, chapter 2
- [Data warehouse and data mining](https://www.bctengineer.com/question.md?key=semester_8%2Finformation_system%3Adata-warehouse-data-mining) — Information System, chapter 4, asked 2×
- [Short note: data mining and warehousing](https://www.bctengineer.com/question.md?key=semester_8%2Finformation_system%3Adata-mining-and-warehousing-note) — Information System, chapter 4
- [Data mining and business knowledge](https://www.bctengineer.com/question.md?key=semester_8%2Finformation_system%3Adata-mining-business-knowledge) — Information System, chapter 4
