Given the values of $R$, $H$, and $X$(second picture). Is there a formula for finding the center of gravity of this three dimensional shape?
Here is a diagram of its cross section (the actual cross section is the dark blue. the rest is just there to clarify). Notice the sphere making the indent (light blue) has the same radius as the original sphere (dark blue).


The center of gravity of two bodies is the weighted mean of the centers of each. Of course the weights is the weight (mass) of each body. Moreover the center is on the symmetry axis (axes). In your case, since the density of the body is supposed constant, we can use volume as weight.
Since the volume of the double Spherical Cap is $$ V = 2\,\pi \frac{{H^{\,2} }}{3}\left( {3R - H} \right)$$
then, measuring the CG position along the symmetry axis, with the $0$ placed at the center of the sphere, and oriented towards the cavity, we will have $$ 0 = \text{Cg}_{\,\text{whole}\,\text{sphere}} = \frac{{V_{\,\text{hollow}\,\text{sphere}} \text{Cg}_{\,\text{hollow}\,\text{sphere}} + V_{\,\text{double}\,\text{cap}} \text{Cg}_{\,\text{double}\,\text{cap}} }} {{V_{\,\text{whole}\,\text{sphere}} }} $$ i.e. \begin{gathered} \text{Cg}_{\,\text{hollow}\,\text{sphere}} = - \frac{{V_{\,\text{double}\,\text{cap}} }} {{\left( {V_{\,\text{whole}\,\text{sphere}} - V_{\,\text{double}\,\text{cap}} } \right)}}\text{Cg}_{\,\text{double}\,\text{cap}} = \hfill \\ = - \frac{{2\,\pi \frac{{H^{\,2} }} {3}\left( {3R - H} \right)}} {{\left( {4\,\pi \frac{{R^{\,3} }} {3} - 2\,\pi \frac{{H^{\,2} }} {3}\left( {3R - H} \right)} \right)}}\left( {R - H} \right) = \hfill \\ = - \frac{{\,\left( {R - H} \right)}} {{\left( {2\,\frac{{R^{\,3} }} {{H^{\,2} \left( {3R - H} \right)}} - \,1} \right)}} \hfill \\ \end{gathered}