4. Given that the center of an ellipse is at the origin, and its foci are on the coordinate axes, the line $y=x+1$ intersects the ellipse at points $P, Q$, and $O P \perp O Q,|P Q|=\frac{\sqrt{10}}{2}$. Find the equation of the ellipse.
(1991 National College Entrance Examination)
4. Let the ellipse be $\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1(a>b>0)$, then by property $11(\mathrm{I})$, we have $a^{2}+b^{2}=2 a^{2} b^{2}$.

Substituting $y=x+1$ into the ellipse equation, we get $\left(a^{2}+b^{2}\right) x^{2}+2 a^{2} x+a^{2}\left(1-b^{2}\right)=0$, which simplifies to $2 b^{2} x^{2}+2 x+\left(1-b^{2}\right)=0$. Thus, $x_{1}+x_{2}=-\frac{1}{b^{2}}, x_{1} x_{2}=\frac{1-b^{2}}{2 b^{2}}$. Therefore, $|P Q|^{2}=\left(x_{1}-x_{2}\right)^{2}+\left(y_{1}-y_{2}\right)^{2}=2\left(x_{1}+x_{2}\right)^{2}-8 x_{1} x_{2}=$ $\frac{2}{b^{4}}-\frac{4}{b^{2}}+4=\left(\frac{\sqrt{10}}{2}\right)^{2}$, solving for $b^{2}=2$ or $\frac{2}{3}$, which gives $a^{2}=\frac{2}{3}$ or 2. Hence, the required ellipse equations are $x^{2}+3 y^{2}=2$ or $3 x^{2}+y^{2}=$ 2.