6. Let $0<x<1, a, b$ be positive constants. Then the minimum value of $\frac{a^{2}}{x}+$ $\frac{b^{2}}{1-x}$ is ( ).
(A) $4 a b$
(B) $(a+b)^{2}$
(C) $(a-b)^{2}$
(D) $2\left(a^{2}+b^{2}\right)$
6. B.
$$
\begin{array}{l}
\frac{a^{2}}{x}+\frac{b^{2}}{1-x}=(x+1-x)\left(\frac{a^{2}}{x}+\frac{b^{2}}{1-x}\right) \\
=a^{2}+b^{2}+a^{2} \cdot \frac{1-x}{x}+b^{2} \cdot \frac{x}{1-x} \geqslant(a+b)^{2} .
\end{array}
$$

When $x=\frac{a}{a+b}$, the minimum value $(a+b)^{2}$ is achieved.