Thread: Problem 50
View Single Post
  #11  
Old December 1st, 2008, 11:50 AM
lcmarincek lcmarincek is offline
Newbie
 
Join Date: Nov 2008
Posts: 3
Country:
Thanks: 2
Thanked 0 Times in 0 Posts
lcmarincek is on a distinguished road
Default

|x-2^i|, where i is a constant, is a continuous function. So, the sum of |x-2^i|, i = 1 to 16, is a continuous function, too.
As a continuous function, its minimum/maximum is at at its derivative is 0, or where its derivative has a discontinuity from prositive to negative or vice-versa.

If x-2^i >= 0 (this means x >= 2^i), then |x-2^i| = x-2^i

If x-2^i < 0 (this means x < 2^i), then |x-2^i| = 2^i-x.

We can divide the x values in 18 parts.

Part 1: x <2^1:
f(x) = sum of (2^i-x), i = 1 to 16 = something - 16*x .This is a line with derivative -16.

part 2: 2^1 <= x < 2^2:
f(x) = x-2^1 + sum of (2^1-x), i = 2 to 16 = something - 14*x. This is a line with derivative -14.

and so on, till part 9: 2^8 <= x < 2^9:
f(x) = (sum of (x-2^i), i = 1 to 8) + (sum of (2^i-x), i = 9 to 16) = something (no dependence on x). This is a line with derivative 0.

part 10: 2^9 <= x < 2^10:
f(x) = (sum of (x-2^i), i = 1 to 9) + (sim of (2^i-x), i = 10 to 16) = something + 2*x. This is a line with derivative 2.

From part 10 on, the line segments have positive derivative. This means that the minimum of the function is at part 9, and its value at this part is:
(sum of 2^i, i = 9 to 16) - (sum of 2^i, i = 1 to 8) = 130560 - 510 = 130050