# Mdm of the Binomial distribution

[ilmath]\newcommand{\P}[2][]{\mathbb{P}#1{\left[{#2}\right]} } \newcommand{\Pcond}[3][]{\mathbb{P}#1{\left[{#2}\!\ \middle\vert\!\ {#3}\right]} } \newcommand{\Plcond}[3][]{\Pcond[#1]{#2}{#3} } \newcommand{\Prcond}[3][]{\Pcond[#1]{#2}{#3} }[/ilmath]
[ilmath]\newcommand{\E}[1]{ {\mathbb{E}{\left[{#1}\right]} } } [/ilmath][ilmath]\newcommand{\Mdm}[1]{\text{Mdm}{\left({#1}\right) } } [/ilmath][ilmath]\newcommand{\Var}[1]{\text{Var}{\left({#1}\right) } } [/ilmath][ilmath]\newcommand{\ncr}[2]{ \vphantom{C}^{#1}\!C_{#2} } [/ilmath]

## Statement

Let [ilmath]n\in\mathbb{N}_{\ge 1} [/ilmath] and [ilmath]p\in[0,1]\subseteq[/ilmath][ilmath]\mathbb{R} [/ilmath] and:

We will calculate the Mdm of [ilmath]X[/ilmath], [ilmath]\E{\big\vert X-\E{X}\big\vert} [/ilmath]

## Proof

We begin:

• $\Mdm{X}:\eq\sum^n_{k\eq 0}{\big\vert k-\E{X}\big\vert\cdot\P{X\eq k} }$
$\eq\sum^n_{k\eq 0}\big\vert k-np\big\vert\cdot\ncr{n}{k}\cdot p^k\cdot (1-p)^{n-k}$ - by substitution of the expectation of the binomial distribution, as well as the expression for probability of [ilmath]X\eq k[/ilmath]

We now operate on the [ilmath]\vert\cdot\vert[/ilmath] part, there are 2 cases (and we will introduce the [ilmath]\lfloor\cdot\rfloor[/ilmath] or "floor function")

• Note that as [ilmath]np\ge 0[/ilmath] we will have [ilmath]\lfloor np\rfloor\le np[/ilmath][Note 1]

Case analysis:

1. Suppose [ilmath]k\ge np[/ilmath]
• now [ilmath]k-np\ge 0[/ilmath] so by the definition of absolute value (specifically that if [ilmath]x\ge 0[/ilmath] then [ilmath]\vert x\vert\eq x[/ilmath]) we see:
• if [ilmath]k\ge np[/ilmath] then [ilmath]k-np\ge 0[/ilmath] and if [ilmath]k-np\ge 0[/ilmath] then [ilmath]\vert k-np\vert\eq k-np[/ilmath]
• Conclusion: for this case we have [ilmath]\vert k-np\vert\eq k-np[/ilmath]
• Note additionally that [ilmath]\lfloor np\rfloor\le np[/ilmath] so we have: [ilmath]k\ge np\ge \lfloor np\rfloor[/ilmath] [ilmath]\implies[/ilmath] [ilmath]k\ge \lfloor np\rfloor[/ilmath]

## Notes

1. Defining floor for negative values can be "controversial"