Minimum of Ʃ[itex]^{n}_{i=1}[/itex][itex]\left|x_{i}-z\right|[/itex]

  • Thread starter Thread starter no_alone
  • Start date Start date
  • Tags Tags
    Minimum
no_alone
Messages
32
Reaction score
0

Homework Statement


Hello,
I have a question what is
What is the minimum of Ʃ^{n}_{i=1}\left|x_{i}-z\right|
x_{i} are constants

Homework Equations


Not Much


The Attempt at a Solution


I split the sum to 3 sums
Ʃ^{}_{x_{i}>z}(x_{i}-z) + Ʃ^{}_{x_{i}<z}(-x_{i}+z)+Ʃ^{}_{x_{i}=z}(x_{i}-z)
then I split the sums again:
Ʃ^{}_{x_{i}>z}(x_{i})+Ʃ^{}_{x_{i}>z}(-z) + Ʃ^{}_{x_{i}<z}(-x_{i}) + Ʃ^{}_{x_{i}<z}(z)+Ʃ^{}_{x_{i}=z}(x_{i}-z)
This is Equall to
Ʃ^{}_{x_{i}>z}(x_{i})-n^{}_{x_{i}>z}*z + Ʃ^{}_{x_{i}<z}(-x_{i}) + n^{}_{x_{i}<z}*z+Ʃ^{}_{x_{i}=z}x_{i}-z-n^{}_{x_{i}=z}z

Then I derivative by z and =0 to find maximum
I get:
-n^{}_{x_{i}>z}+ n^{}_{x_{i}<z}-n^{}_{x_{i}=z}=0

If x_{i}≠z for every i then
-n^{}_{x_{i}>z}+ n^{}_{x_{i}<z}=0

n^{}_{x_{i}<z}=n^{}_{x_{i}>z}

If there is i that x_{i}=z
n^{}_{x_{i}<z} = n^{}_{x_{i}>z}+n^{}_{x_{i}=z}

What we get is that the minimus is when z is the median of x_{i}

But I have a problem, when I try for example to derivate:
n^{}_{x_{i}<z}*z
n is dependent on z soo... I cannot do it! I don't know how to derivate it...

Thank's for the help
 
Physics news on Phys.org
This is a nonnegative function, so you want to find for which value of z it gets the minimal value.

As always we have the arithmetic-geometrical means inequality:

\sum_{i=1}^{n}\frac{|z-x_i|}{n} \geq \prod_{i=1}^{n} (|z-x_i|)^{\frac{1}{n}}

So the minimum value of this function is achieved when the above LHS equals the RHS, and this happens when:

|z-x_i|=|z-x_j| for all i\neq j.
 
no_alone said:

Homework Statement


Hello,
I have a question what is
What is the minimum of Ʃ^{n}_{i=1}\left|x_{i}-z\right|
x_{i} are constants

Homework Equations


Not Much


The Attempt at a Solution


I split the sum to 3 sums
Ʃ^{}_{x_{i}>z}(x_{i}-z) + Ʃ^{}_{x_{i}<z}(-x_{i}+z)+Ʃ^{}_{x_{i}=z}(x_{i}-z)
then I split the sums again:
Ʃ^{}_{x_{i}>z}(x_{i})+Ʃ^{}_{x_{i}>z}(-z) + Ʃ^{}_{x_{i}<z}(-x_{i}) + Ʃ^{}_{x_{i}<z}(z)+Ʃ^{}_{x_{i}=z}(x_{i}-z)
This is Equall to
Ʃ^{}_{x_{i}>z}(x_{i})-n^{}_{x_{i}>z}*z + Ʃ^{}_{x_{i}<z}(-x_{i}) + n^{}_{x_{i}<z}*z+Ʃ^{}_{x_{i}=z}x_{i}-z-n^{}_{x_{i}=z}z

Then I derivative by z and =0 to find maximum
I get:
-n^{}_{x_{i}>z}+ n^{}_{x_{i}<z}-n^{}_{x_{i}=z}=0

If x_{i}≠z for every i then
-n^{}_{x_{i}>z}+ n^{}_{x_{i}<z}=0

n^{}_{x_{i}<z}=n^{}_{x_{i}>z}

If there is i that x_{i}=z
n^{}_{x_{i}<z} = n^{}_{x_{i}>z}+n^{}_{x_{i}=z}

What we get is that the minimus is when z is the median of x_{i}

But I have a problem, when I try for example to derivate:
n^{}_{x_{i}<z}*z
n is dependent on z soo... I cannot do it! I don't know how to derivate it...

Thank's for the help

Setting the derivative to zero is a mistake: the function ##f(z) =\sum_i |z - x_i| ## is piecewise differentiable only, and may not have a derivative at all at the minimizing point. For example, draw the graph of ##f(z) = |z-1|+|z-2|+|z-3|.##

You are correct that the minimum is at the median, but there is an easier way to get this: imagine that the x_i are sorted in increasing order, so ##x_1 < x_2 < \cdots < x_n##; I'll let you worry about the modifications needed in the argument if some of the x_i are equal. So, to the left of x_1 the slope of the graph of f(z) is -n, because
f(z) = \sum_{i=1}^n x_i - nz when z < x_1 . As z increases through x_1 the slope increases by 2, to become -n+2. Every time z passes through the next x_i the slope increases by 2.
 
If you're looking for a minimum of the form ##\sum|x|##, you can look at the function ##\sum x^2## instead, since |x| and x² are extreme at the same places.

If you do that for this case, you'll be led to the arithmetic mean of the xi and not their median.
 
Michael Redei said:
If you're looking for a minimum of the form ##\sum|x|##, you can look at the function ##\sum x^2## instead, since |x| and x² are extreme at the same places.

If you do that for this case, you'll be led to the arithmetic mean of the xi and not their median.

In this problem the minimum is at the median, not at the mean. The two forms |x-z| and (x-z)^2 give different things when there is more than one such term.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...

Similar threads

Replies
17
Views
998
Replies
2
Views
2K
Replies
6
Views
2K
Replies
15
Views
2K
Replies
4
Views
1K
Back
Top