Whats wrong with my solution in this calc problem? The question asks me to

Find the volume common to two spheres, each with radius $r$, if the center of each sphere lies on the surface of the other sphere.

I've seen the same question asked in other places and answers range from $\frac{27\pi}{32}r^3$ to $\frac{11\pi}{12}r^3$ but my textbook says it's $\frac{5\pi}{12}r^3$. I first drew a diagram like below which provides a view from the side:

Since the center of each sphere lies on the other one's surface, it follows that the width of the middle region will be a length of $r$ in the middle. If we place the left circle at the origin then the points of intersection will be at $(\frac{r}{2}, \pm\frac{\sqrt{3}}{2}r)$, which you can see for yourself here. I then split the middle region in half and only focused on the top side.

My goal at this point was to find a function $f$ that returns the radius of the region as a function of height. For example $f(0)=\frac{r}{2}$ and $f(\frac{\sqrt{3}}{2}r)=0$. And it turns out that $f(x)=\sqrt{r^2-x^2}-\frac{r}{2}$, which you can see here (move the $a$ slider). Therefore function for the area of a cross-section vertical to the $x$-axis will be $A(x)= \pi f(x)^2$. Now we can set up an integral and double it to account for the other half. All the integral does is sum up all the cross-sections which are circles.
$$
2\int_0^{\frac{\sqrt{3}}{2}r} A(x) dx = 2\int_0^{\frac{\sqrt{3}}{2}r} \pi f(x)^2$ dx
$$
By evaluating the integral we get
$$
V= -\frac{1}{12}\pi r^{3}\left(4\pi-9\sqrt{3}\right)
$$
But I mentioned in the beginning that the correct answer is $\frac{5\pi}{12}r^3$, and I'm now wondering what I did wrong. Can anybody help me find my mistake?
 A: In your side-view diagram you have a lens-shape that represents the overlap between two circles. The full width of the lens at height $x$ above the horizontal midline is $g(x):=2\sqrt{r^2-x^2}-r$ (double the value you've computed for $f(x)$). The shape you're trying to get the volume of is obtained by rotating the lens about the horizontal midline. (Why rotate about the horizontal midline? Because that is how you'd produce two spheres out of the two circles; if you rotated about a vertical axis the circles would turn into donuts, not spheres.)
When you rotate the lens, each horizontal segment of width $g(x)$ becomes a hollow cylinder lying on its side. The cylinder has base radius $x$ and height $g(x)$, so its surface area is $2\pi x\,g(x)$. Multiply this surface area by the infinitesimal thickness $dx$ to get the infinitesimal volume.  When $x$ runs from $0$ to $\frac{\sqrt 3}2r$ you use up all the horizontal segments.  So the overall volume of the shape is the integral
$$
\int_{x=0}^{\frac{\sqrt 3}2r} 2\pi x \,g(x)\,dx.
$$
When I work out this integral I get $\frac{5\pi}{12}r^3$.
