# Expectation question regarding flips of a coin?

If I flip a coin 9 times, what is the expected value of HT or TH in the run of 9 flips? Basically, I was thinking that HT or TH in the run of 9 flips would essentially mean the number of times that the coin changes from tails to heads or heads to tails. I was thinking of using $$X$$ as my random variable denoting number of times the coin changes sides, and $$X_i$$ as the random variable that is 1 if the $$ith$$ and $$i + 1th$$ flip values are different. However, I am not sure how to calculate the expected value of each $$X_i$$ and would appreciate some help in whether I am approaching this right.

Your approach is sound. Each $$X_i$$ only depends on the $$i^{th}$$ flip and the $$i+1^{st}$$. They are all the same except for one. Now use the linearity of expectation to add them up for the total expectation.