9. (15 points) Solve the equation for $x$
$$
\sqrt{x+\sqrt{x}}-\sqrt{x-\sqrt{x}}=(a+1) \sqrt{\frac{x}{x+\sqrt{x}}} \text{. }
$$
From the given, we have
$$
\left\{\begin{array}{l}
x \geqslant 0, \\
x-\sqrt{x} \geqslant 0, \\
x+\sqrt{x} \neq 0
\end{array} \Rightarrow x \geqslant 1 .\right.
$$

The original equation is equivalent to
$$
\begin{array}{l}
x+\sqrt{x}-\sqrt{x^{2}-x}=(a+1) \sqrt{x} \\
\Leftrightarrow \sqrt{x}+1-\sqrt{x-1}=a+1 \\
\Leftrightarrow \sqrt{x}-\sqrt{x-1}=a \\
\Leftrightarrow \frac{1}{\sqrt{x}+\sqrt{x-1}}=a \\
\Leftrightarrow \sqrt{x}+\sqrt{x-1}=\frac{1}{a} .
\end{array}
$$

From the range of $x$, we know
$$
\begin{array}{l}
\sqrt{x}+\sqrt{x-1} \geqslant \sqrt{1}+\sqrt{1-1}=1 \\
\Rightarrow \frac{1}{a} \geqslant 1 \\
\Rightarrow 0<a \leqslant 1 .
\end{array}
$$

At this point, adding (1) and (2) gives
$$
2 \sqrt{x}=a+\frac{1}{a} \Rightarrow x=\left(\frac{a^{2}+1}{2 a}\right)^{2} \text {. }
$$

Substituting $x=\left(\frac{a^{2}+1}{2 a}\right)^{2}$ into equation (1) and combining with equation (3), we get
the left side $=\frac{a^{2}+1}{2 a}-\sqrt{\left(\frac{a^{2}+1}{2 a}\right)^{2}-1}$ $=\frac{a^{2}+1}{2 a}-\frac{1-a^{2}}{2 a}=a=$ the right side.
Therefore, $x=\left(\frac{a^{2}+1}{2 a}\right)^{2}$ is a solution to the original equation.
In summary, the equation has a solution
$$
x=\left(\frac{a^{2}+1}{2 a}\right)^{2}
$$
if and only if $0<a \leqslant 1$.