In general, an ellipse is given by
$$G(x,y)=a x^2 + b y^2 + c x y + d x + e y + f =0.$$
Let us denote the two ellipses with the subscripts 1 and 2. As we would like to minimize the square distance $d^2=(x_1 - x_2)^2 + (y_1 + y_2)^2$ between the two ellipses. We use the method of Lagrange multiplier and write $G = d^2 + \lambda_1 G_1(x_1,y_1) + \lambda_2 G_2(x_2,y_2)$ with the conditions for an extremum
$$
\partial_{x_1} G = 2 (x_1 - x_2) + λ_1(2 a_1 x_1+ c_1 y_1 +d_1) =0,$$
$$\partial_{y_1} G =2 (y_1 - y_2) + λ_2(2 b_1 y_1+ c_1 x_1 +e_1) =0,$$
$$
\partial_{x_2} G = 2 (x_2 - x_1) + λ_1(2 a_2 x_2+ c_2 y_2 +d_2) =0,$$
and
$$\partial_{y_2} G =2 (y_2 - y_1) + λ_2(2 b_2 y_2+ c_2 x_2 +e_2) =0.$$
Together with the conditions $G_1 = G_2 =0$, we have 6 equations for 6 unknowns (though some are not linear but quadratic). We can "easily" solve for $x_1,y_1,x_2,y_2,\lambda_1,\lambda_2$. Plugging the different solutions into the expression for $d^2$, we can select the one that minimizes the distance.