I am being told to integrate the function $$f(x,y) = x + y$$ over the right loop of the lemniscate $$r^2 = a^2cos(2\theta)$$
Now, we take $x = rcos(\theta)$ and $y = rsin(\theta)$, and as a result $dS = r d\theta$. Then, substituting we have that the answer is $$\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} (r\cos\theta + r\sin\theta) rd\theta = \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} r^2(\cos\theta + \sin\theta) d\theta$$ Then by substituting $r^2 = a^2\cos(2\theta)$, $$\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} (r\cos\theta + r\sin\theta) rd\theta = \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} a^2\cos(2\theta)(\cos\theta + \sin\theta) d\theta$$ After doing a few calculations, $$\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} (r\cos\theta + r\sin\theta) rd\theta = \frac{a^2\sqrt2}{3}$$.
However, the answer according to the book is $a^2\sqrt2$. Any suggestions?
We need $$I=\int_L x+y\,dS$$ where $$dS=\sqrt{\Bigl(\frac{dx}{d\theta}\!\Bigl)^2+\Bigl(\frac{dy}{d\theta}\!\Bigl)^2}\, d\theta\ .$$ We'll try to minimise the pain in the algebra by differentiating implicitly. Also I will minimise it for myself by asking you to do most of the work ;-)
We have $$r^2=a^2\cos2\theta\quad\Rightarrow\quad r\frac{dr}{d\theta}=-a^2\sin2\theta$$ and so $$\frac{dx}{d\theta}=\frac{dr}{d\theta}\cos\theta-r\sin\theta =-\frac{a^2}{r}(\sin2\theta\cos\theta+\cos2\theta\sin\theta) =-\frac{a^2}{r}\sin3\theta\ .$$ A bit more of this ultimately gives $$dS=\frac{a^2\,d\theta}{r}\ ,$$ and now $$\int_{\theta=-\pi/4}^{\theta=\pi/4} (r\cos\theta+r\sin\theta)\,dS$$ is easy.