# When integrating indefinite integrals, when is it assumed that a trig function is positive?

In some of my calculus classes, we are generally allowed to do something like

$$\int{\sqrt{\cos^2x}}\ dx = \int{\cos x}\ dx$$

with the justification that the trig function (in this particular case, cosine) is positive over "the interval", so the absolute value that should be around the trig function when the square root is gotten rid of is not necessary.

What logic is this assumption based on and why is it generally considered to be okay in certain practices of calculus? Otherwise, besides the obvious case of definite integrals where the interval is one in which the trig function is fully positive, when are we allowed to make these kinds of assumptions, in integration?

This question strays slightly into subjectivity, so if there is any objective clarification I can provide, please let me know.

I don't think it's ever okay to do that unless there's a given interval that $\cos x$ is always non-negative on.

The absolute value is definitely necessary.

E.g. $$\int_0^{2\pi} \sqrt{\cos^2 x} dx = 4 > 0$$ but $$\int_0^{2\pi} \cos x dx =0.$$

• Okay so for integrals like $\int \sqrt{a^2- x^2} dx$, we make the substitution $x=a \sin t$. In this case, do we integrate $a|\cos t|\cos t$ or $a\cos^2 t$? – Sharv Laad Feb 12 '18 at 9:08

It depends on the bounds of your equation, however if we want to be precise, you can do it but you have to include your absolute value signs $$\int\sqrt{\cos^2x}dx = \int|\cos{x}|dx$$

Otherwise you cannot make the simplification for any arbitrary bounds

Let us first recall what the Fundamental Theorem of Calculus tells us. It says that if $f: [a,b] \to \mathbb{R}$ (here $a < b$) is a continuous function then the function $F:[a,b] \to \mathbb{R}$ defined by $$F(x) = \int_a^x f(t) \, dt,$$ is continuous on the closed interval $[a,b]$, differentiable on the open interval $(a,b)$, and has a derivative given by $F'(x) = f(x)$.

In the case of $$\int \sqrt{\cos^2 x} \, dx = \int |\cos x| \, dx,$$ as $f(x) = |\cos x|$ is clearly continuous for all $x \in \mathbb{R}$, $f$ in integrable (in the Riemann sense) and thus has a primitive which is continuous on $x \in [a,b]$ and differentiable on $x \in (a,b)$.

If the interval of integration you are interested in is $x \in [-\pi/2,\pi/2]$, then clearly $$\int |\cos x| \, dx = \sin x + C, \quad x \in [-\pi/2,\pi/2].$$

If you are however interested in some more general interval $x \in [a,b]$ then more care is needed. In such a case a primitive that satisfies the conditions imposed by the Fundamental Theorem of Calculus (namely continuity on the closed interval and differentiability on the open interval) is $$\int |\cos x| \, dx = F(x) + C,$$ where $$F(x) = \begin{cases} |\cos x| \cdot \tan x + 2 \left \lfloor \dfrac{2x + \pi}{2\pi} \right \rfloor, & \text{if} \,\,x \neq (2k + 1) \dfrac{\pi}{2}, k \in \mathbb{Z}\\[2ex] 2k + 1, & x = (2k + 1) \dfrac{\pi}{2}, \text{if} \,\,k \in \mathbb{Z}\\ \end{cases}$$ Here $\lfloor \cdot \rfloor$ denotes the floor function.