# How do you find the exact length of the polar curve r=1+sin(theta) ?

This is the equation of a cardioid. The polar equation is expressed in terms of a periodic function, so we have to know its period to get the exact length (and not just a portion or some excess of it).
$1 + \sin \theta$ has period $T = 2 \pi$ (the function can be obtained as a vertical translation of the sine function in the plane of coordinates $\left(\theta , r\right)$).

The length of a periodic polar curve can be computed by integrating the arc length on a complete period of the function, i.e. on an interval $I$ of length $T = 2 \pi$:
$l = {\int}_{I} \mathrm{ds}$ where $\mathrm{ds} = \sqrt{{r}^{2} + {\left(\frac{\mathrm{dr}}{d \theta}\right)}^{2}} d \theta$
So we have to compute the derivative:
$\frac{\mathrm{dr}}{d \theta} = \frac{d}{d \theta} \left(1 + \sin \theta\right) = \cos \theta$
and this implies
$\mathrm{ds} = \sqrt{{\left(1 + \sin \theta\right)}^{2} + {\left(\cos \theta\right)}^{2}} d \theta = \sqrt{1 + 2 \sin \theta + {\sin}^{2} \theta + {\cos}^{2} \theta} d \theta$
By the Pythagorean trigonometric identity ${\cos}^{2} \theta + {\sin}^{2} \theta = 1$:
$\mathrm{ds} = \sqrt{2 + 2 \sin \theta} d \theta = \sqrt{2 \left(1 + \sin \theta\right)} d \theta$

Integrating that square root is not easy... we'd better take advantage of trigonometric identities. We have $\sqrt{1 + \sin \theta}$ (multiplied by a numerical coefficient) and we would like to get rid of that square root. The half angle formula for cosine states that ${\cos}^{2} \left(\frac{\alpha}{2}\right) = \frac{1 + \cos \alpha}{2}$. We can use this with sine too, because if $\alpha = \theta - \frac{\pi}{2}$ then $\cos \alpha = \cos \left(\theta - \frac{\pi}{2}\right) = \sin \theta$. So we substitute in the formula and get
${\cos}^{2} \left(\frac{\theta - \frac{\pi}{2}}{2}\right) = \frac{1 + \cos \left(\theta - \frac{\pi}{2}\right)}{2}$
and then
$2 {\cos}^{2} \left(\frac{\theta}{2} - \frac{\pi}{4}\right) = 1 + \sin \theta$

By substitution in the last $\mathrm{ds}$ expression that we wrote
$\mathrm{ds} = \sqrt{4 {\cos}^{2} \left(\frac{\theta}{2} - \frac{\pi}{4}\right)} d \theta = 2 | \cos \left(\frac{\theta}{2} - \frac{\pi}{4}\right) | d \theta$
Now we can integrate this on an interval of length $2 \pi$. To do that, we would like to get rid of the absolute value. The graph of the integrand function is the following
graph{2*abs(cos(x/2-pi/4)) [-10, 10, -5, 5]}
We know that
$\cos \left(\frac{x}{2} - \frac{\pi}{4}\right) \ge 0 \iff - \frac{\pi}{2} + 2 k \pi \le \frac{x}{2} - \frac{\pi}{4} \le \frac{\pi}{2} + 2 k \pi$
for $k$ any integer value, so we get that $- \frac{\pi}{2} \pi + 4 k \pi \le x \le \frac{3}{2} \pi + 4 k \pi$, and in particular $- \frac{\pi}{2} \pi \le x \le \frac{3}{2} \pi$.

In the end, we can integrate the arc length on $I = \left[- \frac{\pi}{2} , \frac{3}{2} \pi\right]$, since this is an interval of length $2 \pi$. We can remove the absolute value, since $\cos \left(\frac{x}{2} - \frac{\pi}{4}\right) \ge 0$ on $I$.
${\int}_{- \frac{\pi}{2}}^{\frac{3}{2} \pi} 2 \cos \left(\frac{\theta}{2} - \frac{\pi}{4}\right) d \theta = 4 {\int}_{- \frac{\pi}{2}}^{\frac{3}{2} \pi} \frac{1}{2} \cos \left(\frac{\theta}{2} - \frac{\pi}{4}\right) d \theta = 4 \sin \left(\frac{\theta}{2} - \frac{\pi}{4}\right) {|}_{- \frac{\pi}{2}}^{\frac{3}{2} \pi} = 4 \sin \left(\frac{\pi}{2}\right) - 4 \sin \left(- \frac{\pi}{2}\right) = 4 + 4 = 8$