4. The maximum value of the area of the rectangle $A B C D$ inscribed in the ellipse $\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1(a>b>0)$ is
4. $2 a b$ Let $A(a \cos \theta, b \sin \theta)$, where $\cos \theta>0, \sin \theta>0$, then $S=4 a b \sin \theta \cos \theta=2 a b \sin 2 \theta \leqslant 2 a b$. When $\theta=\frac{\pi}{4}$, the equality holds.