# Wolfram double solution to $\int{x \cdot \sin^2(x) dx}$

I calculated this integral :

$$\int{x \cdot \sin^2(x) dx}$$

By parts, knowing that $\int{\sin^2(x) dx} = \frac{1}{2} \cdot x - \frac{1}{4} \cdot \sin(2x) +c$. So I can consider $\sin^2(x)$ a derivative of $\frac{1}{2} \cdot x - \frac{1}{4} \cdot \sin(2x)$, and I get this result:

$$\frac{1}{4} \cdot x^2 - \frac{x}{4} \cdot \sin(2x) + \frac{1}{4} \cdot \sin^2(x) +c$$

I get the confirm on wolfram if I try to compute the derivative of $\frac{1}{4} \cdot x^2 - \frac{x}{4} \cdot \sin(2x) + \frac{1}{4} \cdot \sin^2(x) +c$, but here if I try to compute the integral of $\int{x \cdot \sin^2(x) dx}$ I get this result:

$$\frac{x^2}{4} -\frac{1}{4} \cdot x \cdot \sin(2x) -\frac{1}{8} \cdot \cos(2x)$$

But $\frac{1}{8} \cdot \cos(2x)$ isn't equal to $\frac{1}{4} \cdot \sin^2(x)$, which is the correct result?

-
$\cos (2x) = \cos^2 x - \sin^2 x = 1 - 2\sin^2 x$, so $-\frac18 \cos (2x) - \frac14\sin^2 x$ is constant. –  Daniel Fischer Jul 6 '13 at 19:40

We have that $\sin^2 x = \frac{1-\cos (2x)}{2}$. Therefore, $\frac14 \sin^2 x = \frac{1-\cos (2x)}{8} = \frac18 - \frac18 \cos (2x)$. The extra $\frac18$ is taken care of by the constant of integration. In other words, if two functions differ by a constant, they have the same derivative. This is something that happens often when integrating trigonometric functions because of the various identities.
By the double angle identity for cosine, they differ by a constant. Add a constant of integration $d$ to your answer, and the two answers will be equivalent.