There is again something that I just can't figure out.
I'm trying to integrate a volume for two cylinders one of which is inside the other, but not with same center point.
The $r=cos(\theta)$ has central point in $(x,y)=(\frac{1}{2},0)$ and radius for it is $r=\frac{1}{2}$. The volume I'm after is bounded by following: $$r = cos(\theta)$$ $$r = 2 cos(\theta)$$ $$z=x+2$$ $$z=0$$
Which means that there is one larger sliced cylinder with a centerpoint at $(x,y)=(1,0)$ with $r=1$ and smaller at $(x,y)=(\frac{1}{2},0)$ with $r=\frac{1}{2}$.
Therefore (just to make it easier to understand/graph to me) in Cartesian coordinates the bottom circles are: $$A: (x-(\frac{1}{2})^2)+y^2=(\frac{1}{2})^2$$ $$B: (x-1^2)+y^2=1^2$$
And the height is limited by (surfaces): $$0\leq z \leq x+2$$
Now I see that the smaller sliced cylinder is within the other and therefore I proceed to calculate first the volume for the larger one, and then just substract the smaller volume from it.
$$V_A=\int_{0}^{2\pi} \int_{0}^{1} \int_{0}^{r*cos(\theta)+2} r \,dz\,dr\,d\theta = 2\pi$$ $$V_B=\int_{0}^{2\pi} \int_{0}^{\frac{1}{2}} \int_{0}^{r*cos(\theta)+2} r \,dz\,dr\,d\theta = \frac{\pi}{2}$$ $$V_A-V_B = \frac{3\pi}{2}=\frac{12\pi}{8}$$
So far everything is quite straightforward, but then I try to check my calculation against the sliced cylinder volume equation $V=\pi r^2h=\pi r^2\frac{h_1+h_2}{2}$
Now the h for the larger one is $\frac{2+4}{2}=3$ and for smaller one $\frac{2+3}{2}=\frac{5}{2}$, which makes the volumes to be: $$V_A= \pi r^2\frac{h_1+h_2}{2}=\pi 1^2\frac{2+4}{2} = 3\pi$$ $$V_B= \pi r^2\frac{h_1+h_2}{2}=\pi (\frac{1}{2})^2\frac{2+3}{2} = \frac{5\pi}{8}$$ $$V_A-V_B = \frac{24\pi}{8}-\frac{5\pi}{8}=\frac{19\pi}{8}$$
And as you can see, the volumes I get, do not match. I've been now going through the reasoning and all the calculations for a few hours and I just can't find any mistakes. Could someone help me a bit.
I see several troubles in your solution.
With this in mind, we get $$ V_A=\int_{-\pi/2}^{\pi/2}\int_0^{2\cos\theta}\int_0^{r\cos\theta+2}r\,dzdrd\theta=[...]=3\pi. $$ Similarly for the smaller cylinder.
P.S. After you have understood the cartesian coordinates for the cylinders, it seems easier to calculate the volumes in $x,y,z$ as $$ V_A=\iint_A\int_0^{x+2}1\,dz\,dxdy $$ introducing the shifted polar coordinates for $A$ \begin{align} x&=1+r\cos\phi,\qquad && 0\le r\le 1,\\ y&=r\sin\phi, && 0\le\phi\le 2\pi. \end{align}