Simplify $\frac{1-\sin(x)+\cos(x)}{1+\sin(x)+\cos(x)}$ 
Which one is equivalent to: $$\frac{1-\sin(x)+\cos(x)}{1+\sin(x)+\cos(x)}$$
  1)$\dfrac{\cos(x)}{1+\sin(x)}$
  2)$\dfrac{\cos(x)}{1-\sin(x)}$
  3)$\dfrac{1-\sin(x)}{\cos(x)}$
  4)$\dfrac{1+\sin(x)}{\cos(x)}$

Of course we can find the correct choice by testing each of them,but I'm looking for an analytical solution assuming we don't know the final expression.
I tried the following techniques,all failed: multiplying by $\frac{\sin(x)}{\sin(x)}$ ,  multiplying by $\frac{\cos(x)}{\cos(x)}$ , using $\sin^2(x)+\cos^2(x)=1$
 A: $$\cos2y=1-2\sin^2y=2\cos^2y-1,\sin2y=2\sin y\cos y$$
$$\dfrac{1-\sin2y+\cos2y}{1+\sin2y+\cos2y}=\dfrac{2\cos^2y-2\sin y\cos y}{2\cos^2y+2\sin y\cos y}=\dfrac{\cos y-\sin y}{\cos y+\sin y}$$
$$(i)=\dfrac{(\cos y-\sin y)^2}{\cos^2y-\sin^2y}=\dfrac{1-\sin2y}{\cos2y}$$
OR
$$(ii)=\dfrac{\cos^2y-\sin^2y}{(\cos y+\sin y)^2}=\dfrac{\cos2y}{1+\sin2y}$$
A: 
$$\frac { 1-\sin { x } +\cos { x }  }{ 1+\sin { x } +\cos { x }  } =\frac { \sin ^{ 2 }{ \left( \frac { x }{ 2 }  \right) +\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } -2\sin { \left( \frac { x }{ 2 }  \right)  } \cos { \left( \frac { x }{ 2 }  \right)  } +\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } -\sin ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  }  }  }{ \sin ^{ 2 }{ \left( \frac { x }{ 2 }  \right) +\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } +2\sin { \left( \frac { x }{ 2 }  \right)  } \cos { \left( \frac { x }{ 2 }  \right)  } +\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } -\sin ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  }  }  } =\\\ =\frac { 2\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } -2\sin { \left( \frac { x }{ 2 }  \right)  } \cos { \left( \frac { x }{ 2 }  \right)  }  }{ 2\cos ^{ 2 }{ \left( \frac { x }{ 2 }  \right)  } +2\sin { \left( \frac { x }{ 2 }  \right)  } \cos { \left( \frac { x }{ 2 }  \right)  }  } =\\=\frac { \cos { \left( \frac { x }{ 2 }  \right)  } -\sin { \left( \frac { x }{ 2 }  \right)  }  }{ \cos { \left( \frac { x }{ 2 }  \right)  } +\sin { \left( \frac { x }{ 2 }  \right)  }  } =\frac { { \left( \cos { \left( \frac { x }{ 2 }  \right)  } -\sin { \left( \frac { x }{ 2 }  \right)  }  \right)  }^{ 2 } }{ \left( \cos { \left( \frac { x }{ 2 }  \right)  } +\sin { \left( \frac { x }{ 2 }  \right)  }  \right) \left( \cos { \left( \frac { x }{ 2 }  \right)  } +\sin { \left( \frac { x }{ 2 }  \right)  }  \right)  } =\\ =\frac { 1-\sin { x }  }{ \cos { x }  }  $$

A: 
First Method: Using the identities 
  $$\cos a+ \cos b  =2\cos\left(\frac{a+b}2\right)\cos\left(\frac{a-b}2\right)\tag{I}$$
  and 
  $$\cos a + \sin a  =\sqrt2\cos\left(a-\frac{\pi}4\right)\tag{II}$$
  we have, \begin{align}\frac{1-\sin(x)+\cos(x)}{1+\sin(x)+\cos(x)}&= \frac{1+\sqrt2\cos\left(x+\frac{\pi}4\right)}{1+\sqrt2\cos\left(x-\frac{\pi}4\right)}
~~~~\text{using (II)}
\\&=  \frac{\cos(\frac\pi4)+\cos\left(x+\frac{\pi}4\right)}{\cos(\frac\pi4)+\cos\left(x-\frac{\pi}4\right)}
\\&=\frac{\cos\left(\frac{x}2+\frac{\pi}4\right)\cos\left(\frac{x}2\right)}{\cos\left(\frac{x}2-\frac{\pi}4\right)\cos\left(\frac{x}2\right)}~~~~\text{using (II)}
\\&=
\frac{2\cos\left(\frac{x}2+\frac{\pi}4\right)\cos\left(\frac{x}2-\frac{\pi}4\right)}{2\cos^2\left(\frac{x}2-\frac{\pi}4\right)}
\\&=\frac{\cos\left(x\right)+\cos\left(\frac{\pi}2\right)}{1+\cos\left(\frac{\pi}2-x\right)}~~~~\text{using (I) and $\cos2x = 2\cos^2 x -1$ }
\\&\color{red}{=\frac{\cos\left(x\right)}{1+\sin\left(x\right)}}~~~~\text{since}~~~~\cos( \frac{\pi}2-x) = \sin x 
\\&\color{red}{=\frac{\cos\left(x\right)}{1+\sin\left(x\right)} \frac{1-\sin\left(x\right)}{1-\sin\left(x\right)} = \frac{1-\sin\left(x\right)}{\cos\left(x\right)}}\end{align}

second Method: 
$$\frac{1-\sin(x)+\cos(x)}{1+\sin(x)+\cos(x)}\times\frac { \cos { x } }{ 1-\sin { x}  } = \frac{\cos (x)+\cos^2(x)-\sin(x)\cos (x)}{(1+\sin(x))(1-\sin(x))\cos(x)(1-\sin(x))} \\= \frac{\cos (x)+\cos^2(x)-\sin(x)\cos (x)}{\cos(x)+\color{blue}{(1-\sin^2(x)}-\cos(x)\sin(x)} =\frac{\cos (x)+\cos^2(x)-\sin(x)\cos (x)}{\cos(x)+\color{blue}{\cos^2(x)}-\cos(x)\sin(x)}  =\color{blue}{1} $$
A: Multiply numerator and denominator by $1-\sin x+\cos x$: you get
\begin{align}
\frac{1-\sin x+\cos x}{1+\sin x+\cos x}
&=\frac{(1-\sin x+\cos x)^2}{(1+\cos x)^2-\sin^2x} \\[6px]
&=\frac{1+\sin^2x+\cos^2x-2\sin x+2\cos x-2\sin x\cos x}{1+2\cos x+\cos^2x-(1-\cos^2x)}\\[6px]
&=\frac{2(1-\sin x+\cos x-\sin x\cos x)}{2\cos x(1+\cos x)}\\[6px]
&=\frac{(1-\sin x)(1+\cos x)}{\cos x(1+\cos x)}
\end{align}
