2
$\begingroup$

In the book Galois Theory of Ian Stewart, problem 1.11 states: "Let $P(n)$ be the number of ways to arrange $n$ zeroes and ones in a row, given that ones occur in groups of three or more. Show that $P(n)=2P(n-1)-P(n-2)+P(n-4)$".

From the recurrence relation, I guess we have to divide the problem. Here's what I did

  1. If the first position is $0$, we have $P(n-1)$ ways.
  2. If the first position is $1$, we have $P(n-1)$ ways subtracting some situations

And this is where I'm stuck. Any help would be appreciated. Thank you

  • 0
    You need to take into account that ones occur in groups of three or more2017-01-04
  • 0
    I did think about that, that condition confuses me2017-01-04
  • 0
    @XTL, there are exactly $n$ zeros and ones total, not $n$ of each.2017-01-04

1 Answers 1

3

$$ \begin{align} P(n) &=\overbrace{P(n-1)}^{\substack{\text{# of arrangements}\\\text{of $n-1$ digits}\\\text{prepending a $0$}}} +\overbrace{P(n-1)}^{\substack{\text{# of arrangements}\\\text{of $n-1$ digits}\\\text{prepending a $1$}}} -\overbrace{P(n-2)}^{\substack{\text{# of arrangements}\\\text{of $n-2$ digits}\\\text{prepending a $10$}}} +\overbrace{P(n-4)}^{\substack{\text{# of arrangements}\\\text{of $n-4$ digits}\\\text{prepending a $1110$}}}\\ \end{align} $$ The "# of arrangements of $n-1$ terms prepending a $1$" counts the arrangements starting with $4$ or more ones as well as those starting with "$10$", so we need to subtract the latter. We then need to add those arrangements starting with only $3$ ones.


Using Generating Functions $$ \begin{align} &\sum_{k=0}^\infty\overbrace{\vphantom{\left(\frac{x^3}{1-x}\right)^k}\left(1+\frac x{1-x}\right)}^{\text{$0$ or more zeros}}\overbrace{\left(\frac{x^3}{1-x}\frac x{1-x}\right)^k}^{\substack{\text{$3$ or more ones and}\\\text{$1$ or more zeros}}}\overbrace{\vphantom{\left(\frac{x^3}{1-x}\right)^k}\left(1+\frac{x^3}{1-x}\right)}^{\substack{\text{$0$ or $3$ or more ones}}}\\ &=\frac{1-x+x^3}{(1-x)^2}\sum_{k=0}^\infty\left(\frac{x^3}{1-x}\frac x{1-x}\right)^k\\ &=\frac{1-x+x^3}{(1-x)^2}\frac1{1-\frac{x^4}{(1-x)^2}}\\ &=\frac{1-x+x^3}{1-2x+x^2-x^4} \end{align} $$ The denominator of the generating function requires the recursion $$ P(n)=2P(n-1)-P(n-2)+P(n-4) $$ as mentioned in the text.

  • 0
    Let n=5. Think about 111002017-01-04
  • 0
    @chítrungchâu: Yes, I am writing a generating function approach and it gives the recursion in the question.2017-01-04
  • 0
    I mean your formula is wrong. You didn't include 111002017-01-04
  • 0
    @chítrungchâu: I understand. I have corrected the original argument.2017-01-04
  • 0
    @robjohn I'm also reading the book Galois theory by Stewart and didn't read anything about generating functions before. So I don't know what did you do. Where can I find a full explanation of such a method? I've seen some generating functions books like Herbert Wilf's generatingfunctionology but couldn't find such an example. That is, using generating function to find a recursion formula. All of I could see, were finding $a_n$ if we know the recursion formula. Could you help me, please?2017-11-20
  • 0
    @user486600: generating functions are basically formal power series; that is, we don't necessarily worry about convergence; we are mainly concerned about their coefficients. The coefficient of $x^n$ is usually a number of possibilities for given outcome indexed by $n$. In this case, the number of binary strings of length $n$ in which ones appear in groups of $3$ or more.2017-11-20
  • 1
    @user486600: the basic building block of such strings are $3$ or more ones followed by $1$ or more zeros. Each of these blocks are represented by $$\overbrace{\left(x^3+x^4+x^5+\cdots\right)}^{\text{$3$ or more ones}} \overbrace{\left(x^1+x^2+x^3+\cdots\right)}^{\text{$1$ or more zeros}} =\frac{x^3}{1-x}\frac{x}{1-x}$$ We can put together $0$ or more of these basic building blocks. Thus, we have $$\sum_{k=0}^\infty\left(\frac{x^4}{(1-x)^2}\right)^k =\frac1{1-\frac{x^4}{(1-x)^2}}$$ Each choice of an $x^n$ in a factor represents a substring of length $n$.2017-11-20
  • 1
    @user486600: Since the strings represented by these basic building blocks all start with a one and end with a zero, they don't generate all strings. To generate all strings, we start with $0$ or more zeros: $$1+x+x^2+\cdots=\frac1{1-x}$$ and terminate with either $0$ or $3$ or more ones: $$ 1+x^3+x^4+x^5+\cdots=1+\frac{x^3}{1-x} $$ Thus, we get the final generating function $$ \frac1{1-x} \frac1{1-\frac{x^4}{(1-x)^2}}\frac{1-x+x^3}{1-x} =\frac{1-x+x^3}{1-2x+x^2-x^4}$$2017-11-20
  • 1
    @user486600: How does this generating function dictate the given recrurrence? Consider that $$ \begin{align}1-x+x^3 &=(1-2x+x^2-x^4)\sum_{k=0}^\infty a_kx^k\\ &= \overbrace{\ \ \ \ \ a_0\ \ \ \ \ \vphantom{x^2}}^1+\overbrace{(a_1-2a_0)\vphantom{x^2}}^{-1}\,x+\overbrace{(a_2-2a_1+a_0)\vphantom{x^2}}^0\,x^2+\overbrace{(a_3-2a_2+a_1)\vphantom{x^2}}^1\,x^3\\ &+\sum_{k=4}^\infty\overbrace{(a_k-2a_{k-1}+a_{k-2}-a_{k-4})\vphantom{x^2}}^0x^k\end{align}$$ Thus, we get $a_0=a_1=a_2=1,a_3=2$, and $a_k=2a_{k-1}-a_{k-2}+a_{k-4}$ for $k\ge4$.2017-11-20
  • 0
    @robjohn Thanks a lot for your very detailed answer. I will try to understand your answer.2017-11-20
  • 0
    @robjohn I finally understood your explanations. Thanks once again.2017-11-22
  • 0
    @user486600: Great! Generating functions can be a very powerful tool.2017-11-22
  • 0
    @robjohn What are the those numbers (1, -1, 0 and 1) above the terms in your second last comment?2018-05-30
  • 0
    @StupidMan: they are the coefficients of $x^k$ from $1-x+x^3$. Note that the sequence you started is actually $(1,-1,0,1,0,0,0,\dots)$ .2018-05-31