1
$\begingroup$

Say, $n=5$ $[1,2,3,4,5]$,

$r=1$ .

The the ways to insert "$r=1$"$[x]$ element(s) into $5$-items are as follows:-

Way-1:- $[x,1,2,3,4,5]$

Way-2:- $[1,x,2,3,4,5]$

Way-3:- $[1,2,x,3,4,5]$

Way-4:- $[1,2,3,x,4,5]$

Way-5:- $[1,2,3,4,x,5]$

Way-6:- $[1,2,3,4,5,x]$

Final-answer :->6 (ways).

Another example, $say$, $n=3,$ $[1,2,3]$

$r=2[x,y]$

The ways are as follows :-

Way-1:- $[x,y,1,2,3]$

Way-2:- $[1,x,y,2,3]$

Way-3:- $[1,2,x,y,3]$

Way-4:- $[1,2,3,x,y]$

Way-5:- $[x,1,y,2,3]$

Way-6:- $[x,1,2,y,3]$

Way-7:- $[x,1,2,3,y]$

Way-8:- $[1,x,2,y,3]$

Way-9:- $[1,x,2,3,y]$

Way-10:-$[1,2,x,3,y]$

Total number of ways :- $10$.

The main question here is, for any given $n$ and $r$ , is there are a formula using combinatorics which can give the total number of ways ? Edit:- The $'n'$ items stay in the same order forever. Also, the '$r$' items always stay in order . First comes '$x$' , then only comes '$y$

$\endgroup$
5
  • $\begingroup$ Welcome to Mathematics stack exchange. Are you familiar with stars and bars? $\endgroup$ Commented Jan 20, 2020 at 14:53
  • 1
    $\begingroup$ Yes, Think of $n+r$ slots. There are ${n+r\choose r}$ ways of selecting $r$ slots to insert the (presumed indistinguishable items).The $n$ distinguishable items go into the remaining slots in a particular order. If you want all possible orders for the $n$ items, then multiply by $n!$. The "stars and bars" concept is closely related but slightly different. In that case the $r$ items represent "dividers" to divide the $n$ items into $r+1$ groups. $\endgroup$
    – almagest
    Commented Jan 20, 2020 at 14:56
  • $\begingroup$ The 'n' items stay in the same order forever, so that's not a problem I guess :-) Also, the 'r' items always stay in order . First comes 'x' , then only comes 'y'. $\endgroup$ Commented Jan 20, 2020 at 14:59
  • 1
    $\begingroup$ probably a typo given a qwerty keyboard ... $\endgroup$
    – user645636
    Commented Jan 20, 2020 at 15:00
  • $\begingroup$ $n+1$ for one item. the sum of $t+1$ for all $t<n$ if two items. etc. $\endgroup$
    – user645636
    Commented Jan 20, 2020 at 15:06

1 Answer 1

0
$\begingroup$

Why are not you considering arrangements of $x$ and $y$ in the 2nd example ($y$ can come before $x$)

For $n$ elements we have $(n+1)$ gaps, lets say $x_1$ elements goes to gap 1, $x_2$ elements in gap 2 .... And so on.

we have $x_1 + x_2+ \cdots + x_{n+1} = r$ ( where all $x$'s are whole numbers) , the number of possibilities is ${n+r \choose r}$ (also known as beggar's method dealing with providing $n$ coins to $r$ beggars).

And now finally arranging all $r$ things which is $r!$

So the final answer ${n+r \choose r}\times r!$

$\endgroup$
2
  • $\begingroup$ Its simple man. Its my condition that I want them in order. [x...y], as simple as that, so just removing r! does the job! $\endgroup$ Commented Jan 20, 2020 at 15:30
  • $\begingroup$ Yeah it perfectly does.😂 $\endgroup$ Commented Jan 20, 2020 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .