Why does Wolfram Alpha mess up $\int \sin(\pi t)\cos(\pi t)dt$?

349 Views Asked by At

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.

2

There are 2 best solutions below

4
On BEST ANSWER

$$ \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.

0
On

Notice, both the results obtained are really same just need to manipulate as follows $$\int \sin(\pi t)\cos(\pi t)\ dt$$ $$=\int \frac{1}{2}(2\sin(\pi t)\cos(\pi t))\ dt$$ $$=\frac{1}{2}\int\sin(2\pi t)\ dt $$ $$=\frac{1}{2}\left(-\frac{1}{2\pi}\cos (2\pi t)\right)+c$$ $$=-\frac{2\cos^2(\pi t)-1}{4\pi}+c$$ $$=-\frac{2\cos^2(\pi t)}{4\pi}+\frac{1}{4\pi}+c$$ substituting a new constant $\frac{1}{4\pi}+c=C$, $$=-\frac{\cos^2(\pi t)}{2\pi}+C$$