4. 49 Solve the equation $x^{2}+\left(\frac{x}{x+1}\right)^{2}=3$.

Translate the text above into English, please retain the original text's line breaks and format, and output the translation result directly. 

4. 49 Solve the equation $x^{2}+\left(\frac{x}{x+1}\right)^{2}=3$.
[Solution] Since $x^{2}-2 \cdot \frac{x^{2}}{x+1}+\left(\frac{x}{x+1}\right)^{2}=\left(x-\frac{x}{x+1}\right)^{2}$
$$=\left(\frac{x^{2}}{x+1}\right)^{2}$$

The original equation can be transformed into
$$\begin{array}{l}
x^{2}+\left(\frac{x}{x+1}\right)^{2}-2 \cdot \frac{x^{2}}{x+1}+2 \cdot \frac{x^{2}}{x+1}=3 \\
\left(\frac{x^{2}}{x+1}\right)^{2}+2 \cdot \frac{x^{2}}{x+1}-3=0 \\
\left(\frac{x^{2}}{x+1}+3\right)\left(\frac{x^{2}}{x+1}-1\right)=0
\end{array}$$

We have $\frac{x^{2}}{x+1}=-3$ or $\frac{x^{2}}{x+1}=1$.
Solving these two equations, we get
$$\begin{array}{l}
x_{1}=\frac{-3+\sqrt{3} i}{2}, x_{2}=\frac{-3-\sqrt{3} i}{2} \\
x_{3}=\frac{1+\sqrt{5}}{2}, x_{4}=\frac{1-\sqrt{5}}{2}
\end{array}$$