# Integral with goniometric functions $\int(1+\cos^2x-\sin^2x)dx$

I am solving this example: Transcription:

But I am still wrong -- cannot find the right result. Could you help me, please, what am I doing wrong?

Thanks

• Is that $\int(11\cos^2x-\sin^2x)dx$? I'm having trouble reading your handwriting. – David H May 2 '14 at 20:05
• No, it is 1+cos^2(x)-sin^2(x). – Fermat May 2 '14 at 20:11
• Yes, it's 1+cos^2x, not 11cos^2x. – user984621 May 2 '14 at 21:41
• Is goniometric actually what they call trig in some countries? – MCT May 3 '14 at 13:18
• Your mistake is that ∫sin^2 is not -cos^2. Hamid's answer points out the solution which uses integration by parts. – Danny Birch May 3 '14 at 14:50

Here's a different route for finding the anti-derivative that doesn't rely on any trigonometric identities at all, save the derivatives of sine and cosine. Simple algebraic manipulation gives $$\int(\cos^2{x}-\sin^2{x})dx=\int(\cos{x}+\sin{x})(\cos{x}-\sin{x})dx.$$

Note that the derivative of $\cos{x}+\sin{x}$ is $\frac{d}{dx}(\sin{x}+\cos{x})=\cos{x}-\sin{x}$, which prompts the substitution $u=\cos{x}+\sin{x}$ in the integral above. Then,

$$\int(\cos^2{x}-\sin^2{x})dx=\int(\cos{x}+\sin{x})(\cos{x}-\sin{x})dx\\ =\int u\,du\\ =\frac12u^2+constant\\ =\frac12(\cos{x}+\sin{x})^2+constant$$

It follows immediately that the integral considered in your question is

$$\int(1+\cos^2{x}-\sin^2{x})dx=x+\frac12(\cos{x}+\sin{x})^2+constant.$$

Appendix: One might wish to verify the anti-derivative $F(x)=x+\frac12(\cos{x}+\sin{x})^2$ found by the method in this answer is consistent with the anti-derivative $G(x)=x+\frac12\sin{(2x)}$ arrived at in responses by other users. If you're suspicious that $F(x)\neq G(x)$, you'd be right. Beginners sometimes get tripped up by this, because they forget anti-derivatives need not be equal (all those times your high-school calculus teacher nagged on you to remember that pesky "+ constant", she really wasn't just being an insufferable pedant!). Indeed,

$$(\cos{x}+\sin{x})^2=\cos^2{x}+\sin^2{x}+2\cos{x}\sin{x}=1+\sin{(2x)}\\ \implies \frac12(\cos{x}+\sin{x})^2 - \frac12\sin{(2x)} = \frac12.$$

Since $F$ and $G$ only differ by a constant, they are consistent.

• Nice. It reminded me this solution: math.stackexchange.com/questions/180744/… – Martin Sleziak May 3 '14 at 14:04
• @MartinSleziak Oh wow. 'Slick' doesn't even begin to describe that method of solution. Thanks a bunch for sharing. – David H May 3 '14 at 14:16

It is wrong because $\int \sin^2(x)dx$ $\neq$$-\cos^2(x)+c$.

For this integral use the double angle trigonometric formulas:

$\sin^2(x)=\frac{{1-\cos(2x)}}{2}$

or

$\cos^2(x)=\frac{{1+\cos(2x)}}{2}$. Therefore if we call the integral $I$, then

$I=2\int \cos^2(x)dx=\int (1+cos(2x))dx=x+1/2\sin(2x)+c.$

• Hamid, thank you for your message, the result is correct. However, I still don't know how to count it - could you, please, outline it a bit more in detail? – user984621 May 2 '14 at 21:45
• look at the last term of the second line of your uploaded picture. It is $2\int \cos^2(x)dx$. But $2\int \frac{1}{2}dx=2\frac{x}{2}=x$and $\int \cos(2x)dx=\frac{1}{2}\sin(2x)$. please mark the answer as acceptable if it helps you. – Fermat May 3 '14 at 13:00

Recall that $\cos^2 x - \sin^2 x = \cos 2x$.

Then we have $\displaystyle \int [1 + \cos (2x)] dx = x + \frac{1}{2} \sin (2x) + C$