I don’t think you need to do anything as sophisticated as computing the derivative to prove that the only such functions are constant functions. Consider any distinct x_1, x_2. d(x_1, x_2) is nonzero by the definition of metric spaces. If d(f(x_1), f(x_2)) were nonzero, there would be a K small enough for the condition to be violated; therefore it must be zero for all x_1, x_2.
The humor of asking the student to compute the derivative is that one imagines the student confidently starting to answer the question, until a dawning horror rises on the student’s face as the implications of the answer become evident.
I don’t think you need to do anything as sophisticated as computing the derivative to prove that the only such functions are constant functions. Consider any distinct x_1, x_2. d(x_1, x_2) is nonzero by the definition of metric spaces. If d(f(x_1), f(x_2)) were nonzero, there would be a K small enough for the condition to be violated; therefore it must be zero for all x_1, x_2.
The humor of asking the student to compute the derivative is that one imagines the student confidently starting to answer the question, until a dawning horror rises on the student’s face as the implications of the answer become evident.