If we take and function
$$f(θ)= \dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta}$$
And wish to find minimum value of function using AM -GM inequality
i.e. if we have two no. p & q Then $$AM \ge GM$$ $$\dfrac{p+q}{2} \ge \sqrt{pq} $$
Using here
$$\dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta} \ge 2 \sqrt { \dfrac{a²b²}{\sin^2 \theta \cos ^2 \theta}}$$
Multiply dividing by $4$ in square root
$$\dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta} \ge 2 \sqrt { \dfrac{4a²b²}{4\sin^2 \theta \cos ^2 \theta}}$$
by using $$2 \sin \theta \cos \theta=\sin (2\theta) $$
$$\dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta} \ge 2 \sqrt { \dfrac{4a²b²}{\sin^2 (2\theta)}}$$
But now i am totally confused how to deal it to find minimum value of function
Please consider case when $a>b$, $b>a $
Answer in the book is:- $(a+b)^2$
$$\dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta}=a^2\tan^2\theta+b^2\cot^2\theta+a^2+b^2$$ Now by $AM\ge GM$ we see that the minimum of $a^2\tan^2\theta+b^2\cot^2\theta$ is $2ab$ $$\implies \dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta}=a^2\tan^2\theta+b^2\cot^2\theta+a^2+b^2\ge 2ab+a^2+b^2=(a+b)^2$$
Alternative
By Cauchy Schwarz $$\dfrac{a^2}{\cos^2\theta} + \dfrac{b^2}{\sin^2\theta}\ge\frac{(a+b)^2}{\cos^2\theta+\sin^2\theta}=(a+b)^2$$