# Integrals with $$\sin$$ and $$\cos$$

• Today, we'll apply trigonometric identities and the methods of integration we've seen so far to calculate integrals involving certain combinations of trigonometric functions.
• $$\int(\sin x)^2\cos x\,\mathrm dx$$.
• Here, we can use the substitution $$u=\sin x$$: $\int(\sin x)^2\cos x\,\mathrm dx=\int u^2\,\mathrm du=\frac12(\sin x)^3+C.$
• $$\int(\sin x)^3\,\mathrm dx$$.
• We want to transform the integrand to a form where there's a polynomial of $$\cos x$$ multiplied with $$\sin x$$, so that we can use the Substitution rule with $$u=\cos x$$.
• To that end, we use the trigonometric identity $$(\sin x)^2=1-(\cos x)^2$$: $\int(\sin x)^3\,\mathrm dx=\int(1-(\cos x)^2)\cdot \sin x\,\mathrm dx=\int(1-(\cos x)^2)\cdot\sin\ x\,\mathrm dx=\int(-1+u^2)\,\mathrm du=-\cos x+\frac12(\cos x)^2+C.$
• $$\int(sin x)^2(\cos x)^3\,\mathrm dx$$.
• Here, there's an odd power of $$\cos x$$, so we want to transform the integrand to a form where there's a polynomial of $$\sin x$$ multiplied with $$\cos x$$, so that we can use the Substitution Rule with $$u=\sin x$$: $\int(\sin x)^2(\cos x)^3=\int(\sin x)^2(1-(\sin x)^2)\cos x\,\mathrm dx=\int u^2-u^4\,\mathrm du=\frac13(\sin x)^3-\frac15(\sin x)^5+C.$

# Integrals with $$\sin$$ and $$\cos$$

• $$\int(\cos x)^2\,\mathrm dx$$.
• To calculate this integral, we need to use a half-angle formula: $\int(\cos x)^2\,\mathrm dx=\frac12\int1+\cos2x\,\mathrm dx=\frac12x+\frac14\sin2x+C.$
• $$\int(\cos x)^4\,\mathrm dx$$.
• This integral has no odd power either, so it's best to use half-angle formulas: $\begin{multline*} \int(\cos x)^4\,\mathrm dx=\frac14\int(1+\cos 2x)^2\,\mathrm dx=\frac14\int1+2\cos 2x+(\cos 2x)^2\,\mathrm dx\\=\frac14x+\frac14\sin2x+\frac18\int1+\cos 4x\,\mathrm dx=\frac14x+\frac14\sin2x+\frac18x+\frac{1}{32}\sin4x+C. \end{multline*}$

# Integrals with $$\sin$$ and $$\cos$$

• We're ready to state the general rules to integrate $$\int(\sin x)^m(\cos x)^n\,\mathrm dx$$:
• If $$m$$ is odd, then using $$(\sin x)^2=1-(\cos x)^2$$ transform the integrand to have $$\sin x$$ to exponent 1: $\int(\sin x)^m(\cos x)^n\,\mathrm dx=\int(1-(\cos x)^2)^{\frac{m-1}{2}}(\cos x)^n\sin x\,\mathrm dx$ and then use the Substitution rule with $$u=\cos x$$.
• If $$n$$ is odd, then using $$(\cos x)^2=1-(\sin x)^2$$ transform the integrand to have $$\cos x$$ to exponent 1: $\int(\sin x)^m(\cos x)^n\,\mathrm dx=\int(\sin x)^m(1-(\sin x)^2)^{\frac{n-1}{2}}\cos x\,\mathrm dx$ and then use the Substitution rule with $$u=\sin x$$.
• If both $$m$$ and $$n$$ are even, then use the half-angle formulas: $(\sin x)^2=\frac{1-\cos2x}{2}\,(\cos x)^2=\frac{1+\cos 2x}{2},\,\sin x\cos x=\frac{\sin 2x}{2}.$
• Exercises. 7.2: 2, 4, 6, 10, 14, 18.

# $$\int(\tan x)^m(\sec x)^n\,\mathrm dx$$

• If $$n$$ is even.
• You can use $$(\sec x)^2=1+(\tan x)^2$$ to get an expression of $$\tan x$$ multiplied by $$(\sec x)^2$$
• Since $$(\tan x)'=(\sec x)^2$$, you can now substitute $$u=\tan x$$.
• Example: $\int(\tan x)^2(\sec x)^4\,\mathrm dx=\int(\tan x)^2(1+(\tan x)^2)(\sec x)^2\,\mathrm dx=\int u^3+u^5\,\mathrm du=\frac14(\tan x)^4+\frac16(\tan x)^6+C$
• If $$m$$ is odd.
• You can use $$(\tan x)^2=(\sec x)^2-1$$ to get an expression of $$\sec x$$ multiplied by $$\tan x\cdot\sec x$$.
• Since $$(\sec x)'=\tan x\cdot\sec x$$, you can substitute $$u=\sec x$$.
• Example: $\int(\tan x)^7(\sec x)^4\,\mathrm dx=\int((\sec x)^2-1)^3(\sec x)^3\tan x\cdot\sec x\,\mathrm dx=\int u^9-3u^7+3u^5-u^3\,\mathrm du=\frac{1}{10}(\sec x)^{10}-\frac38(\sec x)^8+\frac12(\sec x)^6-\frac14(\sec x)^4+C.$

# $$\int(\tan x)^m(\sec x)^n\,\mathrm dx$$

• If neither $$m$$ is odd or $$n$$ is even, then there's no general algorithm.
• $$\int\sec x\,\mathrm dx$$.
• First, we rewrite the integrand: $=\int\sec x\frac{\tan x+\sec x}{\tan x+\sec x}\,\mathrm dx=\int\frac{\tan x\cdot\sec x+(\sec x)^2}{\tan x+\sec x}\,\mathrm dx.$
• Then we substitute $$u=\tan x+\sec x$$: $=\int\frac{1}{u}\,\mathrm du=\ln|\tan x+\sec x|+C.$
• $$\int(\sec x)^3\,\mathrm dx$$.
• We use integration by parts with $$u=\sec x,\,\mathrm dv=(\sec x)^2\,\mathrm dx$$: $=\tan x\cdot\sec x-\int(\tan x)^2\sec x\,\mathrm dx.$
• Now we use the identity $$(\tan x)^2=(\sec x)^2-1$$: $=\tan x\cdot\sec x-\int((\sec x)^2-1)\sec x\,\mathrm dx=\tan x\cdot\sec x-\int(\sec x)^3\,\mathrm dx+\int\sec x\,\mathrm dx=\tan x\cdot\sec x-\int(\sec x)^3\,\mathrm dx+\ln|\tan x+\sec x|$
• This we can rearrange: $2\int(\sec x)^3\,\mathrm dx=\tan x\cdot\sec x+\ln|\tan x+\sec x|+C.$
• Exercises. 7.2: 22, 24, 28, 30, 32

# $$\int\sin mx\cdot\cos nx\,\mathrm dx$$

• For these, we use the corresponding identity:
• $$\sin\alpha\cos\beta=\frac12(\sin(\alpha-\beta)+\sin(\alpha+\beta))$$
• $$\sin\alpha\sin\beta=\frac12(\cos(\alpha-\beta)-\cos(\alpha+\beta))$$
• $$\cos\alpha\cos\beta=\frac12(\cos(\alpha-\beta)+\cos(\alpha+\beta))$$.
• For example, we have $\int\sin3x\cos4x\,\mathrm dx=\frac12\int\sin(-x)+\sin7x\,\mathrm dx=\frac12\cos(-x)-\frac{1}{14}\cos7x+C.$
• Exercises. 7.2: 41, 42, 43
• More exercises. 7.2: 36, 40, 44, 46, 58, 62, 68