What is the equation of an ellipse that is not aligned with the axis?
I have the an ellipse with its semi-minor axis length $x$, and semi major axis $4x$. However, it is oriented $45$ degrees from the axis (but is still centred at the origin). I want to do some work with such a shape, but don't know how to express it algebraically. What is the equation for this ellipse?
Let's suppose it was semi-major axis $4k$ and semi-minor axis $k$ to avoid confusion.
Aligned with the axes it would be
$$\frac{x^2}{(4k)^2}+\frac{y^2}{k^2}=1$$
but you want this rotated, so replace $x$ by $\frac{x+y}{\sqrt 2}$ and $y$ by $\frac{y-x}{\sqrt 2}$ to get
$$\frac{(x+y)^2}{32k^2}+\frac{(y-x)^2}{2k^2}=1$$ which you can also write as
$$17\,{y}^{2}-30\,x\,y+17\,{x}^{2} - 32\,{k}^{2} = 0.$$
Let the center of the ellipse be at $C = (x_c, y_c)$. Let the major axis be the line that passes through $C$ with a slope of $s$; points on that line are given by the zeros of $L(x,y) = y - y_c - s(x - x_c)$. Let the minor axis be the line perpendicular to $L$ (and also passing through $C$); points on that line are given by the zeros of $l(x,y) = s(y-y_c)+(x-x_c)$. The ellipse is then defined by the zeros of
$$E(x,y) = L(x,y)^2/a + l(x,y)^2/b - 1$$
Requiring that the distance between the intersections of $E$ and $L$ be $2M$ identifies $$b=M^2(1+s^2)$$ and similarly, requiring that the intersections between $E$ and $l$ be separated by $2m$ identifies $$a=m^2(1 + s^2)$$ This is demonstrated in the following SymPy session:
>>> from sympy import *
>>> a, b, x, y, m, M, x_c, y_c, s = var('a,b,x,y,m,M,x_c,y_c,s')
>>> L = (y - y_c) - s*(x - x_c)
>>> l = s*(y - y_c) + (x - x_c)
>>> idiff(L, y, x) == -1/idiff(l, y, x) # confirm they are perpendicular
True
>>> E = L**2/a + l**2/b - 1
>>> xy = (x, y)
>>> sol = solve((E, L), *xy)
>>> pts = [Point(x, y).subs(zip(xy, p)) for p in sol]
>>> solve(pts[0].distance(pts[1]) - 2*M, b)
[M**2*(s**2 + 1)]
>>> sol = solve((E, l), *xy)
>>> pts = [Point(x,y).subs(zip(xy, p)) for p in sol]
>>> solve(pts[0].distance(pts[1]) - 2*m, a)
[m**2*(s**2 + 1)]
So the general equation of the ellipse centered at $(x_c, y_c)$ whose major axis (with radius of $M$) is on a line with slope $s$, and whose minor axis has radius of $m$, is given by the solutions of: $$\frac{((y - y_c) - s(x - x_c))^2}{m^2(1 + s^2)} + \frac{(s(y - y_c) + (x - x_c))^2}{M^2(1 + s^2)} = 1$$