Maclaurin series of $\tan(x+x^2)$ to order 3

I know that the maclaurin series of $$\tan(x)$$ is $$\tan(x)=x+\frac{1}{3}x^3+\frac{2}{15}x^5+...$$, then shouldn't be $$\tan(x+x^2)=(x+x^2)+\frac{1}{3}(x+x^2)^3+\frac{2}{15}(x+x^2)^5+...$$?

Mathematica actually gives me $$\tan(x+x^2)=x+x^2+\frac{x^3}{3}+o(x^4)$$ to order 3.

• We need to ignore terms containing $$x^4$$ – lab bhattacharjee Jul 2 at 15:43

Expanding the monomial terms gives Mathematica's result – and you can stop at $$(x+x^2)^3$$: $$(x+x^2)+\frac13(x+x^2)^3=x+x^2+\frac13(x^3\color{lightgrey}{+3x^4+3x^5+x^6})=x+x^2+\frac{x^3}3$$
Alternatively: \begin{align}y&=\tan{(x+x^2)} \Rightarrow \color{red}{y(0)=0}\\ \arctan y&=x+x^2\\ \frac1{1+y^2}\cdot y'&=1+2x\\ y'&=(1+\color{red}y^2)(1+2x) \Rightarrow \color{blue}{y'(0)=1}\\ y''&=2\color{red}yy'(1+2x)+2(1+\color{red}y^2)\Rightarrow \color{green}{y''(0)=2}\\ y'''&=2\color{blue}{y'}^2(1+2x)+2\color{red}yy''(1+2x)+8\color{red}yy' \Rightarrow \color{brown}{y'''(0)=2}\\ y&=\tan(x+x^2)=\color{red}{y(0)}+\frac{\color{blue}{y'(0)}}{1!}x+\frac{\color{green}{y''(0)}}{2!}x^2+\frac{\color{brown}{y'''(0)}}{3!}x^3+O(x^4)=\\ &=x+x^2+\frac{x^3}{3}+O(x^4).\end{align}