15. (12 points) For the function $f(x)$, if $f(x)=x$, then $x$ is called a "fixed point" of $f(x)$; if $f(f(x))=x$, then $x$ is called a "stable point" of $f(x)$. The sets of "fixed points" and "stable points" of the function $f(x)$ are denoted as $A$ and $B$, respectively, i.e., $A=\{x \mid f(x)=x\}, B=\{x \mid f(f(x))=x\}$.
(1) Prove that $A \subseteq B$;
(2) If $f(x)=a x^{2}-1(a \in \mathbf{R}, x \in \mathbf{R})$, and $A=B \neq \varnothing$, find the range of the real number $a$.
(1) If $A=\varnothing$, then $A \subseteq B$ is obviously true.
If $A \neq \varnothing$, let $t \in A$, then
$$
f(t)=t, f(f(t))=f(t)=t \text {. }
$$

Thus, $t \in B$, hence $A \subseteq B$.
(2) The elements of $A$ are the real roots of the equation $f(x)=x$, i.e., $a x^{2}-1=x$. Since $A \neq \varnothing$, we have
$$
a=0 \text { or }\left\{\begin{array}{l}
a \neq 0, \\
\Delta=1+4 a \geqslant 0 .
\end{array}\right.
$$

Therefore, $a \geqslant-\frac{1}{4}$.
The elements of $B$ are the real roots of the equation $a\left(a x^{2}-1\right)^{2}-1=x$, i.e., $a^{3} x^{4}-$ $2 a^{2} x^{2}-x+a-1=0$. Since $A \subseteq B$, the left side of the above equation contains a factor $a x^{2}-x-1$, so the equation can be rewritten as
$$
\left(a x^{2}-x-1\right)\left(a^{2} x^{2}+a x-a+1\right)=0 .
$$

Since $A=B$, the equation
$$
a^{2} x^{2}+a x-a+1=0
$$

either has no real roots or its real roots are the roots of the equation
$$
a x^{2}-x-1=0
$$

If (1) has no real roots, then
$\Delta_{2}=a^{2}-4 a^{2}(1-a)<0$ or $a=0$.
Solving this gives $a<\frac{3}{4}$.
If (1) has real roots and these roots are also roots of (2), then from (2) we have $a^{2} x^{2}=a x+a$, substituting into (1) gives $2 a x+1=0$.
Solving this gives $x=-\frac{1}{2 a}$.
Substituting back into (2) gives $\frac{1}{4 a}+\frac{1}{2 a}-1=0$. Solving this gives $a=\frac{3}{4}$.
Therefore, the range of $a$ is $\left[-\frac{1}{4}, \frac{3}{4}\right]$.