Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have an ellipse that is defined by center, width and height. The axes of the ellipse parallel to the x and y. I want to find the largest rectangle that completely fits inside this ellipse. Is there an easy way to do this?

And sorry if my terminology is a bit off... it's been a long time since I last tackled with geometry

share|improve this question
sorry. edited the question. –  vainolo Oct 10 '12 at 21:14

2 Answers 2

up vote 5 down vote accepted

The naive thing is to see the ellipse as a stretched circle. We know the size of the largest rectangle that fits in a circle of radius $r$ is a square of side ${\sqrt 2}r$. If the semi-axes are $a$ and $b$ we would expect the rectangle to be ${\sqrt 2}a \times {\sqrt 2}b$.

To prove this, let us put the center at the origin. The equation of the ellipse is $\left(\frac xa\right)^2+\left(\frac yb\right)^2=1$. The area of the rectangle is $4xy,$ where $(x,y)$ is a point on the ellipse and we choose the point to maximize it. The area is then $4xb\sqrt{1-\left(\frac xa\right)^2}$. The derivative of this is $\frac {4b(a^2-2x^2)}{\sqrt{1-\left(\frac xa\right)^2}}$ which is duly zero at $x=\frac a{\sqrt 2}$, giving a side of $\sqrt 2 a$

share|improve this answer
Sorry, but I lost you at "to prove this"... why do I need to prove things to calculate a rectangle? –  vainolo Oct 10 '12 at 21:30
@vainolo: I wanted to prove that the rectangle cited in the first paragraph is in fact the largest rectangle that fits in the ellipse. If you believe it from the first paragraph, you don't need to prove it. –  Ross Millikan Oct 10 '12 at 21:39
OK, so you mean that the rectangle is $w=\sqrt{2}a, h=\sqrt{2}b$ centered like the ellipse? –  vainolo Oct 10 '12 at 21:40
@vainolo: Correct –  Ross Millikan Oct 10 '12 at 21:42
For a proof, it is sufficient to observe that stretching will scale the areas of all rectangles by the same factor. –  Théophile Jul 22 '14 at 15:58

Top right corner on the ellipse (centered on origin): $x = a \cos \theta$ and $y=b\sin\theta$

where $0\le \theta \le \frac{\pi}{2}, a=\frac{width}{2}$ and $b = \frac{height}{2}$

So area:$$A(\theta) = 4xy=4ab\sin\theta\cos\theta = 2ab\sin2\theta$$ Maximum of sin is at $2\theta=\frac{\pi}{2}$. So, we have $\theta = \frac{\pi}{4}$. Therefore the 4 corners are: $$(a\cos \frac{\pi}{4},b\sin \frac{\pi}{4}), (a\cos \frac{3\pi}{4},b\sin \frac{3\pi}{4}), (a\cos \frac{5\pi}{4},b\sin \frac{5\pi}{4}), (a\cos \frac{7\pi}{4},b\sin \frac{7\pi}{4}),$$

which are of course equal to:

$$(\frac{a\sqrt{2}}{2},\frac{b\sqrt{2}}{2}), (-\frac{a\sqrt{2}}{2},\frac{b\sqrt{2}}{2}), (-\frac{a\sqrt{2}}{2},-\frac{b\sqrt{2}}{2}), (\frac{a\sqrt{2}}{2},-\frac{b\sqrt{2}}{2}),$$

And it's area is: $a\sqrt{2}\cdot b\sqrt{2}=2ab$

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.