# Integration by parts or substitution for $\int x \cos (x^2) dx$

With $$\int x \cos (x^2) dx$$ I can use substitution to solve this integral.

$$u=x^2, dx =\frac{du}{2x}$$ $$\int x \cos (x^2) dx = \int x \cos (x^2) \frac{du}{2x} = \frac{1}{2} \int \cos(u) = \frac{1}{2}\sin(u)=\frac{1}{2}sin(x^2)+C$$

But can't I also solve it with integration by parts and should get the same result?

$$\begin{array} \int x\cos (x^2) dx &= \frac{1}{2}x\sin(x^2) - \frac{1}{2}\int 1\sin(x^2)dx \\ &= \frac{1}{2}x\sin(x^2) + \frac{1}{4}\cos(x^2)+C \end{array}$$

Or am I mixing up things?

## 2 Answers

The problem in your integration by parts is that $$\int \cos(x^2) \,dx \neq \frac 12\sin(x^2)$$

And similarly, you cannot integrate $\sin(x^2)$ as you did.

In both case, you are implicitly treating $x^2$ as the variable of integration, i.e., you are implicitly treating it as you would treat $u = x^2$ and integrating with respect to $u$, except for the fact that your failed to accommodate $du = 2x \,dx \iff dx = \dfrac{du}{2x}\neq \dfrac{du}2.$

$$\int \sin(x^2)\,dx \neq -\frac{1}{2}\cos(x^2)+C$$ $$\int \cos(x^2)\,dx \neq \frac{1}{2}\sin(x^2)+C$$ You can confirm that by differentiating the RHS.

• Should be $-\frac{1}{2}cos(x^2)$ but that gets eliminated – Chris Jun 19 '14 at 17:07
• I've just wanted to comment like this. The OP made lots of mistakes. – Tunk-Fey Jun 19 '14 at 17:07
• ah. now I see it.. That solves my question. – Chris Jun 19 '14 at 17:09
• derivative of $x^2$ is $2x$ and not $2$ – Chris Jun 19 '14 at 17:11