TITLE: Evaluating $\int P(\sin x, \cos x) \text{d}x$
QUESTION [54 upvotes]: Suppose $\displaystyle P(x,y)$ a polynomial in the variables $x,y$. 
For example, $\displaystyle x^4$ or $\displaystyle x^3y^2 + 3xy + 1$.
Is there a general method which allows us to evaluate the indefinite integral

$$ \int P(\sin x, \cos x) \text{d} x$$

What about the case when $\displaystyle P(x,y)$ is a rational function (i.e. a ratio of two polynomials)? 
Example of a rational function: $\displaystyle \frac{x^2y + y^3}{x+y}$.

This is being asked in an effort to cut down on duplicates, see here: Coping with *abstract* duplicate questions.
and here: List of Generalizations of Common Questions.

REPLY [5 votes]: Here are some other substitutions that you can try on a rational function of trigonometric functions. We name them Bioche substitution in France.
Let $P(\sin t,\cos t)=f(t)$ where $P(x,y)$ is rational function. Let $\omega(t)=f(t)dt$.

If $\omega(-t)=\omega(t)$, then $u(t)=\cos t$ might be a good substitution.
For example : $$\int \frac{\sin^3t}{2+\cos t}dt=-\int \frac{(1-\cos^2t)(-\sin t)}{2+\cos t}dt=-\int\frac{1-u^2}{2+u}=\int\frac{u^2-1}{2+u}=\int u-2+\frac{3}{u-2}du=\int u du-2\int du+3\int \frac{1}{u-2}=\frac{u^2}{2}-2u+3\log(u-2)$$
If $\omega(\pi-t)=\omega(t)$, then $u(t)=\sin t$ might be a good substitution.
For example : $$\int \frac{1}{\cos t}dt=\int \frac{\cos t}{\cos^2 t}dt=\int \frac{\cos t}{1-\sin^2 t}dt=\int \frac{1}{1-u^2}du=\int \frac{1}{2} \bigg(\frac{1}{1+u}+\frac{1}{1-u}\bigg)du=\frac{1}{2}(\log(u+1)-\log(1-u))$$
If $\omega(\pi+t)=\omega(t)$, then $u(t)=\tan t$ might be a good substitution.
For example : $$\int\frac{1}{1+\cos^2 t}dt=\int \frac{1}{1+\frac{1}{\cos^2 t}}\frac{dt}{\cos^2 t}=\int \frac{1}{1+\frac{\cos^2t+\sin^2t}{\cos^2 t}}\frac{dt}{\cos^2 t}=\int \frac{1}{2+\tan^2t}\frac{dt}{\cos^2 t}=\int\frac{1}{2+u^2}du=\frac{1}{\sqrt2}\arctan\frac{u}{\sqrt2}$$
If two of the previous relations are verified (in this case the three relations are verified), then $u=\cos(2t)$ might be a good substitution.

If none of these work, you can use the Weierstrass substitution presented in a previous answer.