Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First of all, is the following a well-defined function?

$f(\{x_1,\ldots,x_n\})=m$ such that $\sum_{i=1}^mx_i\ge\sum_{i=m+1}^nx_i$, where $\{x_1,\ldots,x_n\}$ is ordered in ascending order and $x_i\ge0$ for all $x_i\in\{x_1,\ldots,x_n\}$

If not, how do we define a function which takes a set of positive real numbers of arbitrary size, and returns an integer which is the index of the element in the input that satisfies the condition as above. And what would be the domain and range of this function?


share|cite|improve this question
up vote 1 down vote accepted

With the extra condition it is well defined.

The set $\{ m | \sum_i^mx_i\ge\sum_{i=m+1}^nx_i \}$ is finite and nonempty since it contains $n$, and your function is actually the min of this set.

BTW, if you don't want to worry about ordering your set increasing, here is what you can do:

First observe that your condition is equivalent to

$$2\sum_i^mx_i\ge \sum_{i=1}^nx_i$$

Now, you can define :

$$f(\{x_1,\ldots,x_n\})= \min \{ m| \exists \sigma \in S_n \, {\rm s.t.} \, 2\sum_i^mx_{\sigma(i)} \ge \sum_{i=1}^nx_i \}$$

share|cite|improve this answer
thanks, but what is $S_n$ and $\sigma(i)$ respectively? – skyork Feb 15 '12 at 20:34
$\sigma$ is a bijection from $\{1,2,..,n\}$ to $\{ 1,2,..,n \}$; basically it is a reordering of the sets $\{1,2,..,n \}$ (and in this case the value of the function $\sigma(i)$ is the ith element in the new order). $S_n$ is the set of all such possible bijections. – N. S. Feb 15 '12 at 21:18

Presumably the lower limit on the first sum is $i=1$. The function is not well-defined. For example, what is $f(-1,0,0,0,0)?$

share|cite|improve this answer
I've amended the condition on the input, does this make it well-defined? – skyork Feb 15 '12 at 17:06
@skyork: If returning $n$ when $x_n$ is greater than the sum of the rest is acceptable, it is well defined. You have stated what the domain is-all ordered tuples of positive reals. The range would be the naturals as you can make one that returns any index you want. – Ross Millikan Feb 15 '12 at 18:22
just a thought, what if we have something like $f(0.1, 0.2, 0.3, 0.4, 1.1)$? Is the function well-defined in this case? If so, are we saying $f(0.1, 0.2, 0.3, 0.4, 1.1)=5$? – skyork Feb 16 '12 at 17:26
yes, since then the sum on the right doesn't contain any element, and this is typically understood to be $0$... – N. S. Feb 16 '12 at 18:05
@N.S. thanks for the clarification. – skyork Feb 16 '12 at 18:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.