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
Click For Summary

Homework Help Overview

The discussion revolves around finding the minimum of the sum Ʃ[itex]^{n}_{i=1}[/itex][itex]\left|x_{i}-z\right|[/itex], where the values of xi are constants. Participants explore the implications of this expression in the context of optimization and the behavior of the function as z varies.

Discussion Character

  • Exploratory, Assumption checking, Conceptual clarification

Approaches and Questions Raised

  • The original poster attempts to analyze the sum by splitting it into parts based on the relationship between xi and z, and considers taking derivatives to find critical points. Some participants question the validity of setting the derivative to zero, noting that the function may not be differentiable at the minimum. Others suggest that the minimum occurs at the median of the xi values.

Discussion Status

Participants are actively engaging with the problem, exploring different perspectives on the minimum of the function. There is recognition of the median as a potential solution, but also a discussion about the implications of differentiability and the behavior of the function at critical points. Some guidance has been offered regarding the nature of the function and its slopes at various intervals.

Contextual Notes

There are mentions of potential complications due to the piecewise nature of the function and the dependency of certain terms on z, which may affect the ability to differentiate straightforwardly. The discussion also touches on the distinction between the median and the arithmetic mean in the context of minimizing the sum.

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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 6 ·
Replies
6
Views
1K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K