solve the integral Could anyone help me on how to go about this integral.
Calculate:  $$\int_0^{\pi/6}\left(\sin2x-\frac{\cos 3x}{3}+\frac{x^2}{2}\right)dx$$
This is how I've done and not coming up with right answer:
I get a primitive function
$$\left[-\frac{\cos 2x}{2}-\frac{1}{3}\frac{\sin3x}{3}+\frac{x^3}{6}\right]_0^{\frac{\pi}{6}}$$
and then I go ahead substituting in the respective $\pi/6$ och 0 boundary values which lead to $$\frac{1}{4}-\frac{1}{9\sqrt{2}}+\frac{\pi^3}{216*6}$$ and it's a wrong answer.
Any suggestions are highly appreciated!
 A: Your primitive function is good but there are a few issues in the calculations afterwards:


*

*you missed a minus-sign (the first term is $\mathbf{\color{red}{-}}1/4$);

*you probably simplified the part of $\sin(3x)$ in $x=\pi/6$ in the wrong way: no square roots come out of that, but rather $\sin(\pi/2) = 1$;

*you missed a contribution from the lower limit $x=0$ ($\cos$ is $1$ there, not $0$).


Careful computation yields:
$$\begin{array}{rl}
\displaystyle \int_0^{\pi/6} \sin(2x)-\frac{\cos(3x)}{3}+\frac{x^2}{2} \, dx 
&\displaystyle = \left[ -\frac{\cos(2x)}{2}-\frac{\sin(3x)}{9} + \frac{x^3}{6}\right]_0^{\pi/6} \\[5pt]
&\displaystyle = \left( -\frac{\cos(\tfrac{\pi}{3})}{2}-\frac{\sin(\tfrac{\pi}{2})}{9} + \frac{\left( \tfrac{\pi}{6} \right)^3}{6}\right)-\left( -\frac{1}{2}-0+0\right) \\[5pt]
&\displaystyle = \left( -\frac{1/2}{2}-\frac{1}{9} + \frac{\left( \tfrac{\pi}{6} \right)^3}{6}\right)-\left( -\frac{1}{2}-0+0\right) \\[5pt]
&\displaystyle = \frac{5}{36}+\frac{\pi^3}{6^4}= \frac{5}{36}+\frac{\pi^3}{1296}
\end{array}$$
A: $$\int_{0}^{\frac{\pi}{6}}\left(\sin(2x)-\frac{\cos(3x)}{3}+\frac{x^2}{2}\right)\space\text{d}x=$$
$$\int_{0}^{\frac{\pi}{6}}\sin(2x)\space\text{d}x-\frac{1}{3}\int_{0}^{\frac{\pi}{6}}\cos(3x)\space\text{d}x+\frac{1}{2}\int_{0}^{\frac{\pi}{6}}x^2\space\text{d}x=$$

Substitute $u=2x$ and $\text{d}u=2\space\text{d}x$.
This gives a new lower bound $u=2\cdot0=0$ and upper bound $u=2\cdot\frac{\pi}{6}=\frac{\pi}{3}$:

$$\frac{1}{2}\int_{0}^{\frac{\pi}{3}}\sin(u)\space\text{d}u-\frac{1}{3}\int_{0}^{\frac{\pi}{6}}\cos(3x)\space\text{d}x+\frac{1}{2}\int_{0}^{\frac{\pi}{6}}x^2\space\text{d}x=$$

Substitute $s=3x$ and $\text{d}s=3\space\text{d}x$.
This gives a new lower bound $s=3\cdot0=0$ and upper bound $s=3\cdot\frac{\pi}{6}=\frac{\pi}{2}$:

$$\frac{1}{2}\int_{0}^{\frac{\pi}{3}}\sin(u)\space\text{d}u-\frac{1}{9}\int_{0}^{\frac{\pi}{2}}\cos(s)\space\text{d}s+\frac{1}{2}\int_{0}^{\frac{\pi}{6}}x^2\space\text{d}x=$$
$$\frac{1}{2}\left[-\cos\left(u\right)\right]_{0}^{\frac{\pi}{3}}-\frac{1}{9}\left[\sin\left(s\right)\right]_{0}^{\frac{\pi}{2}}+\frac{1}{2}\left[\frac{x^3}{3}\right]_{0}^{\frac{\pi}{6}}=$$
$$-\frac{1}{2}\left(\cos\left(\frac{\pi}{3}\right)-\cos\left(0\right)\right)-\frac{1}{9}\left(\sin\left(\frac{\pi}{2}\right)-\sin\left(0\right)\right)+\frac{1}{6}\left(\left(\frac{\pi}{6}\right)^3-0^3\right)=$$
$$-\frac{1}{2}\left(\frac{1}{2}-1\right)-\frac{1}{9}\left(1-0\right)+\frac{1}{6}\left(\frac{\pi^3}{216}-0\right)=\frac{5}{36}+\frac{\pi^3}{1296}$$
