# Simplify or bound using Big-O notation

I was following a research paper which have the following equation:

$$\left(1-\frac{1}{K}\right)^{K-i}\left[1-\left(1-\frac{1-p}{K}\right)^{i}\right]=\frac{i(1-p)}{K}+O\left(\left(\frac{i}{K}\right)^{2}\right)$$

Note that the asymptotics are with respect to $$K$$ and $$i$$ can vary from 1 to $$K$$. My understanding of how they obtained it is as follows:

$$\left(1-\frac{1}{K}\right)^{K-i} \leq 1-\frac{k-i}{k}+\frac{(k-i)(k-i-1)}{2k^2} \leq \frac{i}{k}+\frac{(k-i)^2}{2k^2}\leq1+O((\frac{i}{k})^2)$$.

Similarly, $$\left[1-\left(1-\frac{1-p}{K}\right)^{i}\right]\leq \frac{i(1-p)}{K}.$$

Are these steps right? Can someone let me know if there are any mistakes in these steps.