Example 2 Given $00$. Find the minimum value of $y=\frac{a^{2}}{x}+\frac{b^{2}}{1-x}$.

Analysis: Since $0<x<1$ and $x+(1-x)=1$, we can use trigonometric substitution.
Solution: Let $x=\sin ^{2} \theta, \theta \in\left(0, \frac{\pi}{2}\right)$, then
$$
\begin{array}{l}
y=\frac{a^{2}}{x}+\frac{b^{2}}{1-x}=\frac{a^{2}}{\sin ^{2} \theta}+\frac{b^{2}}{\cos ^{2} \theta} \\
=a^{2}\left(1+\cot ^{2} \theta\right)+b^{2}\left(1+\tan ^{2} \theta\right) \\
=a^{2}+b^{2}+(a \cot \theta)^{2}+(b \tan \theta)^{2} \\
\geqslant a^{2}+b^{2}+2 a b=(a+b)^{2} .
\end{array}
$$

Equality holds if and only if $a \cot \theta=b \tan \theta$, i.e., $\sin \theta=$ $\sqrt{\frac{a}{a+b}}$.
Thus, $y_{\min }=(a+b)^{2}$.