Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > MHF Lounge > Problem of the Week
Closed Thread
 
Thread Tools Display Modes
  #1  
Old November 12th, 2008, 05:56 AM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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 Problem 50

An easy one:

Let x_i=2^i,\ i=1,.., 16

Find the minimum of the function:

f(x)=\sum_{i=1}^{16} |x-x_i|

(I had thought I had already posted this, did it disapear for a reason or am I just misremembering events )

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

Giordano Bruno

Last edited by CaptainBlack; November 12th, 2008 at 01:28 PM.
Advertisement
 
  #2  
Old November 21st, 2008, 04:40 AM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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 CaptainBlack View Post
An easy one:

Let x_i=2^i,\ i=1,.., 16

Find the minimum of the function:

f(x)=\sum_{i=1}^{16} |x-x_i|

(I had thought I had already posted this, did it disapear for a reason or am I just misremembering events )

CB
OK a clue.

Given the function:

f(x)=\sum_{i=1}^{2} |x-x_i|

where x_2>x_1 what is the minimum of f(x) and where is it achieved.

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

Giordano Bruno
  #3  
Old November 22nd, 2008, 01:04 AM
Banned
 
Join Date: Nov 2008
Posts: 82
Country:
Thanks: 0
Thanked 25 Times in 25 Posts
David24 is on a distinguished road
Default

Quote:
Originally Posted by CaptainBlack View Post
An easy one:

Let x_i=2^i,\ i=1,.., 16

Find the minimum of the function:

f(x)=\sum_{i=1}^{16} |x-x_i|

(I had thought I had already posted this, did it disapear for a reason or am I just misremembering events )

CB

hey mate,

without going into two much detail, I believe the solution lies between the intersection of |x - 2| = |x - 2^16| which over the region of intersection becomes
x - 2 = 2^16 - x
x = 2^15 + 1

am I completely off the mark? if not please let me know and I will post my full solution,

Cheers,

David
  #4  
Old November 22nd, 2008, 01:43 AM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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 David24 View Post
hey mate,

without going into two much detail, I believe the solution lies between the intersection of |x - 2| = |x - 2^16| which over the region of intersection becomes
x - 2 = 2^16 - x
x = 2^15 + 1

am I completely off the mark? if not please let me know and I will post my full solution,

Cheers,

David
Try writing in English, that is gobbledy gook.

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

Giordano Bruno
  #5  
Old November 22nd, 2008, 02:09 AM
Banned
 
Join Date: Nov 2008
Posts: 82
Country:
Thanks: 0
Thanked 25 Times in 25 Posts
David24 is on a distinguished road
Default

Quote:
Originally Posted by CaptainBlack View Post
Try writing in English, that is gobbledy gook.

CB

CaptainBlack,

Am I correct in conjecturing that the value of x which minimises f(x) satisfies,

|x-2| =|x-2^16| ?

David

ps - I apologise for any grammatical and or spelling mistakes that may be present in the above statement.
  #6  
Old November 22nd, 2008, 02:22 AM
NonCommAlg's Avatar
MHF Contributor

 
Join Date: May 2008
Location: Vancouver
Posts: 1,731
Country:
Thanks: 210
Thanked 1,269 Times in 942 Posts
NonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud ofNonCommAlg has much to be proud of
Default

this problem is for the moderators only! lol (just kidding!)

suppose a_1 \leq a_2 \leq \cdots \leq a_n, and f(x)=\sum_{i=1}^n |x-a_i|. put: m=\left \lfloor \frac{n}{2} \right \rfloor. prove that: \min f(x)=\sum_{k=1}^m (a_{n+1-k} - a_k).
The following users thank NonCommAlg for this useful post:
Donate to MHF
  #7  
Old November 22nd, 2008, 03:44 AM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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 David24 View Post
CaptainBlack,

Am I correct in conjecturing that the value of x which minimises f(x) satisfies,

|x-2| =|x-2^16| ?

David

ps - I apologise for any grammatical and or spelling mistakes that may be present in the above statement.
Well lets see,

|x-2|=|x-2^{16}|

implies (assuming 2 \le x \le 2^{16} anyway) that:

x-2=2^{16}-x

or:

x=2^8-1

Now lets do some calculations:

Code:
>i=1:16;
>
>x=[2^8-1:2^8+1]'
          255 
          256 
          257 
>
>s=abs(x-2^i);
>S=sum(s)
       130052 
       130050 
       130050 
>
So we conclude that, no your proposed condition does not define the solution.

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

Giordano Bruno
  #8  
Old November 22nd, 2008, 04:46 AM
Banned
 
Join Date: Nov 2008
Posts: 82
Country:
Thanks: 0
Thanked 25 Times in 25 Posts
David24 is on a distinguished road
Default

Quote:
Originally Posted by CaptainBlack View Post
Well lets see,

|x-2|=|x-2^{16}|

implies (assuming 2 \le x \le 2^{16} anyway) that:

x-2=2^{16}-x

or:

x=2^8-1

Now lets do some calculations:

Code:
>i=1:16;
>
>x=[2^8-1:2^8+1]'
          255 
          256 
          257 
>
>s=abs(x-2^i);
>S=sum(s)
       130052 
       130050 
       130050 
>
So we conclude that, no your proposed condition does not define the solution.

CB
CaptainBlack,

Thanks for your response, I will have to keep working on it.
  #9  
Old November 23rd, 2008, 01:26 PM
MHF Contributor
 
Join Date: Nov 2008
Posts: 1,135
Country:
Thanks: 39
Thanked 542 Times in 505 Posts
running-gag is a name known to allrunning-gag is a name known to allrunning-gag is a name known to allrunning-gag is a name known to allrunning-gag is a name known to allrunning-gag is a name known to all
Default

Quote:
Originally Posted by CaptainBlack View Post
An easy one:

Let x_i=2^i,\ i=1,.., 16

Find the minimum of the function:

f(x)=\sum_{i=1}^{16} |x-x_i|

(I had thought I had already posted this, did it disapear for a reason or am I just misremembering events )

CB
Hi,
By deriving f on each interval [2^j,2^{j+1}] we find
\frac{df}{dx}=2j-16
Therefore f is decreasing up to 2^8 (up to j=7) is constant between 2^8 and 2^9 (for j=8) and increasing from 2^9 (from j=9)
The minimum of f is reached between 2^8 and 2^9
  #10  
Old November 23rd, 2008, 03:47 PM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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 running-gag View Post
Hi,
By deriving f on each interval [2^j,2^{j+1}] we find
\frac{df}{dx}=2j-16
Therefore f is decreasing up to 2^8 (up to j=7) is constant between 2^8 and 2^9 (for j=8) and increasing from 2^9 (from j=9)
The minimum of f is reached between 2^8 and 2^9
It can be done more neatly without calculus.

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

Giordano Bruno
  #11  
Old December 1st, 2008, 11:50 AM
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
  #12  
Old December 5th, 2008, 02:22 AM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 11,265
Country:
Thanks: 655
Thanked 3,580 Times in 2,885 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
  #13  
Old December 5th, 2008, 11:09 AM
Junior Member
 
Join Date: Nov 2008
Posts: 58
Country:
Thanks: 2
Thanked 21 Times in 20 Posts
cl85 is on a distinguished road
Default

Here's my attempt:
f(x) measures the distance of x to 16 points, namely 2, 4, 8, 16, ... , 2^16.

Suppose we let x to be less than 2. Then we can decrease f(x) by increasing x towards 2 since this decreases the distance of x to all 16 points.

So what happens when we increase x pass 2? We're getting further away from a single point, ie 2, but at the same time, we are decreasing our distance to 15 points. The net effect is a decrease in f(x).

The key observation here is that if we change x by a fix amount, the change in the distance is the same for all points(some are positive change, while others are negative, but the absolute value is the same).

This implies that we should keep increasing x to decrease f(x) as long as we are decreasing the distance to more points than the number of points that we are getting further away.

Following this logic, we arrive at the answer that f(x) is minimum between the region 2^8 and 2^9, which has 8 points less than it and 8 points more.
The following users thank cl85 for this useful post:
Donate to MHF
  #14  
Old January 1st, 2009, 08:30 PM
Junior Member
 
Join Date: Jun 2008
Location: Plymouth
Posts: 45
Country:
Thanks: 9
Thanked 3 Times in 3 Posts
fobos3 is on a distinguished road
Default

Okay. The derivative of |x-a| is:
1 if x-a>0
0 if x=0
-1 if x-a<0

Since we have a sum we the derivative of f(x) is the sum of the derivatives of the modulus:f'(x)=\sum _{i=1}^{16} \left(\left|x-x_i\right|\right)'

If f'(x) is to be 0 we can't have some of the elements |x-x_i| to be zero because then all the other elements can't be zero. We will have 15 elements that can be 1 or -1 and one which is 0 and their sum cannot be 0.

Suppose we have a number i=n such as for i>n x-x_i<0. This is easy enough to prove x-x_i>x-x_{i+1}. We will also have x-x_i>0 for i<=n since there can't be a zero term. From f'(x)=0 we can conclude that n=8 (8 times 1 and 8 times -1=0).

So x-x_9<0 for n>8
x<2^9
and
x-x_8>0 for n<=8
x>2^8

All that is left is to prove that this is a minimum but I'll leave that to you.

Don't know if someone has suggested this. I didn't read all the posts.
  #15  
Old March 12th, 2009, 04:03 AM
chisigma's Avatar
Senior Member
 
Join Date: Mar 2009
Location: near Piacenza (Italy)
Posts: 455
Country:
Thanks: 15
Thanked 140 Times in 126 Posts
chisigma will become famous soon enoughchisigma will become famous soon enough
Default

In order to have an idea about how we can solve the problem let’s consider the minimum of this function…

f(x)= \sum_ {i=1}^{2} |x-2^{i}| (1)

… which is represented [in blue] here…

http://digilander.libero.it/luposabatini/MHF1.bmp

The (1) is in fact a ‘straight-line function’ the slope of which changes in x=2 and x=4. More exactly, the function starts with negative slope s=-2, in x=2 becames ‘flat’ [s=0, and for x > 4 the slope is positive [s=2]. The ‘minimum’ of (1) in fact is not rescticted to a single point, but in extended to the interval 2 \le x \le 4, where is f(x)=2. In similar way we can ‘attach’ the proposed problem, i.e. finding the minimum of…

f(x)= \sum_ {i=1}^{16} |x-2^{i}| (2)

As the (1), the (2) is also ‘straight-line’ . In x=0 is…

f(0)= \sum_ {i=1}^{16} 2^{i}= 2 \cdot (2^{16}-1)=131070

The functions starts with negative slope s=-16 and each time that x=2^{i} the slope is increased by +2. So we have…

x=0, s=-16; x=2, s=-14; x=4, s=-12;\dots; x=2^{7}, s=-2; x=2^{8}, s=0;\dots

So the functions become ‘flat’ in the interval 256 \le x \le 512 and here exhibits its ‘minimum’ which is [if no mistakes of mine…] …

f(2^{8})= \sum_{i=1}^{16} |2^{8}-2^{i}|= 2\cdot (2^{8}-1)^ {2}= 130050

Regards
__________________
... chè perder tempo a chi più sa più spiace... Dante Alighieri, Divina Commedia, Purgatorio, III, 78

Last edited by chisigma; March 12th, 2009 at 04:05 AM. Reason: correction
Closed Thread
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 12:01 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.