Welcome to our community

Be a part of something great, join today!

Integration - computer problem

Yankel

Active member
Jan 27, 2012
398
Hello,

I was trying to solve the integral of

sin(x)*cos(x)

using the substitution method, what I did was:

u=sin(x) and that yields du/dx = cos(x) and then du=cos(x)*dx

that comes to an integral of u*du, which is easy u^2 / 2 +C. substituting back gives the final answer

sin(x)^2 / 2

But, when I ran this integral in both Maple and Mathematica, I got this answer:

-cos(x)^2 / 2

Now I tried asking Maple if the two answers are the same, but it failed. I tried checking myself, using the relation sin(x)^2+cos(x)^2=1, and got to the conclusion that they don't. I don't see what I did wrong here...
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
Technically, you answer was not $\sin^{2}(x)/2$, but $\sin^{2}(x)/2+C.$ Likewise, the computer's answer was not $-\cos^{2}(x)/2$, but $-\cos^{2}(x)/2+C$. Since your two answers differ by a constant (namely, $1$), they are really the same answer from a calculus perspective.
 

Bacterius

Well-known member
MHB Math Helper
Jan 26, 2012
644
Technically, you answer was not $\sin^{2}(x)/2$, but $\sin^{2}(x)/2+C.$ Likewise, the computer's answer was not $-\cos^{2}(x)/2$, but $-\cos^{2}(x)/2+C$. Since your two answers differ by a constant (namely, $1$), they are really the same answer from a calculus perspective.
Or more clearly, $C_1$ and $C_2$. This happened to me a while ago, it tends to occur a lot with trigonometric functions because of their periodic identities, so you often end up with very different looking expressions which are in fact equal.. :confused:
 

Yankel

Active member
Jan 27, 2012
398
ah, I wasn't thinking about it....interesting.

well done to both of you ! thanks ! :)
 

topsquark

Well-known member
MHB Math Helper
Aug 30, 2012
1,123
Just to be cheeky about it:
[tex]\int sin(x)~cos(x) dx = \frac{1}{2} \int 2 sin(x)~cos(x) dx = \frac{1}{2} \int sin(2x)dx[/tex]

After u = 2x:
[tex]= \int sin(x)~cos(x) dx = \frac{1}{2} \int sin(u) \cdot \frac{1}{2} du[/tex]

[tex]= -\frac{1}{4} cos(u) + C = -\frac{1}{4} cos(2x) + C[/tex]

and upon using [tex]cos(2x) = cos^2(x) - sin^2(x)[/tex]
[tex]\int sin(x)~cos(x) dx = \frac{1}{4} \left ( sin^2(x) - cos^2(x) \right ) + C[/tex]

which contains both your sin and cos terms and is also off by a constant from the other solutions. (Nerd)

-Dan