If you enter "\int \sin(pi t)\cos(pi t)dt" into Wolfram Alpha, it yields the result $-\frac{\cos^2(\pi t)}{2 \pi}$ which is obviously false, since integrals can't be negative (right?) In fact the correct answer is $\frac{\sin^2(\pi t)}{2\pi}$.
The way I found this was by choosing $\sin(\pi t)$ as $u$, leaving $\pi \cos(\pi t)$ as $du$ and integrating $\frac{1}{\pi}\int udu$ to $\frac{u^2}{2 \pi}$ which turns back into $\frac{\sin^2(\pi t)}{2\pi}$.
It seems that Wolfram Alpha chose $cos(\pi t)$ as $u$, which led to the negative result. But $-\frac{\cos^2(\pi t)}{2 \pi} \ne \frac{\sin^2(\pi t)}{2\pi}$.
My question is, how or why can the choice of $u$ lead to different results when integrating?
EDIT: Of course integrals of functions can be negative. I was just remembering my teacher saying that definite integrals must be positive if the function is positive on the interval, which clearly isn't the case here. Sorry.
$$ \int\sin(\pi t)\cos(\pi t)\,dt= \frac{1}{2}\int\sin(2\pi t)\,dt=-\frac{\cos(2\pi t)}{4\pi}+c $$ Just check the derivative.
Now you can expand $\cos(2\pi t)$ as $$ \cos(2\pi t)=2\cos^2(\pi t)-1=1-2\sin^2(\pi t) $$ and get both forms. None is “the right one”, both are correct. Functions which differ by a constant have the same derivative.