I was reading the solution to a limit through Taylor expansion but did not understand this passage:
$$g(x)=\frac{1-\sqrt{1-x}}{\sqrt{1+x}-1}=\frac{\frac12 x+\frac18x^2+O(x^3)}{\frac12x-\frac18x^2+O(x^3)}=1+\frac12x+O(x^2)$$
Why is this equality true?
Divide both numerator and denominator by $\frac{1}{2}x$: $$g(x)=\frac{1+\frac{1}{4}x+O(x^2)}{1-\frac{1}{4}x+O(x^2)}$$
Use the fact that $\frac{1}{1-u} = 1+u + O(u^2)$ when $u\to 0$: $$g(x)=\left({1+\frac{1}{4}x+O(x^2)}\right)\left({1+\frac{1}{4}x+O(x^2)}\right)$$
Expand, stopping at the $x^2$ order (since you have an $O(x^2)$): $$g(x)={1+\frac{1}{4}x+O(x^2)+\frac{1}{4}x} = 1+\frac{1}{2}x+O(x^2)$$ (for the last step, you can also expand completely, and only then remove the terms that are "swallowed" by the $O(x^2)$. This will be a bit longer to do, but may prevent some mistakes in the computation.)