How to check if a sphere is fully inside another sphere

If I'm given the equation of any two spheres's how do I check if one is completely inside the other. Is there a formula, code or algorithm

What I don't want:

enter image description here

What I want:

enter image description here


Solution 1:

Find out the center and the radius of each sphere. Let $C, R$ be the center and radius of the sphere with biggest radius, and $c, r$ be the center and radius of the smaller one. You must have $dist(C,c)\leq R-r$, where $dist(C,c)$ is the distance between $c$ and $C$. If you want to visualize why, draw the limiting case when the smallest sphere is tangential to the biggest sphere from within. That is when $dist(C,c)=R-r$.