How to find $\tan x $ from $(a+1)\cos x + (a-1)\sin x=2a+1$? How do I find $\tan x$ from this equation?

$$(a+1)\cos x + (a-1)\sin x=2a+1$$

Thanks for any help!!

If $a=1$, we obtain $2\cos x=3$, which is invalid (unless you want to consider complex values). Set $X=\cos x$ and $Y=\sin x$ to get
$$
\begin{cases} (a+1)X+(a-1)Y=2a+1 \\[6px] X^2+Y^2=1 \end{cases}
$$
Therefore $(a-1)Y=2a+1-(a+1)X$ and therefore
$$
(a-1)^2X^2+(2a+1-(a+1)X)^2=(a-1)^2
$$
With standard steps we find
$$
(2a^2-4a+2)X^2 - 2(2a^2-a-1)X + 3a^2 + 6a=0
$$
and it's possible to factor as
$$
2(a-1)^2X^2-2(a-1)(2a+1)X+3a^2+6a=0
$$
Now we have
$$
(a-1)^2(2a+1)^2-2(a-1)^2(3a^2+6a)=(a-1)^2(1-8a-2a^2)
$$
and therefore
$$
X=\frac{(a-1)(2a+1)\pm(a-1)\sqrt{1-8a-2a^2}}{2(a-1)^2}=
\frac{2a+1\pm\sqrt{1-8a-2a^2}}{2(a-1)}
$$
Now compute the corresponding values for $Y$.
By the way, the condition for the equation to have real solutions is that
$$
\frac{|2a+1|}{\sqrt{(a+1)^2+(a-1)^2}}\le1
$$
hence
$$
\frac{-2-\sqrt{6}}{2}\le a\le\frac{-2+\sqrt{6}}{2}
$$
