# Is it the right definition of a median $\frac{1}{2} \sum_{i=1}^n x_i$

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

Thanks

• No, it is not right – user164550 Apr 19 '16 at 19:36
• No, that's not correct. – 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$

• So (n+1)/2 is a subscript right? – YohanRoth Apr 19 '16 at 19:55
• 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.) – Nicholas Stull Apr 19 '16 at 19:56
• I've generally seen such things formatted as $x_{(n + 1)/2}$; see this answer in the MathJax help thread. – DylanSp Apr 19 '16 at 20:05
• @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) – Nicholas Stull Apr 20 '16 at 4:19

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

• 6... then how to define it formally – YohanRoth Apr 19 '16 at 19:43
• 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. – user164550 Apr 19 '16 at 19:49
• See Nicholas Stull's answer. – marty cohen Apr 19 '16 at 19:54
• @martycohen would you please tell me the difference between the two answers?! – user164550 Apr 19 '16 at 20:01
• And now my answer which was the first is voted to be deleted! That's so unfair! – user164550 Apr 19 '16 at 20:12