2. Let $a, b>0, \theta \in\left(0, \frac{\pi}{2}\right)$. Find
$$
f(\theta)=\frac{a}{\sin \theta}+\frac{b}{\cos \theta}
$$

the minimum value.
$$
\begin{array}{l}
\left(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\right)^{2}\left(\sin ^{2} \theta+\cos ^{2} \theta\right) \\
\geqslant\left(\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}\right)^{3} \\
\Rightarrow \frac{a}{\sin \theta}+\frac{b}{\cos \theta} \geqslant\left(a^{\frac{2}{3}}+b^{\frac{2}{3}}\right)^{\frac{3}{2}} .
\end{array}
$$

By Hölder's inequality, we have
$$
\begin{array}{l}
\left(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\right)^{2}\left(\sin ^{2} \theta+\cos ^{2} \theta\right) \\
\geqslant\left(\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}\right)^{3} \\
\Rightarrow \frac{a}{\sin \theta}+\frac{b}{\cos \theta} \geqslant\left(a^{\frac{2}{3}}+b^{\frac{2}{3}}\right)^{\frac{3}{2}} .
\end{array}
$$