# What is the derivative of  y = (cosx-sinx)/(cosx+sinx)?

Feb 8, 2018

$y = \frac{\cos x - \sin x}{\cos x + \sin x}$

Use the quotient rule:
$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\left(\cos x + \sin x\right) \left(- \sin x - \cos x\right) - \left(\cos x - \sin x\right) \left(- \sin x + \cos x\right)}{\left(\cos x + \sin x\right) \left(\cos x + \sin x\right)}$

Distribute the terms to simplify
$= \frac{- \sin x \cos x - {\cos}^{2} x - {\sin}^{2} x - \sin x \cos x - \left(- \sin x \cos x + {\cos}^{2} x + {\sin}^{2} x - \sin x \cos x\right)}{{\cos}^{2} x + 2 \sin x \cos x + {\sin}^{2} x}$

$= \frac{- 2 \sin x \cos x - 1 - \left(- 2 \sin x \cos x + 1\right)}{2 \sin x \cos x + 1}$

$= \frac{2 \left(2 \sin x \cos x - 1\right)}{2 \sin x \cos x + 1}$

Multiply by the conjugate of the denominator over itself:
$= \frac{2 \left(2 \sin x \cos x - 1\right)}{2 \sin x \cos x + 1} \cdot \frac{2 \sin x \cos x - 1}{2 \sin x \cos x - 1}$

$= \frac{2 {\left(2 \sin x \cos x - 1\right)}^{2}}{4 {\sin}^{2} x {\cos}^{2} x - 1}$

Feb 8, 2018

$\frac{\mathrm{dy}}{\mathrm{dx}} = 2 \sec 2 x \left(\tan 2 x - \sec 2 x\right)$

#### Explanation:

We have:

$y = \frac{\cos x - \sin x}{\cos x + \sin x}$

We can write:

$y = \frac{\cos x - \sin x}{\cos x + \sin x} \cdot \frac{\cos x - \sin x}{\cos x - \sin x}$

$\setminus \setminus = \frac{{\cos}^{2} x - 2 \sin x \cos x + {\sin}^{2} x}{{\cos}^{2} x - {\sin}^{2} x}$

$\setminus \setminus = \frac{1 - \sin 2 x}{\cos 2 x}$

$\setminus \setminus = \sec 2 x - \tan 2 x$

Then differentiating wrt $x$:

$\frac{\mathrm{dy}}{\mathrm{dx}} = 2 \sec 2 x \tan 2 x - 2 {\sec}^{2} 2 x$
$\setminus \setminus \setminus \setminus \setminus = 2 \sec 2 x \left(\tan 2 x - \sec 2 x\right)$