Might be silly question, but is it a right formal way to define a median? $\frac{1}{2} \sum_{i=1}^n x_i$


  • 1
    $\begingroup$ No, it is not right $\endgroup$ – user164550 Apr 19 '16 at 19:36
  • 1
    $\begingroup$ No, that's not correct. $\endgroup$ – Wasiur Rahman Apr 19 '16 at 19:37

If you are given data $\{x_1,\ldots,x_n\}$, so that $x_1 \leq x_2 \leq \ldots \leq x_n$, then the median is

$$\large\begin{cases}x_{\frac{n+1}{2}} & \text{ if }n\text{ is odd}\\ \frac{1}{2}\left(x_{\frac{n}{2}} + x_{\frac{n}{2}+1}\right) & \text{ if }n\text{ is even}\end{cases}$$

Informally, one way to think about this is: if you arrange them from least to greatest, it is the entry right in the middle (i.e., it has the same number of entries below it as above it). In the case of an even number of data points, this would result in two different points (the two middle points which have the same number of entries above the pair as below it), but instead of doing this, you average the pair of middle points, and that gives the median.

This is why $\{1,2,3,4,5\}$ has median $3$, but $\{1,2,3,4,5,6\}$ has median $\frac{3+4}{2} = 3.5$

  • $\begingroup$ So (n+1)/2 is a subscript right? $\endgroup$ – YohanRoth Apr 19 '16 at 19:55
  • $\begingroup$ yes. I went with the fraction just because I wasn't sure which would look better between $x_{(n+1)/2}$ or $x_{\frac{n+1}{2}}$. Both look equally awkward to me when formatted in LaTeX, so I suppose I could make the LaTeX appear larger to clarify this. (I made it bigger, but it really just made the awkwardness in formatting more obvious to me. Please let me know if it needs clarified.) $\endgroup$ – Nicholas Stull Apr 19 '16 at 19:56
  • $\begingroup$ I've generally seen such things formatted as $x_{(n + 1)/2}$; see this answer in the MathJax help thread. $\endgroup$ – DylanSp Apr 19 '16 at 20:05
  • $\begingroup$ @DylanSp, I am aware of that thread, which is one reason why I had the dilemma about what to do with a subscript of $\frac{n}{2}+1$, which is why I went with the formatting I did (specifically for consistency) $\endgroup$ – Nicholas Stull Apr 20 '16 at 4:19

Hint: what is the median in $\{4,6,1000000000000000000\}$?

  • $\begingroup$ 6... then how to define it formally $\endgroup$ – YohanRoth Apr 19 '16 at 19:43
  • $\begingroup$ May be $x_{\frac{N+1}{2}}$ when $N$ is odd, and $0.5(x_{\frac{N}{2}}+x_{\frac{N}{2}+1})$ when $N$ is even. Given that $x_i$ is sorted. $\endgroup$ – user164550 Apr 19 '16 at 19:49
  • $\begingroup$ See Nicholas Stull's answer. $\endgroup$ – marty cohen Apr 19 '16 at 19:54
  • $\begingroup$ @martycohen would you please tell me the difference between the two answers?! $\endgroup$ – user164550 Apr 19 '16 at 20:01
  • $\begingroup$ And now my answer which was the first is voted to be deleted! That's so unfair! $\endgroup$ – user164550 Apr 19 '16 at 20:12

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.