Evaluating $\int \cos(x^2 + x)dx$ I need to evaluate following integral,
$$\int \left( x + \frac{1}{2} \right) \cos(x^2 + x)\,dx$$
 but this one has got me pretty stumped! Any suggestions would be appreciated. Thanks!
 A: Notice that $\int(x+1/2)\cos(x^2+x)dx = \frac{1}{2}\int(2x+1)\cos(x^2+x)dx$
Therefore: Take $u = x^2+x$, with $du = (2x+1)dx$, giving you this integral:
$$\frac{1}{2}\int \cos(u)du = \frac{1}{2}\sin(u)+C = \frac{1}{2}\sin(x^2+x)+C$$
A: Complete the square $$x^2+x=(x+\frac12)^2-\frac14$$ and change variable $y=x+\frac12$. So, $$\cos(x^2 + x)=\cos(y^2-\frac14)=\cos(y^2)\cos(\frac14)+\sin(y^2)\sin(\frac14)$$ and then $$I=\int cos(x^2 + x)dx=\cos(\frac14)\int \cos(y^2)dy+\sin(\frac14)\int \sin(y^2)dy$$where you recognized Fresnel integrals $$\int \cos(y^2)dy=\sqrt{\frac{\pi }{2}} C\left(\sqrt{\frac{2}{\pi }} y\right)$$ $$\int \sin(y^2)dy=\sqrt{\frac{\pi }{2}} S\left(\sqrt{\frac{2}{\pi }} y\right)$$ So, back to $x$, $$\int \cos(x^2+x)dx=\sqrt{\frac{\pi }{2}} \left(\cos \left(\frac{1}{4}\right) C\left(\frac{2 x+1}{\sqrt{2
   \pi }}\right)+\sin \left(\frac{1}{4}\right) S\left(\frac{2 x+1}{\sqrt{2 \pi
   }}\right)\right)$$
A: I do not believe that this can be done in elementary form.  It can, however,
be done in terms of the Fresnel integrals
$C(x) = \int_{0}^{x} \cos(t^{2}) dt$, $S(x) = \int_{0}^{x} \sin(t^{2}) dt$.
Note that $(x+1/2)^{2} = x^{2} + x + 1/4$ and that by the Fundamental Theorem of
Calculus,
$\frac{dC(x+1/2)}{dx} = \cos(x^{2}+x+1/4) = \cos(x^{2}+x)\cos(1/4) - \sin(x^{2}+x)\sin(1/4)$.
Similarly,
$\frac{dS(x+1/2)}{dx} = \cos(x^{2}+x)\sin(1/4) + \sin(x^{2}+x)\cos(1/4)$.
Multiply the first of the derivative expressions by $\cos(1/4)$ and the second by $\sin(1/4)$ and add the results to obtain
$\frac{d[\cos(1/4)C(x+1/2)+\sin(1/4)S(x+1/2)]}{dx} = \cos(x^{2}+x)$.
Thus,
$\int \cos(x^{2}+x) dx = \cos(1/4)C(x+1/2) + \sin(1/4)S(x+1/2) + C$,
with $C$ being the constant of integration.
