I have recently started learning about probability and came across this question in my textbook.
Let $X_1,X_2,X_3,...$ be i.i.d discrete random variables. Let $N$ be a positive discrete random variable, not necessarily independent of $X_1,X_2,X_3,...$. Are $X_{N+1}$ and $X_N$ independent?
My first thought is that they should be independent because the entire sequence of $X$'s is i.i.d. I can prove independence by proving $P(X_{N+1} = x | X_N) = P(X_{N+1} = x)$, but I couldn't get anywhere trying this.
My second thought is that they are not independent since they both depend on the variable $N$.
I'm not sure what to do now.
Let each $X_i$ be Bernoulli variables with $p = \frac12$ (i.e. fair coin flips), and let $N$ be the smallest $i$ for which $X_i = X_{i+1}$ (or $N = 0$ if it never happens).
Then $P(X_N = 0) = \frac12$, but $P(X_N = 0\mid X_{N+1} = 0) = 1$, making them dependent.