I am learning how to approximate the volume of a sphere with integrals. I am confused on how $(1/3)x^3$ became $(1/3)r^3$, and why this being an even function allows you to pull a $2$ out front. Please help, many thanks

I am learning how to approximate the volume of a sphere with integrals. I am confused on how $(1/3)x^3$ became $(1/3)r^3$, and why this being an even function allows you to pull a $2$ out front. Please help, many thanks

The volume is $$\int_{-r}^r \pi(r^2-x^2)dx=[\pi(r^2x-\tfrac{1}{3}x^3)]_{-r}^r=\tfrac{4\pi}{3}r^3.$$Since the integrand is even, we could alternatively write $$\int_{-r}^r \pi(r^2-x^2)dx=\int_0^r 2\pi(r^2-x^2)dx=[2\pi(r^2x-\tfrac{1}{3}x^3)]_0^r=\tfrac{4\pi}{3}r^3.$$