# k means clustering when k = n

I want to find the minimum value of the objective function if we set K equal to the number of samples.

I know the objective function is $$J=\Sigma_{n=1}^{N}\Sigma_{k=1}^{K}r_{nk}||x_n-\mu_k||^2$$ And we take the derivative to get $$\mu_k=\frac{\Sigma_{n=1}^{N}r_{nk}x_n}{\Sigma_{n=1}^{N}r_{nk}}$$

However, when plugging that back in and set K=N, it seems unable to be simplified: $$J=\Sigma_{n=1}^{N}\Sigma_{k=1}^{N}r_{nk}||x_n-\frac{\Sigma_{n=1}^{N}r_{nk}x_n}{\Sigma_{n=1}^{N}r_{nk}}||^2$$

Any help?

Well, when k = n, the obvious global minimum occurs where $$x_n = \mu_k$$ for all cluster centers. This falls out from your derivate because $$r_{nk} = 1$$ iff $$n = k$$.