Envelope of family of ellipses tangent to x-axis and y-axis I wanted to find the ellipse of the largest area that can pass through a hallway that makes a 90 degrees turn.The vertex of this hallway is at (c , d). In order to do that, I tried to find the envelope of the equation of family of ellipses by using the only two conditions (that I know of) of the envelope, which are:
$$\frac{\partial F(x,y,\alpha)}{\partial\alpha}=0 $$
$$F(x,y,\alpha)=0$$
The equation of the family of ellipses that is tangent to both axis has the following equation:
$$F(x,y,\alpha)\equiv\frac{\left[\left(x-\sqrt{a^{2}\cos\alpha^{2}+b^{2}\sin\alpha^{2}}\right)\cos\alpha+\left(y-\sqrt{b^{2}\cos\alpha^{2}+a^{2}\sin\alpha^{2}}\right)\sin\alpha\right]^2}{a^2}+ \frac{\left[\left(x-\sqrt{a^{2}\cos\alpha^{2}+b^{2}\sin\alpha^{2}}\right)\sin\alpha-\left(y-\sqrt{b^{2}\cos\alpha^{2}+a^{2}\sin\alpha^{2}}\right)\cos\alpha\right]^2}{b^2}-1=0; a<b $$
where $0<\alpha<\frac{\pi}{2}$ is the parameter, and a and b are minor and major axes respectively.
I tried to solve this system of equation to remove the parameter $\alpha$  but I couldn't (because the parameter $\alpha$ is everywhere). If i try to combine these equations it just results in a really complex equation with the parameter still in it.The equation that I get after simplifying are:
$$F(x,y,\alpha)=n^{2}(x-m)^{2}+(-a^{2}+b^{2})(x-m)(y-n)\sin(\alpha)+m^{2}(y-n)^{2})$$
$$\partial_\alpha F(x,y,\alpha)\equiv \left[(x-m+n)^{2}-(y-n+m)^{2}\right]-2(x-m)(y-n)\tan(\alpha)-\left(\frac{mx-yn+n^{2}-m^{2}}{mn}\right)\frac{(-a^{2}+b^{2})\sin(\alpha)}{2}=0$$
where $m=\sqrt{a^{2}\cos\alpha^{2}+b^{2}\sin\alpha^{2}}$ and  $n=\sqrt{b^{2}\cos\alpha^{2}+a^{2}\sin\alpha^{2}}$
I've tried a lot to remove the parameter $\alpha$ but so far I've failed to do so.So my questions are " Is there any way that I can eliminate the parameter $\alpha$ and get the equation of the envelope?" and if there isn't then "Is there any other way to solve the hallway problem that I just proposed?"
I asked my teacher but he had no idea how to solve it, so could you please help?
In order to avoid confusion ,I'm uploading a picture of a similar problem in which there is a rectangle of maximum area that passes through the left-turn hallway instead of an ellipse(so that you can get the idea of the type of hallway I'm talking about).I learned about this method from this link  here.

 A: Not a complete answer
Without loss of generality, take $c \ge d$.
From the observation in another answer of mine, the optimal values should be bounded by $$2a \ge c\ge d \ge 2b$$

*

*Centre of ellipse

$$(h,k)=(\sqrt{a^2\cos^2 \theta+b^2\sin^2 \theta},\sqrt{a^2\sin^2 \theta+b^2\cos^2 \theta})$$
$$\partial_\theta (h,k)=(a^2-b^2)\sin \theta \cos \theta
\left(
  -\frac{1}{h},\frac{1}{k}
\right)$$

*

*Equation of ellipse

$$F(x,y,\theta) \equiv
k^2(x - h)^2 -
(a^2-b^2)(x-h)(y-k) \sin 2\theta +
h^2(y - k)^2 -
a^2 b^2=0$$

In fact, the envelope $F=\partial_\theta F=0$ is more than enough.
It's because the ellipse can pass through the corridor with the minor axis, that is for $\dfrac{\pi}{2} \le \theta \le \pi$.

In particular, $c=d=2b$ and considering when
$\theta=\left( \frac{n}{2}+\frac{1}{4} \right) \pi$,
$$
\sqrt{c^2+d^2}=b+\sqrt{a^2+b^2} \implies
\frac{a}{b}=2\sqrt{2-\sqrt{2}} \approx 1.5307
$$
A: Note: This is apparently not the right answer to the question. The question originally did not mention an L-shaped hallway, and has substantially changed since. I will leave the answer as it is (for fitting the ellipse of largest area into a rectangular hallway with dimensions $c\times d$) - just as it seems wasteful to delete it, but the way the question is posed now, this is not the right answer.

This is how I would approach the problem...
Let's first tackle the case where the ellipse is centred in the middle of the hallway and touches all sides of the hallway. So, let the hallway be given by $|x|\le c/2, |y|\le d/2$ and let the ellipse be centred in $(0,0)$. For such an ellipse, you have an equation $px^2+2qxy+ry^2=1$ where $p,q,r$ are parameters such that $p>0, q^2-pr<0$, which also implies $r>0$.
If $p',r'$ are the roots of the equation $\lambda^2-(p+r)\lambda+pr-q^2=0$ (characteristic polynomial of the matrix $\begin{bmatrix}p&q\\q&r\end{bmatrix}$), then you can have a co-ordinate change (rotation) that brings the ellipse to the equation $p'x^2+r'y^2=1$, so the half-axes of the new ellipse are $\frac{1}{\sqrt{p'}}$ and $\frac{1}{\sqrt{r'}}$. This means that the area of the ellipse is $\frac{\pi}{\sqrt{p'r'}}=\frac{\pi}{\sqrt{pr-q^2}}$ (as $p'r'=pr-q^2$ - Vieta formulas).
Now, the conditions are that the ellipse touches the rectangle, so the following equations must have exactly one solution (substitute $x$ with $\pm\frac{c}{2}$ and substitute $y$ with $\pm\frac{d}{2}$):
$$ry^2\pm qcy+\frac{pc^2}{4}-1=0$$
$$px^2\pm qdx+\frac{rd^2}{4}-1=0$$
These conditions boil down to:
$$q^2c^2-rpc^2+4r=0$$
$$q^2d^2-prd^2+4p=0$$
(the discriminants are zero).
So, basically, we are trying to minimise $pr-q^2$ with the above conditions. For that, you can use the method of Lagrange multipliers: create the form:
$$pr-q^2-\lambda_1(q^2c^2-rpc^2+4r)-\lambda_2(q^2d^2-prd^2+4p)$$
and make the system of equations by partial differentiation on $p,q,r,\lambda_1,\lambda_2$:
$$r-\lambda_1(-rc^2)-\lambda_2(-rd^2+4)=0$$
$$-2q-\lambda_1(2qc^2)-\lambda_2(2qd^2)=0$$
$$p-\lambda_1(-pc^2+4)-\lambda_2(-pd^2)=0$$
$$q^2c^2-rpc^2+4r=0$$
$$q^2d^2-prd^2+4p=0$$
Look at the first three equations: they can be rewritten as:
$$r(1+\lambda_1 c^2+\lambda_2 d^2)=4\lambda_2$$
$$q(1+\lambda_1 c^2+\lambda_2 d^2)=0$$
$$p(1+\lambda_1 c^2+\lambda_2 d^2)=4\lambda_1$$
Now, it cannot be that $1+\lambda_1 c^2+\lambda_2 d^2=0$, because then the first and the third equation would imply $\lambda_1=\lambda_2=0$, which is a contradiction as $1+\lambda_1 c^2+\lambda_2 d^2=1\ne 0$ in that case.
So, from the second equation we have $q=0$. This gives us, from the fourth and fifth equation: $-rpc^2+4r=0$, $-prd^2+4p=0$. Cancelling $p$ and $r$ (as they are positive, i.e. nonzero), we derive $pc^2=4$ and $rd^2=4$, i.e. $p=\frac{4}{c^2}$ and $r=\frac{4}{d^2}$. This corresponds to the ellipse:
$$\frac{x^2}{(c/2)^2}+\frac{y^2}{(d/2)^2}=1$$
which is the ellipse with the axes parallel to the $x$ and $y$ axis. Its area is $\frac{\pi}{\sqrt{pr}}=\frac{\pi cd}{4}$.
Now the general case - the ellipse fits the hallway, but either it is not centred in the centre of the hallway, or it does not touch all the sides. In that case, due to symmetry, one can draw a smaller hallway (either $c$ or $d$ or both smaller), still containing the ellipse. As per above formula (which grows as $c,d$ grow) this cannot give you a bigger solution that the one above.
