I have to solve the following exercise about probability:
There are $w_1, \dots, w_n$. The user changes his password after every 2s from the list of passwords he has. The hacker checks the password every 1s starting from $w_1$ to $w_n$ (once he reaches $w_n$ he starts again from $w_1$).
At the beginning the user chooses his first password, and the hacker also starts to check the passwords.
Let $T$ be the tries the hacker requires to crack the password.
I have to find the function $p_T: \mathbb{N} \to [0,1],$ where $p_T(k) = P[T = K]$.
In the solution we separate the definition in the following way, we define:
$\blacksquare$ $T = 2k$ and
$\blacksquare$ $T = 2k - 1$
with $k \geq 1$
$$ P[T = 2k] = \left( \frac{n-1}{n} \cdot \frac{n-2}{n-1} \right)^{k-1} \cdot \frac{n-1}{n} \cdot \frac{1}{n-1} = \left( \frac{n-2}{n} \right)^{k-1} \cdot \frac{1}{n} $$
and
$$ P[T = 2k - 1] = \left( \frac{n-1}{n} \cdot \frac{n-2}{n-1} \right)^{k-1} \cdot \frac{1}{n} = \left( \frac{n-2}{n} \right)^{k-1} \cdot \frac{1}{n} $$
I know it's probably about combinatorics concepts, but I really doesn't understand this raw solutions without explanations.
I would really appreciate if someone could explain to me what's behind.