NOTE: A similar question asking for the definite integral has been posted elsewhere and the answer by Christian Blatter is good for me. But my question asks how to get to the same answer starting from the indefinite expression supplied by Wolfram Alpha and has elicited some points useful to me on dealing with $\sqrt{\sin^2(x)}\csc{x}$ when $x=0$ or $2\pi$. Also shows that Wolfram Alpha may not be the best place to start from sometimes.
An expression for the indefinite integral $\int \cos^P(x)\text{ d}x$ is given by Wolfram Alpha as:- $$\int \cos^P(x) \text{ d}x=\frac{-\sqrt{\sin^2(x)}\csc(x)\cos^{P+1}(x)_2F_1\big(\frac{1}{2},\frac{P+1}{2};\frac{P+3}{2};\cos^2(x)\big)}{P+1}$$.
I wish to find an expression for the definite integral $\int_0^{2\pi}\cos^P(x)\text{ d}x$ for ($P=\text{positive even integer}$) and ($x=$ real, between $0$ and $2\pi$).
I know that, for any even positive integer $P$, the definite integral takes the form:- $$\int_0^{2\pi}\cos^P(x)\text{ d}x=Q(P)\pi$$ where $Q(P)$ is some fraction $<1$.
But clearly, if I insert $x=2\pi$ or $x=0$ into the indefinite integral expression then the term $\sqrt{\sin(x)}$ becomes zero.
Maybe I have to assume that $\sqrt{sin^2(x)}\csc(x)=1$ when $x=0\text{ or }2\pi$, even though Wolfram Alpha deems the result as undefined?
Wolfram Alpha (for me) does not even recognize the question when I ask for the definite integral: $\int^{2\pi}_0\cos^P(x)\text{ d}x$