Capital needed on the retirement date
Withdrawals in retirement usually rise with inflation and start on the retirement date, so they form a growing annuity due. Discount them at the inflation-adjusted rate, the return left after inflation:
Inflation-adjusted rate = (1 + r) / (1 + i) - 1
where r is the expected nominal return in retirement. Then:
Capital needed = present value of an annuity due of the first-year gap, at the inflation-adjusted rate, for the number of years in retirement
The shortcut r - i is only an approximation. With long horizons the difference matters, so use the exact rate unless a question asks for the shortcut.