We have two cases which are mutually exclusive
- A chain of length exactly 3
- A chain of length 4
Our required probability will be the sum of these 2 cases.
$\text{Probability of length exactly } 3 = \text{No. of ways of selecting a slot} \times \text{Probability of exactly 3 hashing going to that slot} \\= {}^mC_1 \times 4C1 \times \frac{1}{m} \frac{1}{m} \frac{1}{m} \frac{m-1}{m}\\= 4 \frac {m-1}{m^3}$
$\text{Probability of length }4 = \text{No. of ways of selecting a slot} \times \text{Probability of 4 hashing going to that slot} \\= {}^mC_1 \times \frac{1}{m} \frac{1}{m} \frac{1}{m} \frac{1}{m}\\= \frac {1}{m^3}$
So, our required probability $= 4. \frac {m-1}{m^3} + \frac {1}{m^3} \\= \frac{4.m-3}{m^3}$.