Trigonometric equation with two functions and a parameter The problem: For which values of $a$ the equation $a.sinx.cosx=sinx-cosx$ has exactly $2$ different roots in the interval $[0;\pi]$
So clearly $0,\frac{\pi}{2},\pi$ are not an answer. I divide by $sinx.cosx$ and get $f(x)=\frac{1}{cosx}-\frac{1}{sinx}=a$. I look at the interval $(0;\frac{\pi}{2})$ $cosx$ is decreasing so $\frac{1}{cosx}$ is increasing same for $sinx$ is increasing and $\frac{-1}{sinx}$ is also increasing. $\displaystyle \lim_{x \to 0}f(x)= +\infty $  and $\displaystyle \lim_{x \to\frac{\pi}{2} }f(x)= -\infty$ and $f(x)$ is 
continuous so we have exactly $1$ root in the interval $(0;\frac{\pi}{2})$ for every $a$.
My question: I guess I have to find for what value of $a$ the function has $1$ root in the interval $(\frac{\pi}{2};\pi)$ how do I do that and is there an easier way to solve the whole problem?
 A: It may be useful to look at the graphs of the given functions.
The given equation can be converted to the following,
$$a\sin{2x}=2\sqrt{2}\sin{(x-\frac{\pi}{4})}$$
Now sketch the graphs and observe that you will have two solutions iff $a=-2\sqrt{2}$. Here one solution will lie in $(0,\pi/2)$ where the graphs will intersect transversely, whereas one more solution in $(\pi/2,\pi)$ where the graphs will 'touch' each other tangentially. Now you can play with the values of $a$ and see that the number of solutions will increase and decrease if you change $a$ slightly.
A: Let $f(x)=\frac{1}{cosx}-\frac{1}{sinx}, x\in (0, \frac {\pi}2)$. Then $f$ is strictly increasing and $\displaystyle \lim_{x \to 0}f(x)= -\infty, \displaystyle \lim_{x \to \frac {\pi} 2}f(x)= +\infty$ therefore the equation $f(x)=a$ has a unique solution on $(0, \frac {\pi}2)$
For $x \in (\frac {\pi}2, \pi)$, then $\displaystyle \lim_{x \to {\frac {\pi} 2}}f(x)= -\infty$ and $\displaystyle \lim_{x \to {\pi}}f(x)= -\infty$. To have a unique solution in $(\frac {\pi}2, \pi)$, we must take $a$ the maximum value of $f$. Can you take it from here?
