I figured the volume of a torus is
$4\pi R \int_{-r}^{r}\sqrt{r^2-y^2}dy$
But I don't know how to solve an integral like this. How is it done?
I figured the volume of a torus is
$4\pi R \int_{-r}^{r}\sqrt{r^2-y^2}dy$
But I don't know how to solve an integral like this. How is it done?
The standard thing to do it to let $y=r\sin t$. Quickly we arrive at $\int_{-\pi/2}^{\pi/2}r^2\cos^2 t\,dt$. Now one is taught to use the fact that $\cos 2t=2\cos^2 t-1$.
But in a sense you do not need to do any work to find the integral. For $\int_{-r}^r \sqrt{r^2-x^2}\,dx$ is the area below the curve $y=\sqrt{r^2-x^2}$, above the $x$-axis, from $x=-r$ to $x=r$. So the integral is the area of a half-circle of radius $r$. This area is $\pi r^2/2$. Changing the name of the variable of integration to $y$ does not change the definite integral, so $\int_{-r}^r\sqrt{r^2-y^2}dy=\frac{\pi r^2}{2}.$
Comment: Your torus can be thought of as obtained by rotating the circle with centre $(0,R)$ and radius $r$ about the $x$-axis. There is an ancient theorem of Pappus that says that if you rotate a region $K$ about an external axis, then the volume of the solid of revolution so obtained is equal to the area of $K$ times the distance that the centroid of $K$ travels. In our case, the area of $K$ is $\pi r^2$, and the centroid of $K$ is at $(0,R)$, so the centroid travels a distance $2\pi R$. It follows that the volume of the torus is $(\pi r^2)(2\pi R)$.
Use the trig substitution: $y=r\sin(t)$
Then $dy = r\cos(t)\,dt$ and then limits change to $\pm 1 =\sin(t)$ so that $t=\pm \pi/2$. Thus
$ 4\pi R\int_{-r}^r \sqrt{r^2-y^2}\,dy = 4\pi R \int_{-\pi/2}^{\pi/2} \sqrt{r^2-r^2\sin^2(t)}\cdot r\cos(t)\,dt $ $= 4\pi R \int_{-\pi/2}^{\pi/2} \sqrt{r^2\cos^2(t)}\cdot r\cos(t)\,dt = 4\pi R \int_{-\pi/2}^{\pi/2} r^2\cos^2(t)\,dt$ $= 4\pi R \int_{-\pi/2}^{\pi/2} \frac{r^2}{2}(1+\cos(2t))\,dt = 4\pi R \frac{r^2}{2}\pi$
Alternatively, you could just note that the integral is computing the area of the upper-half of a circle of radius $r$ (thus $0.5\pi r^2$).