Trigonometric substitution $\tan{\frac{x}{2}}=t$. What is $\cos{x}$ then? For example, the integral is:
$$\int \frac{\sin{x}}{3\sin{x}+4\cos{x}}dx$$
And we use the substitution: $\tan{\frac{x}{2}}=t$
Now, to get $\cos{x}$ in terms of $\tan\frac{x}{2}$, I first expressed $\cos^2\frac{x}{2}$ and $\sin^2\frac{x}{2}$ in temrs of $\tan\frac{x}{2}$:
$$\cos^2\frac{x}{2}=\frac{1}{\frac{1}{\cos^2\frac{x}{2}}}=\frac{1}{\frac{\sin^2\frac{x}{2}+\cos^2\frac{x}{2}}{\cos^2\frac{x}{2}}}=\frac{1}{1+\tan^2\frac{x}{2}}=\frac{1}{1+t^2}$$
$$\sin^2\frac{x}{2}=1-\cos^2\frac{x}{2}=1-\frac{1}{1+t^2}=\frac{t^2}{1+t^2}$$
Now, using trig idendity: $\cos{2x}=\cos^2{x}-\sin^2{x}$ we have:
$$\cos{x}=\bigg(\cos^2\frac{x}{2}-\sin^2\frac{x}{2}\bigg)=\frac{1}{1+t^2}-\frac{t^2}{1+t^2}=\frac{1-t^2}{1+t^2}$$
which is good, but, I don't know what is wrong with this next procedure (first, getting $\sin^2{x}$, then using trig identity $\sin^2{x}+\cos^2{x}=1$ getting $\cos{x}$).
So, first, expressing $\sin{x}$ in terms of $\tan\frac{x}{2}$ using trig identity $\sin{2x}=2\sin{x}\cos{x}$:
$$\sin^2{x}=4\sin^2\frac{x}{2}\cos^2\frac{x}{2}=4\cdot\frac{t^2}{1+t^2}\cdot\frac{1}{1+t^2}=\frac{4t^2}{(1+t^2)^2}$$
So:
$$\cos^2{x}=1-\sin^2{x}=1-\frac{4t^2}{(1+t^2)^2}=\frac{t^4-2t^2+1-4t^2}{(1+t^2)^2}=\frac{(t^2-1)^2}{(t^2+1)^2}$$
And, $\cos{x}$ is then:
$$\cos{x}=\pm\frac{t^2-1}{t^2+1}$$
Why do I get $\pm$ here? Did I make a mistake somewhere? Thank you for your time.
 A: I hope it's better to write $$\sin x=A(3\sin x+4\cos x)+B\cdot\dfrac{d(3\sin x+4\cos x)}{dx}$$
and find $A,B$ by comparing the coefficients $\sin x,\cos x$
Can you take it from here?
A: These are  well-known formulae :
$$\sin x =\frac{2t}{1+t^2},\qquad \cos x  =\frac{1-t^2}{1+t^2},\qquad \tan x =\frac{2t}{1-t^2}\quad(t\not\equiv\pm\frac\pi4\mod\pi).$$
A geometric proof of the formulae:
Consider the unit circle and a line passing through the point $(-1,0)$which has equation $y=t(x+1)$. Let $M$ be the second interection point of the line with the circle. If $x$ is the polar angle of $M$, we have $t=\tan \frac x 2$, and the coordinates of $M$ are $\;x_M=\cos x,\enspace y_M=\sin x$. Now the equation for the abscissae of the intersection points is
$$(1+t^2)x_M^2+2t^2x_M+t^2-1=0,$$
of which one of the roots is $-1$, hence the other root, by Viète's relations, is $x_M=-\dfrac{t^2-1}{t^2+1}$. You obtain also
$\;\sin x=y_M=t\biggl(\dfrac{1-t^2}{t^2+1}+1\biggr)=\dfrac{2t}{t^2+1}$.
That said, Bioche's rules stipulate  you should set $u=\tan x$. Indeed, $\mathrm d\mkern1mu x=\dfrac{\mathrm d\mkern1mu u}{1+u^2}$, hence
$$I=\int \frac{\sin{x}}{3\sin{x}+4\cos{x}}\mathrm d\mkern1mu x=\int\frac{u}{3+4u^2}\dfrac{\mathrm d\mkern1mu u}{1+u^2}.$$
Decomposing into partial fractions:
$$\frac u{(3+4u^2)(1+u^2)}=\frac{4u}{3+4u^2}-\frac{u}{1+u^2},$$
we get
\begin{align*}I&=\frac12\bigl(\ln(3+4u^2)-\ln(1+u^2)\bigr)\\&= \frac12\ln\biggl(\frac{3+4\tan^2x}{1+\tan^2x}\biggr)=\frac12\ln(4-\cos^2x).
\end{align*}
A: I'd rather have a more elegant way to do this, but this way at least works:
You've shown that $\cos x = \dfrac{1-t^2}{1+t^2}$, and then that $\sin^2 x = \dfrac{4t^2}{(1+t^2)^2}$.
Notice that if you start with $a=b=3$ and then square both sides of $a=b$ to get $a^2=b^2$, you can deduce that $a = \pm b$.  That just means that either $a=b$ or $a=-b$; it doesn't mean $a$ is equal to both $b$ and $-b$.  So you must conclude that for each value of $x$, either $\sin x = \dfrac{2t}{1+t^2}$ or $\sin x = \dfrac{-2t}{1+t^2}$.  Might it be equal to that first expression for some values of $x$ and the second for others? If so, things would get somewhat more complicated.  But now look at the graphs of $x\mapsto\sin x$ and $x\mapsto \tan\dfrac x 2$ on the interval $-\pi\le x\le\pi$.  What you see is that $\sin x\ge0$ if $\tan\dfrac x 2\ge0$ and $\sin \le 0$ if $\tan\dfrac x 2\le 0$.  Consequently you have $\sin x = \dfrac{2t}{1+t^2}$ for all values of $x$.  Now compare the graphs of $x\mapsto\cos x$ and $x\mapsto \tan\dfrac x 2$ on that same interval, and observe that $\cos x\ge 0$ if $-1\le\tan \dfrac x 2\le 1$ and $\cos x\le 0$ if $\tan\dfrac x 2\ge 1$ or $\tan\dfrac x 2\le -1$.  That is the behavior of $\dfrac{1-t^2}{1+t^2}$ and not of $-\dfrac{1-t^2}{1+t^2}$. That decides between $\text{“}{+}\text{''}$ and $\text{“}{-}\text{''}$.
