Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

I have a sample $S(x)$ containing $n$ elements:

$$S(x)=\{ s_1 x, s_2 x, \ldots, s_n x \},\qquad s_i \in \mathbb{R}, x\in \mathbb{R^{+}}$$

Every element in the sample is multiplied by $x$. Now median of this sample is

$$\tilde{S}(x)=y,\qquad y\in \mathbb{R^{+}}$$

When $y$ is given, how to find $x$?

In other words: If I know median of a sample whose every element is multiplied by a certain factor, how to find this factor? The original sample elements $s_{i}$ are also known.

I think it would be possible to find the value with a search algorithm (to some degree of precision), but maybe there is a simple closed solution.

Note that there may be more that one $x$ satisfying the above equation, since $s_i$ come from $\mathbb{N}$. The solution will more likely be an interval of values.

share|cite|improve this question
@MichaelHardy I don't think this edit is correct. If I read it correctly, s$_i$x were the observed samples and you know that the median of the sample of s$_i$x =y. Then find x. – Michael Chernick Sep 23 '12 at 16:32
Who is right? me or Michael Hardy? – Michael Chernick Sep 23 '12 at 16:35
@MichaelChernick You first comment is alright. – Libor Sep 23 '12 at 16:40
My only edit to this posting was to change "..." to "\ldots". Is that was is being called incorrect? – Michael Hardy Sep 23 '12 at 16:45
I haven't found any problems with the edit. Using '\ldots' instead of '...' is OK. – Libor Sep 23 '12 at 16:54
up vote 1 down vote accepted

Sort your sequence $s_1,\ldots,s_n$ to obtain a new sequence $t_1,\ldots,t_n$.

If $n$ is odd, take $t=t_{(n+1)/2}$.
If $n$ is even, take $t=(t_{n/2}+t_{(n/2)+1})/2$

Solve for $x$ the following equation


share|cite|improve this answer
What does "Solve for $tx=y$" mean? One could say "Solve $tx=y$ for $x$" or "Solve $tx-y$ for $t$", and I would understand it. – Michael Hardy Sep 23 '12 at 16:28
But his sequence is not the t$_i$s it is the t$_i$s multiplied by x, You need to take account of the fact that the t$_i$s are integers. – Michael Chernick Sep 23 '12 at 16:29
@MichaelHardy: i'm not English, excuse me. – enzotib Sep 23 '12 at 16:36
@MichaelChernick: the median shouldn't be integer: Medians for samples. – enzotib Sep 23 '12 at 16:37
I totally forgot that position of median value does not change by multiplying the elements, hence can be computed in this simple manner... – Libor Sep 23 '12 at 16:38

The fact that y is the median only tells that approximately n/2 elements are below y and n/2 are above. So it seems that the most information comes from knowing y/x is an integer. So the only thing I think you can do is search through values less than y give y/x as an integer. There will be at least one but there could be more than 1 in which case you will get a discrete list of possible values.

share|cite|improve this answer

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.