<s>[INST] Triple integration with $x^2+y^2-z^2$ I'm having this problem.
$$\iiint_{K}(x^2+y^2-z^2)dxdydz,\quad K: x^2+y^2+z^2\leq 1$$
My solution.
$$x=\rho \sin\phi \cos\Theta,\ y=\rho \sin\phi \sin\Theta, z=\rho \cos \phi\\
dxdydz=\rho^2 \sin\phi d\rho d\phi d\theta\\
0\leq \rho \leq 1\\
0 \leq \phi \leq \pi\\
0 \leq \theta \leq 2\pi\\
$$
$$\int _0^{2\pi }\int _0^{\pi }\int _0^1\left(\left(\rho \sin\left(\phi\right)\cos\left(\theta\right)\right)^2+\left(\rho \sin\left(\phi\right)\sin\left(\theta\right)\right)^2+\left(\rho \cos\left(\phi\right)\right)^2\right)d\rho d\phi d\theta$$
$$\int _0^1\left(\rho\sin \left(\phi\right)\cos \left(\theta\right)\right)^2+\left(\rho\sin \left(\phi\right)\sin \left(\theta\right)\right)^2-\left(\rho \cos \left(\phi\right)\right)^2d\rho\\ =-\cos ^2\left(\phi\right)\frac{1}{3}+\cos ^2\left(\theta\right)\sin ^2\left(\phi\right)\frac{1}{3}+\sin ^2\left(\phi\right)\sin ^2\left(\theta\right)\frac{1}{3}\\
\int _0^{\pi }\left(-\cos ^2\left(\phi\right)\frac{1}{3}+\cos ^2\left(\theta\right)\sin ^2\left(\phi\right)\frac{1}{3}+\sin ^2\left(\phi\right)\sin ^2\left(\theta\right)\frac{1}{3}\right)d\phi\\
=-\frac{\pi }{6}+\frac{\pi }{6}\cos ^2\left(\theta\right)+\frac{\pi }{6}\sin ^2\left(\theta\right)=\frac{\pi }{6}\left(\cos ^2\left(\theta\right)+\sin ^2\left(\theta\right)-1\right)=\frac{\pi }{6}\left(-1+1\right)=0\\
\int _0^{2\pi }0d\theta=0
$$
It's the minus sign in $-z^2$ that creates multiplication with $0$, and therefore the answer is $0$. Is this correct?
When I plot this in Geogebra I get a sphere inside a hyperboloid.
Thanks for all the help!
 [/INST] $\int \int \int _{K}(x^2+y^2-z^2)dxdydz $
$= \displaystyle \int _0^{2\pi }\int _0^{\pi} \int_0^1 ((\rho \sin \phi cos \theta)^2 + (\rho \sin \phi \sin\theta)^2 - (\rho \cos \phi)^2) \, \rho^2 \, sin\phi \, d\rho \, d\phi \, d\theta$
$= \displaystyle \int _0^{2\pi} \int_0^{\pi} \int_0^1 (\rho^2  \sin^2 \phi - \rho^2  \cos^2 \phi) \, \rho^2 \, sin\phi \, d\rho \, d\phi \, d\theta$
$= \displaystyle -\int _0^{2\pi} \int_0^{\pi} \int_0^1 \rho^4  \cos 2\phi \, sin\phi \, d\rho \, d\phi \, d\theta$
$= \displaystyle - \frac{1}{5}\int _0^{2\pi} \int_0^{\pi}  \cos 2\phi \, sin\phi \, d\phi \, d\theta$
Substituting $t = \cos \phi$ for integral, can you do rest of the steps?
It comes to $\frac{4 \pi}{15}$. Checked WolframAlpha.
</s>