# Is the integral of $\sin(2x)$ equal to both $\sin^2(x)+C$ and $\frac{1}{2}\cos(2x)+C$?

This morning I encountered the integral $\int \sin(2x)$. My initial approach to solving it went something like this:

$\int \sin(2x)\ dx=\int 2\sin(x)\cos(x)\ dx$ (by the $\sin(2x)=2\sin(x)\cos(x)$ identity)

Let $u=\sin(x)$ and it's derivative $\frac{du}{dx}=\cos(x)$

Rewrite the integral with respect to $u$ and take out the constant:$\int 2u\ du = 2 \int u\ du$

Solve using the power rule: $2\int u\ du = 2 \cdot \frac{u^2}{2}+C = u^2 + C$

Resubstitute in terms of $x$: $\sin^2(x)+C$

I then tried to verify my results using various integral calculators (namely Wolfram Alpha), but they gave me the result $\frac 12\cos(2x)+C$, which does make sense if you instead of using the trigonometric identity just pick your subsitution to be $u=2x$. Graphing the results however shows this: It's quite clear that these results aren't equal to each other, no matter how you adjust the constants.

My question is, what is going on here? How come integrating the same functions using two different approaches yields results that are not the same function?

• $\sin^2x=\frac12-\frac12\cos2x$. You lost a $-1$ somewhere. Nov 19 '17 at 11:17
• Jesus, I need a pair of glasses.. You're right, I just didn't read the Wolfram Alpha result correctly. Thank you very much! Nov 19 '17 at 11:22
• So doing simple integrations is now down to reading Wolfie A accurately $\ddot\frown$. Nov 19 '17 at 11:26
• Well, I did my first integration correctly. It just went wrong when I tried to verify it using Wolfram Alpha! Nov 19 '17 at 11:29
• The first move in checking an integration is to differentiate it & see what you get. Nov 19 '17 at 12:43

Lord Shark the Unknown spotted my mistake in the comments. The problem was that I had missed a minus sign when reading from Wolfram Alpha. The actual answer was $$\int \sin(2x)\ dx = -\frac{1}{2} \cos(2x)+C=\sin^2(x)+C$$ This makes the two solutions equal.
Just a nice point for a beginner- $$\int \cos (mx) dx=\frac{\sin(mx)}{m}+C$$
$$\int \sin (mx) dx=-\frac{\cos(mx)}{m}+C$$
So,while doing a standard integration of $$f(x)$$ in the form of $$f(mx)$$ where $$m$$ is a constant, you simply get $$\frac{F(mx)}{m}+C$$ where $$F(x)$$ is the antiderivative of $$f(x)$$.