In the book I'm studying from there's the formula for the Maclaurin series of $\ln(1+x)$:
$\ln(1+x) = x - x^2/2 + x^3/3 + ... + (-1)^{n-1} x^n/n + \mathcal{O}(x^{n+1})$
In the examples the book gives of dealing with composition of functions the authors simply makes a variable substitution, expand as usual with the new variable and then substitute in the original expression. They never explain when or why this is valid even though I suspect it has to do with the range of the inner function near $0$.
I want to calculate the maclaurin series for $\ln(1+x+x^2/2)$ up to order $1$. I assumed I could just make the variable substitution $u=x + x^2/2$ and expand:
$\ln(1+u) = u + \mathcal{O}(u^{2}) = x + x^2/2 + \mathcal{O}((x^2 + 2x^3/2 + x^4/4)) = x + x^2/2 + \mathcal{O}(x^{2})$.
I have understood this answer is wrong and that the answer should be $x + \mathcal{O}(x^2)$. Where do I go wrong?
Note that your $x^2/2$ can be absorbed into $O(x^2)$.
That is $x+x^2/2+O(x^2)$ can be rewritten as $x+O(x^2)$.