# Why isn't the arc length of $\cos x$ equal to $\pm \sin x$?

The arc length of some function $f(x)$ is given by $$L=\int{\sqrt{1+f'\left(x\right)^2}}dx$$ Plugging $\cos x$ in for $f$ and using basic algebra, this simplifies as follows $$L=\int{\sqrt{1+\cos'\left(x\right)^2}}dx$$ $$L=\int{\sqrt{1-\sin\left(x\right)^2}}dx$$ $$L=\int{\sqrt{\cos\left(x\right)^2}}dx$$ $$L=\int{\pm\cos\left(x\right)}dx$$ $$L=\pm\sin x$$ Obviously this is wrong. The real answer involves elliptic integrals, but my question is, why does this approach give such an incorrect result? What am I overlooking?

$$(-\sin x)^2 \ne -(\sin x)^2$$
• For OP: Also note that $-\sin(x)^2$ is interpreted as $-(\sin(x)^2)$ because of order of operations. – M. Winter Sep 10 '17 at 7:59