I'm reading about Markov Chains and have come across the following:
$ P_x (X_2 = y) = \sum\limits_{z\in \mathbb S} P_x (X_1 = z).P_x(X_2 = y|X_1 = z) $
where $ P_x (X_1 = z) = p(X_1 = z|X_0 = x) $
which is obtained through the law of total probability. I don't quite understand how this law has been applied to obtain the above Equation.
Eventually the following is obtained: $ \sum\limits_{z\in \mathbb S}p (x,z).p(z,y) $
which is apparently equal to $p^2(x,y)$. I thought it should be equal to $p^2(z,y)$, as we are going from x to y?
Thanks