Teacher: You may use the notion of derivative of a function which is \displaystyle {\lim_ {y to x} \frac{f(x) - f(y)} {x-y} } . Though it is not given that the function is differentiable, we can use this as a motivating factor to ‘see’ what is happening.

Student: Okay. So in case the function is differentiable then is the derivative of the function in question is +2 or -2?

Teacher: That is right but is it possible that function has derivative +2 in some interval and -2 interval in some other interval?

Student: It is possible, for example f(x) = 2x if x > 0 and -2x other wise. But I don’t think that a function like this will meet the conditions of this problem for all sets of points. I think here we are dealing with a ‘constant slope’ function.

Teacher: How can you prove that?

Student: Let me try. Suppose a be an arbitrary point in the domain. Now we will consider two other points, a+t and a-k in domain such that t and k are positive quantities. We consider two cases: Case 1 – constant slope and Case 2 – changing slope

Without loss of generality let us assume that f(a+t) – f(a) = 2t.

Case 1: Constant Slope

If f(a) – f(a-k) = 2k then we see that

f(a+t) – f(a) + f(a) – f(a-k) = 2t + 2k or f(a+t) – f(a-k) = 2{(a+t) – (a-k)} hence it is consistent with the problem’s statement.

Case 2: Non constant slope

However if f(a) – f(a-k) = -2k then

f(a+t) – f(a-k) = 2t – 2k …(i)

But we know that |f(a+t) – f(a-k)| = 2|(a+t) – (a-k)| = 2(t+k). … (ii)

Combining (i) and (ii) we conclude that either

2t – 2k = 2t + 2k => 4k = 0 => k = 0


2k – 2t = 2t + 2k => 4t = 0 => t = 0

But both t and k are positive quantities hence we arrive at a contradiction by assuming +2 and -2 slopes for two different pairs of points.

I think this proves that slope of function concerned is constant. So we can now say that it is differentiable and f'(x) = 2 or -2

Teacher: Very nice! Now this problem can be easily completed by solving the differential equation f’(x) = 2 or -2.

f(x) must be 2x + c or -2x + c where c is an arbitrary constant.