Proving $\operatorname{cos}(x+y)=\operatorname{cos}(x)\operatorname{cos}(y)-\operatorname{sin}(x)\operatorname{sin}(y)$ using differentiation While proving  $\operatorname{cos}(x+y)=\operatorname{cos}(x)\operatorname{cos}(y)-\operatorname{sin}(x)\operatorname{sin}(y)$ 
by this $$\operatorname{sin}(x+y)=\operatorname{sin}(x)\operatorname{cos}(y)+\operatorname{cos}(x)\operatorname{sin}(y) \\ \text{differentiating both sides w.r.t } x \\ \operatorname{cos}(x+y) \left(1+\frac{dy}{dx}\right)=(\operatorname{cos}(x)\operatorname{cos}(y)-\operatorname{sin}(x)\operatorname{sin}(y))\left(1+\frac{dy}{dx}\right)\\ \text{for $\frac{dy}{dx} \neq -1$}\\\operatorname{cos}(x+y)=\operatorname{cos}(x)\operatorname{cos}(y)-\operatorname{sin}(x)\operatorname{sin}(y) $$
Now I am confused what happens when$\frac{dy}{dx} = -1$ 

To elaborate on my comment about taking a partial derivative. You are assuming that $y = y(x)$. Your expression is of the form 
$$f(x,y)(1 + y'(x)) = g(x,y)(1 + y'(x))$$
and your are trying to conclude the equality
$$f(x,y) = g(x,y), \ \forall (x,y)\in \mathbb{R}^2 $$
But you choose $y$ to be an arbitrary function of $x$. So Suppose 
$$y'(x_0) = -1$$
Then of course you cannot claim that
$$f(x_0,y(x_0)) = g(x_0,y(x_0))$$
So simply pick a new function $y_2$ with $y_2'(x_0) \neq 1$ and $y_2(x_0) = y(x_0)$. Then you have the desired equality
$$f(x_0,y(x_0)) = g(x_0,y(x_0))$$
In particular if $y$ is constant with respect to $x$ then this is just the partial derivative since $y'\equiv 0$ . If you choose a "bad" $y= y(x)$ to begin with then your proof will not work. 
