# Problem with distribution function in binomial distribution

My problem is connected with evaluating $$P(X\geq n/2)$$ where $$X\mathtt {\sim} B(n,p)$$. It would be clear for me if in the place of $$n/2$$ we had $$n$$. I would appreciate any help.

• Let me think you are trying to get $P(X\geq \frac{n}{2})$ which is $$1-P(X< \frac{n}{2})=\sum_{x=0}^{\frac{n}{2}-1}b(x;n,p)=\sum_{x=0}^{\frac{n}{2}-1}{}^nC_xp^x(1-p)^{n-x}$$ What's wrong with this$?$ – emonHR Nov 12 '19 at 19:07
• I have also thought in this way but I wasn't sure. Thanks a lot! – Lover Nov 12 '19 at 19:24
• But where is 'one' after first equality? – Lover Nov 12 '19 at 20:47
• It's a typo. Ok I will make it answer then – emonHR Nov 13 '19 at 6:37

Let me think you are trying to get $$P(X≥\frac{n}{2})$$ which is $$P(X≥\frac{n}{2})=1-P(X<\frac{n}{2})\\ =1-\sum_{x=0}^{\frac{n}{2}-1}b(x;n,p)\\=1-\sum_{x=0}^{\frac{n}{2}-1}{}^nC_xp^x(1-p)^{n-x}$$

Obviously, the answer depends on $$n$$ and $$p,$$ so you need to give a formula in $$n$$ and $$p$$ as @emonhossain (+1) has done.

If $$n = 2$$ through $$20$$ and $$p = 1/2,$$ then here are two brief tables of results from R. Notice that, for even $$n,$$ all $$P(X \ge n/2)$$ are $$1/2.$$ For large odd numbers, answers become increasingly near to $$1/2.$$

Notes: (a) Disregard line numbers in brackets. (b) In R, pbinom is a binomial CDF. (c) The small number eps is necessary to get $$P(X \ge n/2)$$ instead of $$P(X > n/2),$$ when $$n$$ is even.

n=2:20; eps = .00001
pr = 1 - pbinom(n/2+eps ,n, .5)
cbind(n, pr)
n        pr
[1,]  2 0.2500000
[2,]  3 0.5000000
[3,]  4 0.3125000
[4,]  5 0.5000000
[5,]  6 0.3437500
[6,]  7 0.5000000
[7,]  8 0.3632813
[8,]  9 0.5000000
[9,] 10 0.3769531
[10,] 11 0.5000000
[11,] 12 0.3872070
[12,] 13 0.5000000
[13,] 14 0.3952637
[14,] 15 0.5000000
[15,] 16 0.4018097
[16,] 17 0.5000000
[17,] 18 0.4072647
[18,] 19 0.5000000
[19,] 20 0.4119015


A few larger values of $$n:$$

n=1000:1006;  pr = 1 - pbinom(n/2+eps, n, .5)
cbind(n, pr)

n        pr
[1,] 1000 0.4873875
[2,] 1001 0.5000000
[3,] 1002 0.4874001
[4,] 1003 0.5000000
[5,] 1004 0.4874126
[6,] 1005 0.5000000
[7,] 1006 0.4874251


By contrast, if $$p = 1/3,$$ then with increasing $$n$$ probability tends to lie increasingly below $$n/2.$$ Thus probabilities $$P(X > n/2)$$ shrink to $$0.$$

n = 1:50;  pr = 1 - pbinom(n/2+eps, n, 1/3)
plot(n, pr, type="b", pch=20)
abline(h=0, col="green2") 