given the following undirected graph:
I need to find a recurrence relation that describes the number of possible walks starting at point A.
Well, naive me Iv'e defined $ a_n $ and tried to find the rule, but I got to a dead end. Eventually, I looked up the answer and found that they have defined two relations:
$ a_n $ - for walks start from A or D
$ b_n $ - for walks start from B or C
Then, it is easy to see that: $$ a_n = 2b_{n-1} \quad\quad b_n = 2a_{n-1} + b_{n-1} $$
And this one is pretty easy to solve..
BUT it did not come to my mind before looking at the answers!
In a matter of fact, I never really understood in what cases I should define more than one relation, and why in this specific case it is the right way to do that?
As you understand, I don't need the answers for the specific problem, but want to learn the way of thinking about this kind of questoins, since I keep doing mistakes in them.
Thanks!