Least value of $a$ for which at least one solution exists? What is the least value of $a$ for which
$$\frac{4}{\sin(x)}+\frac{1}{1-\sin(x)}=a$$
has atleast one solution in the interval $(0,\frac{\pi}{2})$?
I first calculate $f'(x)$ and put it equal to $0$ to find out the critical points.
This gives
$$\sin(x)=\frac{2}{3}$$
as $\cos(x)$ is not $0$ in $(0,\frac{\pi}{2})$. I calculate $f''(x)$ and at $\sin(x)=\frac{2}{3}$, I get a minima. Now to have at least one solution, putting $\sin(x)=\frac{2}{3}$ in the main equation, I get $f=9-a$, which should be greater than or equal to $0$. I then get the 'maximum' value of $a$ as $9$.
Where did I go wrong?
[Note the function is $f(x)=LHS-RHS$ of the main equation.]

One possible approach: Find a common denominator, then :
$$\frac{4}{\sin x}+\frac{1}{1-\sin x}=a\iff \frac{4(1- \sin x) + \sin x}{\sin x - \sin^2x} = a$$ $$ \iff 4-3\sin x = a(\sin x - \sin^2 x)\tag{$\sin x \neq 0$}$$
Now write the equation as a quadratic equation in $\sin x$:
$$a\sin^2 x - (3 + a)\sin x + 4 = 0 $$
You can solve for when the equation has a real solution (by determining when the discriminant is greater than or equal to 0). $$b^2 - 4ac \geq 0 \iff (3+a)^2 - 16 a \geq 0 \iff a^2 -10a + 9 \geq 0 \iff (a - 1)(a-9) \geq 0$$
Then determine which values of $a$ satisfy the inequality and give in the desired interval.
