Mathematics max and min $x$ and $y$ values of an ellipse I am trying to find the max and min x and y values of an ellipse. The ellipse is given by $$x^2-xy+y^2=3$$
So I need to find the max points, so I need the derivative of the function.
I got $$\dfrac{dy}{dx} = \dfrac{(y-2x)}{(2y-x)}$$
So I then thought that I should get the x value and the y value so I got $x=-(y/2)$ and $y=-2x$
But now I'm not sure what to do?

(originally posted on gamedev)
The general equation of an ellipse centered at the origin is:
$$(ax+by)^2+(cx+dy)^2=r^2$$
Expand w.r.t $x$ and $y$:
$$(a^2+c^2)x^2+(b^2+d^2)y^2+2(ab+cd)xy=r^2$$
An horizontal line has equation $y=k$. Either it intersects with the ellipse in two points, or it intersects in only one point (it's tangent), or it doesn't intersect at all. We find the intersection by solving the trinomial (in x):
$$(a^2+c^2)x^2+2(ab+cd)kx+(b^2+d^2)k^2-r^2=0$$
There is only one intersection when the discriminant is zero, hence you want to find $k$ such that
$$4(ab+cd)^2k^2-4(a^2+c^2)(b^2+d^2)k^2+4(a^2+c^2)r^2=0$$
Expand and simplify:
$$\left(a^2b^2+c^2d^2+2abcd-a^2b^2-a^2d^2-b^2c^2-c^2d^2\right)k^2+(a^2+c^2)r^2=0$$
$$(2abcd-a^2d^2-b^2c^2)k^2+(a^2+c^2)r^2=0$$
$$(ad-bc)^2k^2=(a^2+c^2)r^2$$
$$k=\pm\frac{r\sqrt{a^2+c^2}}{|ad-bc|}$$
The positive $k$ is the maximum value of $y$, the negative the minimum value. By symmetry of the ellipse, they are opposite.

The extreme values of $x$ can be found the same way, using a vertical line $x=l$. The same computation will lead to
$$l=\pm\frac{r\sqrt{b^2+d^2}}{|ad-bc|}$$
The positive $l$ is the maximum value of $x$, the negative the minimum value. Again, by symmetry of the ellipse, they are opposite.

The expressions found are not defined when $ad=bc$, but then the two squares in the original equation are proportional and the conic is degenerate (the equation leads to two parallel lines).
