1

Let we have $p$ $+$ and $q-$. How many ways we can put them in a line so that no $2$ $-$ are near? If $p = 2$ and $q = 3$ there is only one way $-+-+-$.

Ashot
  • 4,753
  • 3
  • 34
  • 61

2 Answers2

4

Put down $p$ $X$'s like this: $$X \qquad X \qquad X \qquad X \qquad X \qquad X \qquad X \qquad X \qquad X \qquad $$ These are intended to mark the ultimate locations of the $+$.

These determine $p+1$ places where we could inset a $-$ (the $p-1$ "gaps" between $X$'s, and the two ends).

We must choose $q$ of these. That can be done in $\dbinom{p+1}{q}$ ways.

Remark: This is correct even if $q\gt p+1$, if we use the convention that $\binom{a}{b}=0$ if $a\lt b$.

André Nicolas
  • 507,029
0

By near, let's say it means next to each other.

Suppose $p = 5$ and $q = 7$.

Then there are "total arrangements - impossible arrangements" = $\frac{12!}{5!7!} - 2!11 = 770$ ways.

So there are $\frac{p + q}{p!q!} - 2(p + q - 1)$ ways.

p.s. that means there are 2, not 1, ways to your example.

Don Larynx
  • 4,703