Q:

What is the derivative of $y=\cos(x+y)$?

I know it'll be solved using chain rule but I don't know how to use chain rule formula.

A:

We have $y=\cos(x+y)$
Differentiating using chain rule
$ \dfrac{\mathrm d y}{\mathrm d x} =−\sin⁡(x+y)(x+y) \; \Rightarrow$
$\dfrac{\mathrm d y}{\mathrm d x}=−\sin⁡(x+y)\left(1+\dfrac{\mathrm d y}{\mathrm d x}\right)$
Rewriting, 
$\dfrac{\mathrm dy}{\mathrm dx}=−\sin⁡(x+y)−\sin⁡(x+y)\dfrac{\mathrm dy}{\mathrm dx} \; \Rightarrow$
$\dfrac{\mathrm dy}{\mathrm dx}+\sin⁡(x+y)\dfrac{\mathrm dy}{\mathrm dx}=−\sin⁡(x+y)$
Taking $\dfrac{\mathrm dy}{\mathrm dx}$ common,
$\dfrac{\mathrm dy}{\mathrm dx}\left(1+\sin⁡(x+y)\right)=−\sin⁡(x+y)$
Bringing $(1+\sin⁡(x+y))$ to other side,
$\dfrac{\mathrm dy}{\mathrm dx}=−\dfrac{\sin⁡(x+y)}{1+\sin⁡(x+y)}$ will be the final answer.

