The elbow method picks a reasonable value of \(k\) for K-Means by plotting WCSS against \(k\) and looking for the point where adding more clusters stops meaningfully reducing it.
Why WCSS Alone Can't Just Be Minimized
WCSS always decreases as \(k\) increases — in the extreme, \(k=n\) (one cluster per point) gives WCSS of exactly 0. Minimizing WCSS directly would always favor more clusters, which defeats the purpose of clustering (finding a small number of meaningful groups). The elbow method instead looks for diminishing returns — the point where each additional cluster buys much less WCSS reduction than the ones before it.
Worked Example — Continuing the 6-Point Dataset
| k | WCSS | Drop From Previous k |
|---|---|---|
| 1 | 70.0 | — |
| 2 | 16.0 | 54.0 (huge drop) |
| 3 | ~8.0 | ~8.0 (much smaller drop) |
| 4 | ~4.0 | ~4.0 (smaller still) |
At \(k=1\), all 6 points are forced into one cluster centered at the overall mean \((5,4)\), giving \(WCSS = 70\) (a large number, since the two groups are far apart). At \(k=2\), WCSS drops dramatically to 16 — the natural two-group structure is captured. Beyond \(k=2\), further splits only subdivide already-tight groups, producing much smaller WCSS reductions — this is the "elbow."
from sklearn.cluster import KMeans
import numpy as np
import matplotlib.pyplot as plt
X = np.array([[2,2],[2,4],[2,6],[8,2],[8,4],[8,6]])
wcss = []
k_values = range(1, 6)
for k in k_values:
model = KMeans(n_clusters=k, random_state=42, n_init=10)
model.fit(X)
wcss.append(model.inertia_)
plt.plot(k_values, wcss, marker="o")
plt.xlabel("k"); plt.ylabel("WCSS")
plt.show()
print(list(zip(k_values, wcss))) # look for the "elbow" -- k=2 here
Graphical Intuition
The curve bends sharply at k=2 — before it, each extra cluster helps a lot; after it, gains flatten out.
Practical Use Cases
- The standard first check when \(k\) isn't known ahead of time from business context
- Combined with silhouette score for a more rigorous, less subjective confirmation
Common Mistakes
- Treating the elbow method as fully automated — the "elbow" is often visually judged, and real data frequently doesn't show as clean a bend as this textbook example.
- Not testing a wide enough range of \(k\) values to actually see where the curve flattens.
Interview Relevance
Q: "Why can't you just pick the k that minimizes WCSS?" WCSS decreases monotonically as k increases, reaching exactly 0 when k equals the number of data points — minimizing it directly would always favor the maximum possible number of clusters, defeating clustering's purpose; the elbow method instead looks for the point of diminishing returns.
Practice Question
A WCSS-vs-k plot shows a very gradual, smooth decline with no obvious bend at any point. What does this suggest about the data's underlying cluster structure?