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

Jul 28, 2015

#### Answer:

${y}^{'} = - \frac{2}{\sin x - \cos x} ^ 2$

#### Explanation:

Start by taking a look at your function

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

Notice that this function is actually the quotient of two other functions, let's call them $f \left(x\right)$ and $g \left(x\right)$

$\left\{\begin{matrix}f \left(x\right) = \sin x + \cos x \\ g \left(x\right) = \sin x - \cos x\end{matrix}\right.$

This means that you can differentiate this function by using the quotient rule, which allows you to find the derivative of a function that's the quotient of two other functions by using the formula

color(blue)(d/dx(y) = (f^'(x) * g(x) - f(x) * g^'(x))/[g(x)]^2, where $g \left(x\right) \ne 0$

You also need to remember that

$\frac{d}{\mathrm{dx}} \left(\sin x\right) = \cos x$

and that

$\frac{d}{\mathrm{dx}} \left(\cos x\right) = - \sin x$

So, calculate the derivative of $f \left(x\right)$

$\frac{d}{\mathrm{dx}} \left(f \left(x\right)\right) = \frac{d}{\mathrm{dx}} \left(\sin x + \cos x\right)$

$\frac{d}{\mathrm{dx}} \left(f \left(x\right)\right) = \frac{d}{\mathrm{dx}} \left(\sin x\right) + \frac{d}{\mathrm{dx}} \left(\cos x\right)$

$\frac{d}{\mathrm{dx}} \left(f \left(x\right)\right) = \cos x - \sin x$

and that of $g \left(x\right)$

d/dx(g(x)) = d/dx(sinx - cosx

$\frac{d}{\mathrm{dx}} \left(g \left(x\right)\right) = \frac{d}{\mathrm{dx}} \left(\sin x\right) - \frac{d}{\mathrm{dx}} \left(\cos x\right)$

$\frac{d}{\mathrm{dx}} \left(g \left(x\right)\right) = \cos x - \left(- \sin x\right) = \cos x + \sin x$

The derivative of $y$ will thus look like this

$\frac{d}{\mathrm{dx}} \left(y\right) = \frac{\left(\cos x - \sin x\right) \cdot \left(\sin x - \cos x\right) - \left(\sin x + \cos x\right) \cdot \left(\cos x + \sin x\right)}{\sin x - \cos x} ^ 2$

I'll break this into two fractions to make the calculations easier to read

$\frac{d}{\mathrm{dx}} \left(y\right) = {y}^{'} = {\underbrace{\frac{{f}^{'} \left(x\right) \cdot g \left(x\right)}{g {\left(x\right)}^{2}}}}_{\textcolor{red}{A}} - {\underbrace{\frac{f \left(x\right) \cdot {g}^{'} \left(x\right)}{g {\left(x\right)}^{2}}}}_{\textcolor{red}{B}} = \textcolor{red}{A} - \textcolor{red}{B}$

The first fraction will be equal to

$\textcolor{red}{A} = \frac{\left(\cos x - \sin x\right) \cdot \left(\sin x - \cos x\right)}{\sin x - \cos x} ^ 2$

$\textcolor{red}{A} = \frac{\cos x \cdot \sin x - {\cos}^{2} x - {\sin}^{2} x + \sin x \cos x}{\sin x - \cos x} ^ 2$

$\textcolor{red}{A} = \frac{2 \sin x \cos x - \left({\sin}^{2} x + {\cos}^{2} x\right)}{\sin x - \cos x} ^ 2$

You can further simplify this by using the fact that

$\textcolor{b l u e}{{\sin}^{2} x + {\cos}^{2} x = 1}$

$\textcolor{red}{A} = \frac{2 \sin x \cos x - 1}{\sin x - \cos x} ^ 2$

The second fraction will be equal to

$\textcolor{red}{B} = \frac{\left(\sin x + \cos x\right) \cdot \left(\cos x + \sin x\right)}{\sin x - \cos x} ^ 2$

$\textcolor{red}{B} = {\left(\sin x + \cos x\right)}^{2} / {\left(\sin x - \cos x\right)}^{2}$

You can simplify this by using

$\textcolor{b l u e}{{\left(a + b\right)}^{2} = {a}^{2} + 2 a b + {b}^{2}}$

to get

$\textcolor{red}{B} = \frac{{\sin}^{2} x + 2 \sin x \cos x + {\cos}^{2} x}{\sin x - \cos x} ^ 2$

$\textcolor{red}{B} = \frac{2 \sin x \cos x + 1}{\sin x - \cos x} ^ 2$

Put the two fractions back together to get

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

${y}^{'} = \frac{\textcolor{red}{\cancel{\textcolor{b l a c k}{2 \sin x \cos x}}} - 1 - \textcolor{red}{\cancel{\textcolor{b l a c k}{2 \sin x \cos x}}} - 1}{\sin x - \cos x} ^ 2$

Finally, you get

${y}^{'} = \textcolor{g r e e n}{- \frac{2}{\sin x - \cos x} ^ 2}$