# New foci in ellipse after transformation of variables

An ellipse defined on the 2D plane is given by the equation:

$$\sqrt{(x-a_1)^2 + (y-b_1)^2} + \sqrt{(x-a_2)^2 + (y-b_2)^2} = c,$$

where $(a_1, b_1), (a_2,b_2)$ are the foci and $c$ is some real number greater or equal than the distance between the foci. The ellipse is the set of points $(x,y)$ that satisfy the equation. Suppose that I have built the foci and $c$ so that the ellipse is bound by the square $-1\le x,y \le 1$. Now, suppose that I want the ellipse to fit into a rectangle enclosed by $y_{min}, y_{max}, x_{min}, x_{max}$. To do this I can map the points $(x,y)$ to new coordinates: $$y' = \frac{(1-y)y_{min} + (1+y)y_{max}}{2}.$$

Note that if $y$ takes the minimum initial value, i.e. -1, then $y'=y_{min}$, as desired. Similarly when $y$ takes the maximum value, i.e. 1. The same happens with $x$: $$x' = \frac{(1-x)x_{min} + (1+x)x_{max}}{2}.$$

My problem is that the components of foci $(a_1, b_1), (a_2,b_2)$ DO NOT transform under the same transformation (i.e. $a_1'\neq \frac{1}{2}[(1-a_1)x_{min} + (1+a_1)x_{max}]$). How do I get the new foci?

I tried pluging $y',x'$ into the ellipse equation, but failed.

• The semifocal distance always is $c=\sqrt{a^2-b^2}$ and the axis (old and new) are known. – Jack D'Aurizio Feb 16 '17 at 22:26
• @JackD'Aurizio I think that this solves the problem. I will do the calculations tomorrow, though. – Vladimir Vargas Feb 16 '17 at 22:45

It should come as no surprise that the foci don’t transform the same way because, unless the new rectangle is also a square, you’re changing the ellipse’s eccentricity. As Jack D’Aurizio has pointed out in his comment to your question, the focal distance $c$ is related to the half-axis lengths via $b^2=a^2-c^2$, so in general, if you scale the axes differently, the foci are going to shift in a nonlinear fashion. As a simple example, start with a circle, which you can view as an ellipse with coincident foci ($c=0$). If you scale the $x$- and $y$- axes differently, you end up with a proper ellipse ($c>0$). The two foci obviously didn’t transform the same way as the circle itself.
A straightforward, albeit tedious way to find the foci (and other parameters) of the transformed ellipse is to work with a matrix form equation: $(\mathbf x-\mathbf p)^TQ(\mathbf x-\mathbf p)=1$, where $\mathbf p$ is the center of the ellipse and $Q$ is a matrix of the form $\pmatrix{A&B/2\\B/2&C}$ with positive determinant. The eigenvectors of this matrix give the directions of the ellipse’s axes and the reciprocals of the square roots of its eigenvalues are the semi-axis lengths. Translating the ellipse amounts to replacing $\mathbf p$ by some other point $\mathbf p'$ and obviously doesn’t affect the shape of the ellipse. To obtain the equation of the ellipse scaled by $s_x$ and $s_y$ in the $x$ and $y$ directions, respectively, multiply $Q$ on both sides by the inverse of the scaling matrix $\operatorname{diag}(s_x,s_y)$, which gives $$Q'=\pmatrix{\frac A{s_x^2} & \frac B{2s_xs_y} \\ \frac B{2s_xs_y} & \frac C{s_y^2}}.$$ In your case, $s_x=(x_\text{max}-x_\text{min})/2$ and $s_y=(y_\text{max}-y_\text{min})/2$. Compute the eigenvalues and eigenvectors of this transformed matrix to get the semi-axes of the transformed ellipse, from which you can then find the new foci.
• @VladimirVargas You’ll probably have to work with a different form of the equation. You can get the semi-axis lengths from the distance between the foci and $c$. With those in hand, you can construct a general-form equation, transform that, and then extract whatever information you need about the transformed ellipse from the result. If you use the matrix form of the general equation, these calculations will be a bit easier. – amd Feb 17 '17 at 0:58