2

If I have a total of $n$ balls made of $k$ red balls and $(n-k)$ green balls and I arrange them all randomly in a line, how can I calculate the probability $x$ of a group of $y$ red balls being together?

If $k=y$, the solution would be $x=\frac{k!}{n!}$, but I'm striving to find how to deal with cases where $k>y$.

Ken
  • 3,751
foobar
  • 21
  • 1
    If $k=y=1$ then $x=1$ so your formula $x=\frac{k!}{n!}$ is not correct. I think it should be $x=(n-k+1)\binom{n}{k}^{-1}$. – drhab Jun 16 '15 at 13:43
  • 1
    True, i forgot about that possibility. Could you explain me how did you come up with that formula? – foobar Jun 16 '15 at 13:58
  • 1
    There are $\binom{n}{k}$ ways to place the $k=y$ red balls. Under the condition that they should "be together" (I suspect they must be consecutive) there are $n-k+1$ ways to place them. – drhab Jun 16 '15 at 14:04
  • Alright, though the k>y case remains unsolved. – foobar Jun 16 '15 at 14:37

2 Answers2

1

Not an answer in closed form, but it might be useful. I am preassuming that your conditions are also met if there are more than $y$ red balls together.

Let $E_{n,k}$ denote the event that by arranging $k$ red balls and $n-k$ green balls there will be a consecutive row of at least $y$ red balls.

Let $R+1$ denote the spot of the first green ball.

Evidently $r\geq y$ implies that $P\left(E_{n,k}\mid R=r\right)=1$ and $r<y$ implies $P\left(E_{n,k}\mid R=r\right)=P\left(E_{n-r-1,k-r}\right)$.

Next to that we have $P\left(R=r\right)=\frac{k}{n}\frac{k-1}{n-1}\cdots\frac{k-r+1}{n-r+1}\frac{n-k}{n-r}$ for $r=0,1,\dots,k$.

There is a recursive relation: $$P\left(E_{n,k}\right)=P\left(R\geq y\right)+\sum_{r=0}^{y-1}P\left(E_{n-r-1,k-r}\right)P\left(R=r\right)$$

Btw, there is some resemblance with this question that deals with "with replacement".

drhab
  • 151,093
-1

Note: Going by what I believe is the intent of the question, I have made 2 assumptions:

(a) There are at least 2 green balls

(b) k < 2y

  1. Withdraw y red balls and cushion them on each end with a green ball.

    Balls remaining in the original group are (k-y) red and (n-k-2) green totalling (n-y-2) with the red placed in the group in **${n-y-2}\choose{k-y}$ ways.

    You have a sequence G - y reds - G treated as a block to be placed among the gaps between the (n-y-2) balls including ends i.e. in (n-y-1) available spots.

  2. Pr = (n-y-1)*${n-y-2}\choose{k-y}$/${n}\choose{k}$

  • If the two extremes were connected, forming a circle, would this equation still be true? – foobar Jun 16 '15 at 17:29
  • No, then only (n-y-2) available spots would be available for placement, and the formula would change accordingly – true blue anil Jun 17 '15 at 04:40
  • The formula originally posted needed some correction which has been done. – true blue anil Jun 17 '15 at 04:41
  • This is not correct. You have double counted the cases where there are two strings of $y$ red balls. You are also assuming that a longer string of red balls than $k$ is a failure. The original question is not clear. If I take $n=4, k=2, y=1$ the probability is claimed to be $2 {1 \choose 1}/{4 \choose 2}=\frac 13$, but clearly the answer is $1$ if longer strings are allowed. Even if longer strings are not allowed, the correct answer is $\frac 12$ as there are $6$ arrangements and red balls in$13,14,24$ succeed. – Ross Millikan Jun 17 '15 at 04:55
  • @Ross Millikan: Yea, I was mulling over duplicate strings... May be a condition k < 2y needs to be laid down.... – true blue anil Jun 17 '15 at 05:37
  • Aren't you overlooking the possibility that the group of $y$ red balls has no green left-neighbour or has no green right-neighbour? – drhab Jun 17 '15 at 08:56
  • @drhab: I have added a condition that there are at least 2 green balls, The question is loosely worded, and I think that OP had this in mind. If not, the answer is incorrect. – true blue anil Jun 17 '15 at 09:18