You're given a big ellipse whose axes are parallel to the coordinate axes, with horizontal semi-major axis $a$ and vertical semi-minor axis $b$. And you're also given an ellipse with semi-major axis $c$ and semi-minor axis $d$, where the major axis makes an angle $\theta$ with the positive $x$ axis.
Question: Find the center of the smaller ellipse (of semi-axes $c$ and $d$), such that it is inscribed in the bigger ellipse.
My attempt:
The equation of the big ellipse is
$ r^T Q_1 r = 1 $
where $r = [x, y]^T $ and $ Q_1 = \begin{bmatrix} \dfrac{1}{a^2} && 0 \\ 0 && \dfrac{1}{b^2} \end{bmatrix} $
And the equation of the smaller ellipse is
$ (r - C)^T Q_2 (r - C) = 1 $
where $C$ is the center to be determined, and
$ Q_2 = \begin{bmatrix} \dfrac{1}{a^2} \cos^2 \theta + \dfrac{1}{b^2} \sin^2 \theta && \sin \theta \cos \theta \left( \dfrac{1}{a^2} - \dfrac{1}{b^2} \right) \\ \sin \theta \cos \theta \left( \dfrac{1}{a^2} - \dfrac{1}{b^2} \right) && \dfrac{1}{a^2} \sin^2 \theta + \dfrac{1}{b^2} \cos^2 \theta \end{bmatrix} $
Note that $Q_1$ and $Q_2$ are known.
Let $r_1$ be the first tangency point, then
$ r_1 Q_1 r_1 = 1 $
$ (r_1 - C)^T Q_2 (r_1 - C) = 1 $
$ Q_1 r_1 = K_1 \ Q_2 (r_1 - C) $
And let $r_2$ be the second tangency point, then
$ r_2 Q_1 r_2 = 1 $
$ (r_2 - C)^T Q_2 (r_2 - C) = 1 $
$ Q_1 r_2 = K_2 \ Q_2 (r_2 - C) $
These are all the equations, and they are $8$ equations in $8$ unknowns.
These equations can be solved numerically.
And there will be two possible solutions.
Edit:
The above equations will result in infinite solutions, this can be seen by letting $r_2 = r_1$, and eliminating $K_1$, then the unknowns are $r_1$ and $C$ and there are only three equations.
As a way out of this, take $r_1$ on the first ellipse, and compute $C$ from
$ (r_1 - C)^T Q_2 (r_1 - C) = 1 $
$ Q_1 r_1 = K_1 \ Q_2 (r_1 - C) $
Having obtained $C$, now use
$ (r_2 - C)^T Q_2 (r_2 - C) = 1 $
$ Q_1 r_2 = K_2 \ Q_2 (r_2 - C) $
to obtain $r_2$, and then use
$ r_2 Q_1 r_2 = 1 $
as a measure of error in $r_2$.