1
$\begingroup$

Given a set $X=\{1,2,\ldots,n\}$, how would I count the number of subsets containing only nonconsecutive elements?

For example:

$X=\{1,2,3,4\}$

implies 3 nonconsecutive subsets:

$\{1,3\}, \, \{2,4\}, \, \{1,4\}$

  • 0
    Doesn't $\{1,3,4\}$ contain $3,4$ which **are** consecutive?2017-01-30
  • 3
    As a hint, these subsets would either contain 1 or not. The subsets containing 1 would not contain 2, but anything from 3 on out would be allowed (as long as they're still not consecutive). The subsets not containing 1 could contain anything from 2 on out (again, as long as they're still not consecutive). This leads to a recurrence relation, which will likely be familiar to you.2017-01-30
  • 0
    Why did you count $\{1,3,4\}$ but not $\{1,2,4\}$?2017-01-30
  • 0
    @MJD Yes, a typo. Fixed.2017-01-30
  • 1
    Why did you count $\{1,2,4\}$ but not $\{1,3,4\}$?2017-01-30
  • 0
    @MJD Because 3 and 4 are consecutive numbers, and as the title suggests, I am not interested in subsets containing consecutive numbers.2017-01-30
  • 0
    Aren't $1$ and $2$ consecutive numbers?2017-01-30
  • 0
    @SSepehr This question is different since the one you have linked asks for 2 non-consecutive elements, this one is generalized to subsets of any size.2017-01-30
  • 0
    Possible duplicate of http://math.stackexchange.com/questions/1841575/how-many-subsets-contain-no-consecutive-elements2017-01-30
  • 0
    @BensonLin I fixed the link.2017-01-30
  • 0
    Thanks for all who pointed out my various errors. I am sure that all of your expressed confusion by my question was real, and you took no pleasure in pointing out my errors by asking questions to which you (didn't) already know the answer. Further, I wish you great success in this life you have chosen to pursue, as I am sure it brings you great satisfaction and a strong sense of pride. And well it should! After all, if you didn't have this amazing ability to make others feel small, what would you have?2017-02-01

1 Answers 1

1

Let $f_1(x)$ be the number of ways to pick a subset of numbers from $\{1,2,\cdots,x-1,x\}$ such that the set does not contain 2 consecutive elements and must contain $x$. Let $f_2(x)$ be defined similarly but instead the subset must not contain $x$.

We can see that $f_1(x+1) = f_2(x)$ since if the subset contains $x+1$, it cannot contain $x$

Also, $f_2(x+1) = f_1(x) + f_2(x)$ as you can choose to add $x$ into the subset or not

We also know that $f_1(1) = 1$ and $f_2(1) = 1$

Simplifying:

$$ \begin{align} f_2(x+1) &= f_1(x) + f_2(x)\\ &= f_1(x-1) + 2f_2(x-1)\\ &= 2f_1(x-2) + 3f_2(x-2)\\ &= 3f_1(x-3) + 5f_2(x-3)\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ &= F_x + F_{x+1}\\ &= F_{x+2} \end{align} $$

$$ \begin{align} f_1(x+1) &= f_2(x)\\ &= f_1(x-1) + f_2(x-1)\\ &= f_1(x-2) + 2f_2(x-2)\\ &= 2f_1(x-3) + 3f_2(x-3)\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ & \space\space\space\space\space\space\space\space\space\space\space\space\space .\\ &= F_{x-1} + F_{x}\\ &= F_{x+1} \end{align} $$

where $F_x$ is the $x$th Fibonacci Number.

Thus $f_1(x) + f_2(x) = F_x + F_{x+1} = F_{x+2}$

  • 0
    Makes great sense. Accepted.2017-02-01