The recurrence relation for the number of bit strings of length n that do not contain three consecutive zeros is; aₙ = aₙ ₋ ₁ + aₙ ₋ ₂ + aₙ ₋ ₃
<h3>How to solve recurrence relations?</h3>
Let Sₙ represent a string of length n that does not have 3 consecutive zeros, and let aₙ be the number of such strings.
If we take a string of length n − 1 that does not contain 3 consecutive zeros which is sₙ ₋ ₁.
Now, when we add a₁ to the string, we will have a string sₙ.
If we take a string sₙ ₋ ₂ and add 10 at the end, it will produce a string sₙ.
If we take a string sₙ₋₃ and we add 100 at the end, we will obtain a string sₙ. We see that this string is different from the first two that ended with 1 while this ended with 00. Thus, there are no other possibilities without having 3 consecutive zeros. Thus, we have the recurrence relation as;