OK, so I have run into this weird question about recurrence relations that I cannot complete by myself (first year comp. sci. student and first discrete math class, studying by myself). To help you better understand the question, I have written some examples right next to them (eg.). Here it is:
A password is valid if it contains an odd number of the digit 9 (eg. 1239499786 is valid but 129789945698 is not). Lets say that $S_n$ is the number of valid passwords that have $n$ digits. I need to find a recurrence relation for $S_n$. In other words, $S_n$ need to depend on $S_{\text{n - 1}}$.
Now I am not too good at this type of math and combinatorics are the worst for me. I have spent some time on this question, but I cannot see the answer, so please try to be a bit precise in your answers. I am sure that I will understand it if someone can provide a good explanation. Thanks, your help will be very appreciated!!! :D