So I had this school assignment with this question
$\int (\cos x - \sin x)^2 \ dx$
And through computations I came up with this:
$\int (\cos x + \sin x )\ dx - \int 2 \cos x \sin x$
And this is where I got stuck, that when I integrate $2 \cos x \sin x$ right away, I would actually get $\color{blue}{x - \sin^2 x + C}$, which is different if I applied the double angle trigonometric identities in $2 \cos x \sin x$ , rewrite it to $\sin 2x$ , and it will give me a different answer, $\color{red}{x + \cos(2x)/2 + C}$
I went to Symbolab, and it really shows the difference, whether I integrate it right away or apply the trigonometric identity first before integrating
I tried to plot the points in Desmos, two answers seems close enough that it's just one constant away (particularly $0.5$), but still mathematically not equal.
So, does this mean that this trigonometric identity changed the actual answer that I should avoid using it as much as possible. Or this is just an exception? Which one is right? Is it both of the two answers?
I already passed my answer to the teacher, but what I actually did before passing it is integrating right away. But this problem haunts me in sleep that I actually opened my pc to ask this question here. Still learning integration techniques that I got introduced to this kind of problem, that overall it's pretty fun and stressing.


