I have the following problem:
A (possibly biased) coin is tossed repeatedly and independently. Let $p \in (0, 1)$ denote the probability of a head, and let $T_i$ be the toss number when the $i$th head is observed where $i = 1, 2, \dots$.
Show that, if $k \ge 2$, then
$$P(T_1 = j \vert T_2 = k) = (k - 1)^{-1}, \ \ \ (j = 1, \dots, k - 1),$$
independently of the value of $p$. Note that this conditional law is discrete uniform on the set $\{ 1, 2, \dots, k - 1 \}$.
The solution is as follows:
First, we determine an expression for $P(T_2 = k)$.
For $k \ge 2$, we have that
$$\begin{align} P(T_2 = k) &= \sum_{j = 1}^{k - 1} P(T_2 = k \vert T_1 = j) P(T_1 = j) \\ &= \sum_{j = 1}^{k - 1} (q^{k - j - 1} p)(q^{j - 1} p) \\ &= (k - 1) q^{k - 2} p^2, \end{align}$$
where we have used the law of total probability in the first line. Now, using Bayes' theorem, we get that, for $k \ge 2$ and $j \in \{ 1, \dots, k - 1 \}$,
$$\begin{align} P(T_1 = j \vert T_2 = k) &= \dfrac{P(T_2 = k \vert T_1 = j) P(T_1 = j)}{P(T_2 = k)} \\ &= \dfrac{(q^{k - 2} p^2) (q^{j - 1} p)}{(k - 1)q^{k - 2} p^2} = ( k -1)^{-1}. \end{align}$$
I don't understand how the first line is derived using the law of total probability. Specifically, I don't understand why the summation is to $k - 1$ instead of $k$.
I would greatly appreciate it if people would please take the time to clarify this.
You want the probability that the second head is observed at toss $k$. That can only happen if the first head happened before: at tosse $1$, or $2$, or ... , or $k-1$. Not at toss $k$: you cannot have both the first and second head at toss $k$.
Hence the summation for $j$ from $1$ to $k-1$: you could write the following terms, but for $j \geq k$ we have $\Pr[ T_2 = k \mid T_1 = j] = 0$...