ABSTRACT

HRRCC is a technique for finding the closed-form solution of linear recurrences where the current term is a linear combination of previous terms. It is the primary tool for analyzing sequences like Fibonacci and constraints on bit-strings.


When To Use

A recurrence is an HRRCC if it matches the form:

Two Mandatory Conditions:

  1. Homogeneity: Every term on the right-hand side is a function of a previous . There are no “extra” constants or terms (e.g., no or ).
  2. Constant Coefficients: The values must be constants, not functions of .

The “Characteristic” Method

  1. The Guess: Assume the solution takes the form .
  2. The Polynomial: Substitute the guess to create the Characteristic Equation:
    • For , the equation is .
  3. Solve for Roots: Find the roots () of the polynomial.
  4. General Form:
    • Distinct Roots: .
    • Multiplicity (Repeated Roots): If repeats twice, the form is .
  5. Solve for Constants: Use Base Cases and Gaussian Elimination (or simple substitution) to find and .

Examples

n-bit strings

An -bit string is a string of length consisting of 0s and 1s

NOTE

By Power Rule we already know the number of -bit strings are Try to find another way to find this value

Finding Pattern

Let be the number of n-bit strings

01
12
24
38
416

Partitioning the Set of the Results

Lets write this in

Solution

Unraveling
HRRCC

Guess

Now we know

To find , we need to use the base case

Result:

2 by n Domino Tiles

How many ways can we fill a by grid with dominos? Each domino takes up adjacent squares (can be vertical or horizontal)

Finding the Pattern

Let be the number of different domino tilings of a by grid

11
22
33
45
58
613
721
834

WARNING

Sometime it is helpful to find the pattern, but need to be careful (as suggested in this problem) pattern might not be what it first appears Notice for the patterns seems to emerge as a linear pattern. However after the pattern emerges differently from linear relation

Partitioning the Set of Results

Write in

NOTE

Notice having 2 base cases

The number of base cases needed depends on how far back the recurrence goes → what is the maximum depth the recursive call(s) go? With this problem, since there is a the number of base cases is 2

Solution

Guess

PROBLEM

has 2 values To resolve this, we incorporate both roots for in the form of linear combination

Let 2 roots be:

As such

It is clear that the first term dominates the term (since ). Therefore

NOTE

To find and , we want to use Gaussian Elimination For the purpose of computer science the coefficients and are not important as we only care about the growth rate of the function.

We can find and Use this, we can get the closed form of the algorithm to be

Notice that the second term grows smaller as increases, we can approximate as the nearest integer of which we get means the nearest integer of

N-Bit Binary Strings Without “11” Substring

Finding the Pattern

let be the number of binary strings without “11” substring

01
12
23
35

Partition the set

Solution

Guess

As such the runtime for

N-Bit Binary Strings Without “111” Substring

Finding the Pattern

Let be the number of binary strings of length without a occurrence of “111”

01
12
24
37
413

Partition the Set

Solution

Guess

NOTE

Notice that this is a cubic, to find the root we just use a online calculator to find the root

since with polynomials, it is possible to have complex numbers as a root and is difficult to solve a polynomial without generalized equation

By plugging in into Wolfram|Alpha: Computational Intelligence, we get 3 roots:

  • Note that although we have 3 roots and have complex roots, the real root () is the root that dominates the runtime

Key Insights

  • Multiplicity: If a root appears times, the terms are .
  • Dominant Root: In CS, we usually only care about the largest root, as it dictates the Big- growth.
  • Base Cases: You need as many base cases as the “depth” of your recurrence (e.g., needs 3 base cases).