We know that $(x_1,y_1)$ must lie on the ellipse, so, we have:
$$\frac{x_1^2}{a^2}+\frac{y_1^2}{b^2}=1 \leftrightarrow y_1^2=b^2\left(1-\frac{x_1^2}{a^2}\right)$$
Substituing, we obtain:
$$Cg^2=\frac{b^2\left(1-\frac{x_1^2}{a^2}\right)(a^2-b^2)^2}{b^4}$$
While $CG^2$ is:
$$CG^2=\frac{x_1^2(a^2-b^2)^2}{a^4}\leftrightarrow x_1^2=\frac{CG^2\cdot a^4}{(a^2-b^2)^2} $$
Substituing again, you arrive at:
$$Cg^2=\frac{b^2\left(1-\frac{CG^2\cdot a^4}{a^2(a^2-b^2)^2}\right)(a^2-b^2)^2}{b^4} \rightarrow Cg^2=\frac{(a^2-b^2)^2-CG^2\cdot a^2}{b^2}$$
From here, it's very simple. In fact:
$$Cg=\sqrt{Cg^2}=\sqrt{\frac{(a^2-b^2)^2-CG^2\cdot a^2}{b^2}}=\frac{\sqrt{(a^2-b^2)^2-CG^2\cdot a^2}}{b}$$
Note that, as @Blue suggested, you can rewrite the relation for $Cg^2$ as:
$$\frac{Cg^2}{a^2} + \frac{CG^2}{b^2} =\frac{ (a^2-b^2)^2}{a^2b^2}$$
This follows from here:
$$Cg^2=\frac{(a^2-b^2)^2-CG^2\cdot a^2}{b^2} \leftrightarrow Cg^2b^2-CGa^2=(a^2-b^2)^2 \leftrightarrow \frac{Cg^2}{a^2} + \frac{CG^2}{b^2} =\frac{ (a^2-b^2)^2}{a^2b^2}$$