1

How to integrate $$\int \sqrt{\cos^{2}(x)}dx$$

I know that $\sqrt{\cos^{2}(x)}=|\cos(x)|$. Therefore $|\cos(x)|=\cos(x)${when $\cos(x)>0$} , $|\cos(x)|=-\cos(x)${when $\cos(x)<0$} , $|\cos(x)|=0${when $\cos(x)=0$} Now when $|\cos(x)|=\cos(x)$, then the result of the above integral will be $$\int \cos(x)dx=\sin(x)+C$$ When $|\cos(x)|=-\cos(x)$, then the result of the above integral will be $$\int -\cos(x)dx=-\sin(x)+C_1$$ And finally, when $|\cos(x)|=0$, then the result of the above integral will be $0$. Therefore, we can clearly see here that $3$ different results are occuring. So, finally I thought of writing $|\cos(x)|=\cos(x)\text{sgn}(\cos(x))$. Therefore, we can write the above integral as

$$\int \sqrt{\cos^{2}(x)}dx$$ $$=\int |\cos(x)|dx$$ $$=\int \cos(x)\text{sgn}(\cos(x))dx$$ Now, I am facing a problem in integrating $$\int \cos(x)\text{sgn}(\cos(x))dx$$ Please help me out with this integral.

Integreek
  • 8,530

1 Answers1

3

Since

$$\mbox{sgn}\cos x= \frac{\sqrt{\cos^2 x}}{\cos x},$$

You can just write

$$\int \sqrt{\cos^2 x} \; dx = \frac{\sqrt{\cos^2 x}}{\cos x}\sin x +C.$$

B. Goddard
  • 33,728
  • 2
    Why you considered $sgn(\cos(x))$ to be a constant?@B.Goddard –  Nov 21 '23 at 16:44
  • It's not constant and I don't assume it to be a constant. – B. Goddard Nov 21 '23 at 17:25
  • 1
    How you evaluated $\int cos(x)sgn(cos(x))dx$ ?@B. Goddard –  Nov 21 '23 at 17:40
  • @SyamaprasadChakrabarti,Evaluate the integral By taking two cases,After that One of Them will be $\sin x$ for $\cos x>0$,and Other will be $-\sin x$ for $\cos x \leq0$,Which means Integral depends on sign of $\cos x$,hence can be written as $(sgn(\cos x))\sin x$ which then Includes both cases – Dheeraj Gujrathi Nov 22 '23 at 10:06
  • @SyamaprasadChakrabarti $\text{sgn}x$ is constant in each of its subdomains, so it can be pulled out of the integral? – Integreek Oct 22 '24 at 11:50