# 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 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.

• Did you want to find the largest ellipse that can fit in a hallway (i.e. rectangle) $c\times d$? Otherwise, when I imagine a hallway, I imagine it's narrow ($d\lt c$) and an ellipse just needs to "fit" the dimension $d$ while being arbitrarily long - it can "begin exiting on the other side before it's fully entered on this side" - and thus has an unbounded area.
– user700480
Commented Aug 31, 2020 at 9:50
• I want to find and ellipse with the largest area possible, which also fits in a hallway whose vertex is (c,d). This problem is inspired from the ladder problem(because instead of a 1-dimensional line it a 2-dimentional figure). Commented Aug 31, 2020 at 10:10
• "So my questions are 'Is there any way that I can eliminate the parameter $\alpha$ and get the equation of the envelope?' and 'Is there any other way to solve the hallway problem that I just proposed?'" ... You should post these questions separately. (You can/should link from one to the other for context.)
– Blue
Commented Aug 31, 2020 at 13:08
• @Haroon: So the ellipse semi-axes $(a,b)$ to be found in terms of $(c,d)$? Commented Sep 2, 2020 at 11:25
• @Narasimham. Yes, you are right. Commented Sep 2, 2020 at 12:32

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 \tag{1}$$

• 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}) \tag{2}$$

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

• 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$$

With careful calculation, $$F_\theta=0$$ is a rectangular hyperbola of Apollonian:

\begin{align} 0 &= 2SC(x - h)^2 - 2(C^2-S^2)(x - h) (y - k)-2SC(y - k)^2 \\[8pt] &\quad \; +2SC \left \{ (x-h) \left[ \frac{k^2}{h}+\frac{(a^2-b^2)SC}{k} \right]- (y-k) \left[ \frac{h^2}{k}+\frac{(a^2-b^2)SC}{h} \right] \right \} \\[5pt] S & \equiv \sin \theta \\[8pt] C & \equiv \cos \theta \end{align}

The intersection of $$F=0$$ and $$F_\theta=0$$ is the feet of the concurrent normals from a point $$(\alpha,\beta)$$ where $$\alpha$$ and $$\beta$$ are the $$x$$ and $$y$$ intercepts of the ellipse. In general, there're four intersections whilst the intercepts being the trivial solutions.

• In order to extract the non-trivial solutions, rewrite the ellipse as

$$\left( \frac{x}{\alpha}+\frac{y}{\beta}-1 \right)^2 =\frac{2\lambda xy}{\alpha \beta} \tag{4}$$

• Let $$(\xi,\eta)$$ be one of the intersections which satisfies $$(4)$$ and hence

$$\lambda=\frac{\alpha \beta}{2\xi \eta} \left( \frac{\xi}{\alpha}+\frac{\eta}{\beta}-1 \right)^2$$

• Equation of tangent

$$2 \left( \frac{x}{\alpha}+ \frac{y}{\beta}-1 \right) = \left( \frac{x}{\xi}+ \frac{y}{\eta} \right) \left( \frac{\xi}{\alpha}+ \frac{\eta}{\beta}-1 \right)$$

$$\frac{x}{2\xi} \left( 1+\frac{\xi}{\alpha}-\frac{\eta}{\beta} \right)+ \frac{y}{2\eta} \left( 1-\frac{\xi}{\alpha}+\frac{\eta}{\beta} \right)=1$$

• Now the normal contains $$(\alpha,\beta)$$ and $$(\xi,\eta)$$, therefore

$$\frac{\eta-\beta}{\xi-\alpha}=\frac {\dfrac{1}{2\eta} \left( 1-\dfrac{\xi}{\alpha}+\dfrac{\eta}{\beta} \right)}{\dfrac{1}{2\xi} \left( 1+\dfrac{\xi}{\alpha}-\dfrac{\eta}{\beta} \right)} \tag{5}$$

• Rearrange and replace $$(\xi,\eta)$$ by $$(x,y)$$ giving a circular cubic:

$$x(x-\alpha) \left( 1-\frac{x}{\alpha}+\frac{y}{\beta} \right)= y(y-\beta) \left( 1+\frac{x}{\alpha}-\frac{y}{\beta} \right) \tag{6}$$

• Solving $$(4)$$ and $$(6)$$ with Mathematica, we can isolate the trivial solutions:

\begin{align} \Delta &= (α^2-β^2)^2 λ^2 + 8α^2β^2λ(1-λ)^2 \\[5pt] P &= 3(α^2-β^2)^2+(1-λ)(α^4-β^4)+2β^2(5α^2-β^2)(1-λ)^2 \\[5pt] Q &= 3(α^2-β^2)^2+(1-λ)(β^4-α^4)+2α^2(5β^2-α^2)(1-λ)^2 \\[5pt] R &= 2(2-λ)[(α^2-β^2)^2+4α^2β^2(1- λ)^2] \\[5pt] \frac{\xi_\pm}{α} &= \frac{P \pm [α^2+β^2(2λ-3)]\sqrt{\Delta}}{R} \\[5pt] \frac{\eta_\pm}{β} &= \frac{Q \pm [α^2(2λ-3)+β^2]\sqrt{\Delta}}{R} \end{align}

• Products of roots

$$\xi_+ \xi_- = \frac{2α^2(α^2-β^2 λ^2)^2}{(2-λ)[(α^2-β^2)^2+4α^2β^2(1-λ)^2]}$$

$$\eta_+ \eta_- = \frac{2β^2(α^2 λ^2-β^2)^2}{(2-λ)[(α^2-β^2)^2+4α^2β^2(1-λ)^2]}$$

• Rectangular hyperbola of Apollonian

$$\frac{y}{x-\alpha}-\frac{x}{y-\beta}= \frac{\alpha^2-\beta^2}{\alpha \beta(1-\lambda)} \tag{7}$$

• Comparing $$(4)$$ with $$F(x,y,\theta)=0$$, we have:

$$\begin{pmatrix} \alpha \\ \beta \end{pmatrix}= \begin{pmatrix} h-\dfrac{a^2-b^2}{k} \sin \theta \cos \theta \\ k-\dfrac{a^2-b^2}{h} \sin \theta \cos \theta \end{pmatrix} \tag{8}$$

$$\lambda=1+\frac{a^2-b^2}{hk} \sin \theta \cos \theta \tag{9}$$

• Using $$(2)$$, we can parameterize of the inner envelope $$(\xi_-,\eta_-)$$ and outer envelope $$(\xi_+,\eta_+)$$:

• The ranges of $$(\alpha,0)$$ and $$(0,\beta)$$ are two trivial envelopes connecting the inner and outer envelopes along the axes.

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.

• Sorry, but I think that you misunderstood the problem (I failed to mention that the hallway wasn't a straight one). Commented Aug 31, 2020 at 12:50
• @Haroon This is unfortunate ... It took me a bit of time to type all of this, you know... :(
– user700480
Commented Aug 31, 2020 at 13:35

Giving that $$F(x,y,\alpha,a,b)=0$$ represents an ellipse, we have that if $$F(x^*,y^*,\alpha,a,b) \gt 0$$ means that $$(x^*,y^*)$$ is outside the ellipse so we need to determine for which points $$(x^*,y^*)$$ we have $$F(x^*,y^*,\alpha,a,b) \ge 0$$ for all $$\alpha\in[\alpha_{min},\alpha_{max}]$$. To obtain those solutions we proceed as follows:

1 - From $$F(x_0,y,\alpha,a,b)=0$$ we obtain $$y = Y(x_0,\alpha,a,b)$$. There are two solutions and we follow with one of them.

2 - Calculate $$dY(x_0,\alpha,a,b) = \frac{dy}{d\alpha}$$.

3 - Calculate a root $$\alpha_0$$ of $$dY(x_0,\alpha,a,b)=0$$.

4 - Now $$y_0 = Y(x_0,\alpha_0,a,b)$$.

5 - The procedure Headroom implements those steps.

Follows a MATHEMATICA script implementing this process.

F[x_, y_, alpha_, a_, b_] := ((x - Sqrt[a^2 Cos[alpha]^2 + b^2 Sin[alpha]^2]) Cos[alpha] + (y - Sqrt[b^2 Cos[alpha]^2 + a^2 Sin[alpha]^2]) Sin[alpha])^2/a^2 + ((x - Sqrt[a^2 Cos[alpha]^2 + b^2 Sin[alpha]^2]) Sin[alpha] - (y - Sqrt[b^2 Cos[alpha]^2 + a^2 Sin[alpha]^2]) Cos[alpha])^2/b^2 - 1

Y[x_, alpha_, a_, b_] := (Sqrt[2] a^2 Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] + Sqrt[2] b^2 Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] +
Sqrt[2] (a^2 - b^2) Cos[2 alpha] Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] +
4 a^2 b^2 Sqrt[(x (-x + Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]))/(a^2 b^2)] - (a^2 - b^2) (-2 x +
Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]) Sin[2 alpha])/(4 (a^2 Cos[alpha]^2 + b^2 Sin[alpha]^2))

dY[x_, alpha_, a_, b_] := ((a^2 - b^2) Sin[
2 alpha] (Sqrt[2] a^2 Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] +
Sqrt[2] b^2 Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] +
Sqrt[2] (a^2 - b^2) Cos[2 alpha] Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] +
4 a^2 b^2 Sqrt[(x (-x + Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]))/(a^2 b^2)] - (a^2 - b^2) (-2 x +
Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]) Sin[2 alpha]))/(4 (a^2 Cos[alpha]^2 +
b^2 Sin[alpha]^2)^2) + (-2 (a^2 - b^2) Cos[2 alpha] (-2 x +
Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]) + (
Sqrt[2] a^2 (a^2 - b^2) Sin[2 alpha])/Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] - (Sqrt[2] b^2 (-a^2 + b^2) Sin[2 alpha])/Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]] -
2 Sqrt[2] (a^2 - b^2) Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]]
Sin[2 alpha] - (2 Sqrt[2] (a^2 - b^2) x Sin[2 alpha])/(Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]] Sqrt[(x (-x + Sqrt[2] Sqrt[a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]]))/(a^2 b^2)]) + (Sqrt[2] (a^2 - b^2)^2 Sin[2 alpha]^2)/Sqrt[
a^2 + b^2 + (a^2 - b^2) Cos[2 alpha]] + ((a^2 - b^2)^2 Sin[4 alpha])/(
Sqrt[2] Sqrt[a^2 + b^2 + (-a^2 + b^2) Cos[2 alpha]]))/(4 (a^2 Cos[alpha]^2 + b^2 Sin[alpha]^2))

Headroom[x0_, a0_, b0_] := Module[{}, solalpha = FindRoot[dY[x0, alpha, a0, b0], {alpha, Pi/4}]; Return[Y[x0, alpha, a0, b0] /. solalpha[[1]]]]

a = 1;
b = 3;

gr1 = Show[Table[ContourPlot[F[x, y, alpha, a, b] == 0, {x, 0, 2b}, {y, 0, 2b}, ContourStyle -> {Thin, Black}], {alpha, 0, Pi/2, 0.05}]]
gr2 = ParametricPlot[{x, Headroom[x, a, b]}, {x, 1.8, 4.4}, AspectRatio -> 1, AxesOrigin -> {0, 0}, PlotStyle -> Red];
Show[gr1, gr2]


Follows a plot showing the case $$a = 1, b = 3$$

NOTE

The plot range (calculation range) in this case $$[1.8, 4.4]$$, can be obtained from the black involute graph.