Solve the following equation on the set of real numbers:

$$
x^{2}+2 x-3-\sqrt{\frac{x^{2}+2 x-3}{x^{2}-2 x-3}}=\frac{2}{x^{2}-2 x-3}
$$
First, let's examine for which real $x$ the fraction under the square root will be greater than or equal to 0. This is only possible if both the numerator and the denominator are either positive or negative (the numerator can be 0, but the denominator cannot).

Both the numerator and the denominator can be factored as follows:

$$
\begin{aligned}
& x^{2}+2 x-3=(x-1)(x+3) \\
& x^{2}-2 x-3=(x+1)(x-3)
\end{aligned}
$$

If we plot the functions derived from these, it is clear that the solutions can only come from the intervals $(-\infty, -3]$, $(-1, 1]$, and $(3, \infty)$. Initially, we can allow the numerator to be 0, but since the right side of the equation is not 0 in this case, neither $x=-3$ nor $x=1$ are roots of the equation.

After this, we multiply both sides of the equation by $\left(x^{2}-2 x-3\right)$.

Two cases are possible: if we multiply by a negative number, or if we multiply by a positive number. Let's first examine in detail the case when $x^{2}-2 x-3$ is positive. In this case, we know that $x>3$ or $x<-1$. After multiplying and rearranging, we get:

$$
\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)-\sqrt{\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)}-2=0
$$

Let $a=\sqrt{\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)}$. Thus, the equation becomes:

$$
a^{2}-a-2=0
$$

The roots of this equation are: $a_{1}=2$ and $a_{2}=-1$. The second root is not valid, as the expression under the square root can only be positive. This implies that $a^{2}=4$. Therefore, the equation to solve is:

$$
\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)=4
$$

If we expand and rearrange the equation to 0, we get:

$$
x^{4}-10 x^{2}+5=0
$$

This is a quadratic equation in $x^{2}$:

$$
x_{1,2}^{2}=5+2 \sqrt{5} \quad \text { and } \quad x_{3,4}^{2}=5-2 \sqrt{5}
$$

From these, we get four roots:

$$
x_{1}=\sqrt{5+2 \sqrt{5}}, \quad x_{2}=-\sqrt{5+2 \sqrt{5}}, \quad x_{3}=\sqrt{5-2 \sqrt{5}}, \quad x_{4}=-\sqrt{5-2 \sqrt{5}}
$$

However, only two of these fall into the appropriate intervals, so only $x_{1}=\sqrt{5+2 \sqrt{5}}$ and $x_{2}=-\sqrt{5+2 \sqrt{5}}$ are solutions to the original equation.

Now let's see what happens if the denominator, by which we multiply, is negative. Since the expression under the square root can only be positive (or 0), $x^{2}+2 x-3$ must also be negative. In this case, the equation looks like this, factoring out $(-1)$ to bring $\left(x^{2}-2 x-3\right)$ under the square root:

$$
\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)+\sqrt{\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)}-2=0
$$

Thus, the product of two negative numbers under the square root can provide additional solutions. Introducing a new variable: let $b=\sqrt{\left(x^{2}+2 x-3\right)\left(x^{2}-2 x-3\right)}$. The resulting equation is:

$$
b^{2}+b-2=0
$$

The positive solution to this is only $b=1$ (the value $b=-2$ cannot be taken by the square root expression). The equation to solve is:

$$
x^{4}-10 x^{2}+8=0
$$

Solving this for $x^{2}$, we get:

$$
x_{1}^{2}=5+\sqrt{17} \quad \text { and } \quad x_{2}^{2}=5-\sqrt{17}
$$

From this, we get the four roots:

$$
x_{1}=\sqrt{5+\sqrt{17}}, \quad x_{2}=-\sqrt{5+\sqrt{17}}, \quad x_{3}=\sqrt{5-\sqrt{17}}, \quad x_{4}=-\sqrt{5-\sqrt{17}}
$$

Of these, only two fall into the appropriate intervals, namely $x_{3}=\sqrt{5-\sqrt{17}}$ and $x_{4}=-\sqrt{5-\sqrt{17}}$.

Therefore, the original equation has a total of 4 roots:

$$
x_{1}=\sqrt{5+2 \sqrt{5}}, \quad x_{2}=-\sqrt{5+2 \sqrt{5}}, \quad x_{3}=\sqrt{5-\sqrt{17}}, \quad x_{4}=-\sqrt{5-\sqrt{17}}
$$

Based on the work of Major Botond (Budapesti Fazekas M. Gyak. Ált. Isk. és Gimn., 11th grade)

Note. The most common mistake in the solutions and generally is to overlook the case where both quadratic expressions take negative values.