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?



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 \}$$

  • $\begingroup$ thanks, but what is $S_n$ and $\sigma(i)$ respectively? $\endgroup$ – skyork Feb 15 '12 at 20:34
  • $\begingroup$ $\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. $\endgroup$ – 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)?$

  • $\begingroup$ I've amended the condition on the input, does this make it well-defined? $\endgroup$ – skyork Feb 15 '12 at 17:06
  • $\begingroup$ @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. $\endgroup$ – Ross Millikan Feb 15 '12 at 18:22
  • $\begingroup$ 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$? $\endgroup$ – skyork Feb 16 '12 at 17:26
  • $\begingroup$ yes, since then the sum on the right doesn't contain any element, and this is typically understood to be $0$... $\endgroup$ – N. S. Feb 16 '12 at 18:05
  • $\begingroup$ @N.S. thanks for the clarification. $\endgroup$ – skyork Feb 16 '12 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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