Composed series expansion understanding

Recently I'm studying series expansion and there is something I don't understand but it's hard to tell what... For example, imagine I need to calculate the series expansion of $\sqrt{1+\sin(x)}$ at $ a=0$.

I want to do it as fast as possible, so my idea is to have the series expansion of $\sqrt{1+x}$ and then plug the series expansion of $\sin(x)$ in it. Since when $x = 0$, $\sin(x) = 0$ too...

So for $\sqrt{1+x}$ I find $1 + \frac{1}{2}x - \frac{1}{8}x^2 + \frac{1}{16}x^3 + O(x^4)$ for example.

For $\sin(x)$ it's $x-\frac{x^3}{3!}+O(x^5)$ Which are both correct but when I replace the $x$ of the first expansion by the $\sin(x)$'s one I find the result don't change from $1 + \frac{1}{2}x - \frac{1}{8}x^2 + \frac{1}{16}x^3 + O(x^4)$ while wolfram tells me the $x^3$ term should be $\frac{-1}{48}$ And it's where it doesn't make sense to me, why would it be the only term to change? Computers are always right so I do believe it's a misunderstanding but where could it be? Here's the thing I have for $x^3$ : $\frac{3}{8}\cdot\frac{1}{3!}\cdot\frac{1}{(1+x^3-\frac{x^3}{3!})^{5/2}}\cdot x^3 = \frac{1}{16}\cdot\frac{1}{(1+x^3-\frac{x^3}{3!})^{5/2}}\cdot x^3$ and for me the last term is equal to $1$ since $x$ is close to $0$.

Thanks in advance


Your approach is correct. Until you've got it mastered I'd use two different variables: so $$ \sqrt{1+y} = 1 + \frac{1}{2}y - \frac{1}{8}y^2 + \frac{1}{16}y^3 + O(y^4) $$ Then you want to substitute $$ y = x - \frac{1}{3!}x^3 + O(x^5) $$ So $$ \sqrt{1+y} = 1 + \frac{1}{2}\left(x - \frac{1}{3!}x^3 + O(x^5)\right) - \frac{1}{8}\left(x + O(x^3)\right)^2 + \frac{1}{16}\left(x + O(x^3)\right)^3 + O(x^4) $$ Note that there's no need to expand the third and fourth terms beyond $O(x)$ because they're squared/cubed and will give terms $O(x^4)$. This is why it's only the cubic term that changes.

So the extra term in $x^3$ you're looking for comes from collecting all terms in $x^3$ above.