I was asked to find the length $L$ of the curve $r=a\cos(\theta)$,then I what I did is as follows:
$$L=\int_{0}^{2\pi}\sqrt{a^{2}\cos^{2}\left(\theta\right)+a^{2}\sin^{2}\left(\theta\right)}d\theta=a\int_{0}^{2\pi}d\theta=2a\pi.$$
It is assumed that $a$ is positive.
However the real answer is $a\pi$,I don't understand how do we determine the upper and lower limits of such integrals,does there exist anyway to do that without plotting the graph of the function (which is a circle)?
Updated
I don't know how to prove the formula which we use to compute the length of a curve,but all I know is based on Thomas Calculus (12th).


Since $r\ge0$, $\theta\in[-\pi/2,\,\pi/2]$ is an appropriate integration range, whereas $\theta\in[0,\,2\pi]$ is not. So$$r=a\cos\theta\implies r^2+(dr/d\theta)^2=a^2\implies L=\int_{-\pi/2}^{\pi/2}ad\theta=a\pi.$$In fact, $x^2+y^2=r^2=ar\cos\theta=ax\iff (x-a/2)^2+y^2=(a/2)^2$ is a radius-$a/2$ circle, of circumference $a\pi$.