You are here
Homeintegration of rational function of sine and cosine
Primary tabs
integration of rational function of sine and cosine
The integration task
$\displaystyle\int\!R(\sin{x},\,\cos{x})\,dx,$  (1) 
where the integrand is a rational function of $\sin{x}$ and $\cos{x}$, changes via the Weierstrass substitution
$\displaystyle\tan\frac{x}{2}\;=\;t$  (2) 
to a form having an integrand that is a rational function of $t$. Namely, since $x=2\arctan{t}$, we have
$\displaystyle dx\;=\;2\cdot\frac{1}{1\!+\!t^{2}}\,dt,$  (3) 
and we can substitute
$\displaystyle\sin{x}\;=\;\frac{2t}{1\!+\!t^{2}},\quad\cos{x}\;=\;\frac{1\!\!t% ^{2}}{1\!+\!t^{2}},$  (4) 
getting
$\int\!R(\sin{x},\,\cos{x})\,dx\;=\;2\int\!R\!\left(\frac{2t}{1\!+\!t^{2}},\,% \frac{1\!\!t^{2}}{1\!+\!t^{2}}\right)\frac{dt}{1\!+\!t^{2}}.$ 
Proof of the formulae (4): Using the double angle formulas of sine and cosine and then dividing the numerators and the denominators by $\cos^{2}\frac{x}{2}$ we obtain
$\sin{x}\;=\;\frac{2\sin\frac{x}{2}\cos\frac{x}{2}}{\sin^{2}\frac{x}{2}+\cos^{2% }\frac{x}{2}}\;=\;\frac{2\tan\frac{x}{2}}{1+\tan^{2}\frac{x}{2}}\;=\;\frac{2t}% {1+t^{2}},$ 
$\cos{x}\;=\;\frac{\cos^{2}\frac{x}{2}\sin^{2}\frac{x}{2}}{\sin^{2}\frac{x}{2}% +\cos^{2}\frac{x}{2}}\;=\;\frac{1\tan^{2}\frac{x}{2}}{1+\tan^{2}\frac{x}{2}}% \;=\;\frac{1t^{2}}{1+t^{2}}.$ 
Example. The above formulae give from $\displaystyle\int\frac{dx}{\sin{x}}$ the result
$\int\frac{dx}{\sin{x}}\;=\;\int\frac{1\!+\!t^{2}}{2t}\cdot 2\cdot\frac{1}{1\!+% \!t^{2}}\;dt=\int\frac{dt}{t}\;=\;\lnt+C\;=\;\ln\left\tan\frac{x}{2}\right+C$ 
(which can also be expressed in the form $\ln\csc{x}+\cot{x}+C$; see the goniometric formulas).
Note 1. The substitution (2) is sometimes called the ‘‘universal trigonometric substitution’’. In practice, it often gives rational functions that are too complicated. In many cases, it is more profitable to use other substitutions:

In the case $\int\!R(\sin{x})\cos{x}\,dx$ the substitution $\sin{x}=t$ is simpler.

Similarly, in the case $\int\!R(\cos{x})\sin{x}\,dx$ the substitution $\cos{x}=t$ is simpler.

If the integrand depends only on $\tan{x}$, the substitution $\tan{x}=t$ is simpler.

If the integrand is of the form $R(\sin^{2}{x},\,\cos^{2}{x})$, one can use the substitution $\tan{x}=t$; then
$\displaystyle\cos^{2}{x}=\frac{1}{1+\tan^{2}{x}}=\frac{1}{1+t^{2}}$, $\displaystyle\sin^{2}{x}=1\cos^{2}{x}=\frac{t^{2}}{1+t^{2}}$, $\displaystyle dx=\frac{dt}{1+t^{2}}.$
Example. The integration of $\displaystyle\int\!\frac{dx}{\cos^{4}{x}}\,dx$ is of the last case:
$\int\!\frac{dx}{\cos^{4}{x}}\,dx=\int\!\frac{1}{(\cos^{2}{x})^{2}}\,dx=\int\!(% 1+t^{2})^{2}\cdot\frac{dt}{1+t^{2}}=\int\!(1+t^{2})\,dt=\frac{t^{3}}{3}+t+C=% \frac{1}{3}\tan^{3}{x}+\tan{x}+C.$ 
Example. The integral $\displaystyle I=\int\!\frac{dx}{\cos^{3}{x}}\,dx=\int\!\sec^{3}{x}\,dx$ is a peculiar case in which one does not have to use the substitutions mentioned above, as integration by parts is a simpler method for evaluating this integral. Thus,
$u=\sec{x}\;\Rightarrow\;du=\sec{x}\;\tan{x}\,dx;\qquad dv=\sec^{2}{x}\,dx\;% \Rightarrow\;v=\tan{x}.$ 
Therefore,
$\begin{array}[]{rl}I&\displaystyle=\int\!\sec^{3}{x}\,dx\\ &\displaystyle=\sec{x}\;\tan{x}\int\!\sec{x}\;\tan^{2}{x}\,dx\\ &\displaystyle=\sec{x}\;\tan{x}\int\!\sec{x}\;(\sec^{2}{x}1)\,dx\\ &\displaystyle=\sec{x}\;\tan{x}I+\int\!\sec{x}\,dx,\end{array}$
and consequently
$\int\!\frac{dx}{\cos^{3}{x}}\,dx\;=\;\frac{1}{2}\big(\sec{x}\;\tan{x}\;+\ln\;% \sec{x}+\tan{x}\big)+C.$ 
Note 2. There is also the ‘‘universal hyperbolic substitution’’ for integrating rational functions of hyperbolic sine and cosine:
$\tanh\frac{x}{2}\;=\;t,\quad dx\;=\;\frac{2dt}{1\!\!t^{2}},\quad\sinh{x}\;=\;% \frac{2t}{1\!\!t^{2}},\quad\cosh{x}\;=\;\frac{1\!+\!t^{2}}{1\!\!t^{2}}$ 
References
 1 Л. Д. Кдрячев: Математичецкии анализ. Издательство ‘‘ВүсшаяШкола’’. Москва (1970).
Mathematics Subject Classification
26A36 no label found Forums
 Planetary Bugs
 HS/Secondary
 University/Tertiary
 Graduate/Advanced
 Industry/Practice
 Research Topics
 LaTeX help
 Math Comptetitions
 Math History
 Math Humor
 PlanetMath Comments
 PlanetMath System Updates and News
 PlanetMath help
 PlanetMath.ORG
 Strategic Communications Development
 The Math Pub
 Testing messages (ignore)
 Other useful stuff
 Corrections
Comments
Open question in the entry 9380
Stevecheng's correction question (if I understood it):
R(sin{x}, cos{x})
is supposed continuous in odd multiples of pi. If we integrate through such a point using t = tan(x/2), can we obtain right results?
If anybody knows the thing, please supplement the entry.
Jussi
Re: Open question in the entry 9380
I have a calculus book that states that the Weierstrass substitution formulas (t=tan(x/2), sin x=(2t)/(1+t^2), etc.) are only valid for \pi<x<\pi. I am hesitant to add this though, as I do not know *why* x cannot take other values. In any case, for definite integrals, one could throw in a disclaimer such as, "this method works provided that the function is integrable on the specified domain."
Re: Open question in the entry 9380
I think that
$\lim_{x\to (\pi,\pi)}\tan{x/2}=(\infty,\infty)$,
covering all the real line.
I'm missing something?
Re: Open question in the entry 9380
Just to clarify, the issue does not seem to be the covering of the real line, but rather if the Weierstrass substitution method is valid if x is allowed to take values outside of this interval. This issue extends to improper integrals: Are the formulas for improper integrals obtained in this manner only valid for \pi<x<\pi?
Re: Open question in the entry 9380
I see. Thanks Warren.
perucho
Re: Open question in the entry 9380
Does the following reasoning work?
Suppose we restrict $\pi < x < \pi$.
In any small interval within this such that the integrand
is continuous (i.e. it has no poles), it is also holomorphic.
Then its indefinite integral is also a holomorphic function.
If one obtains an analytic expression on the righthand side
after integrating, then, by rigidity, that expression and the indefinite integral has to agree on the whole real line... ?
// Steve
Re: Open question in the entry 9380
1/(53cos{x}) is continuous in the whole R. Using t = tan(x/2) the integration gives the result
(1/2)arctan(2tan(x/2))+C
which isn't defined in odd multiples of pi. The right antiderivative is, by E. Lindel\"of,
x/4+(1/2)arctan(sin{x}/(3cos{x})).
Jussi
Re: Open question in the entry 9380
1/(53cos{x}) is continuous in the whole R. Using t = tan(x/2) the integration gives the result
(1/2)arctan(2tan(x/2))+C
which isn't defined in odd multiples of pi. The right antiderivative is, by E. Lindel\"of,
x/4+(1/2)arctan(sin{x}/(3cos{x})).
Jussi