Thread: Problem 50
View Single Post
  #12  
Old December 5th, 2008, 02:22 AM
CaptainBlack's Avatar
CaptainBlack CaptainBlack is offline
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,379
Country:
Thanks: 667
Thanked 3,619 Times in 2,916 Posts
CaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond repute
Default

Quote:
Originally Posted by lcmarincek View Post
|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
As I said previously, this can be done more easily and elegantly without calculus. Also a hint on how to do this has already been posted.

CB
__________________
Truth does not change because it is, or is not, believed by a majority of the people.

Giordano Bruno