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$$

• oh yea actually you can type "\cos" and "\sin" instead of "\operatorname{cos}" and "\operatorname{sin}" and you'll get the same result May 31, 2020 at 4:06
• @Mathisfun Thanks! I didn't know that, actually somebody had edited my previous question using \operatorname so I was using it only thanks again! May 31, 2020 at 4:07
• You can just take the partial derivative with respect to $y$. May 31, 2020 at 4:08
• @Dayton yes, but that would be a different method... May 31, 2020 at 4:09
• Any particular reason you want to try this method rather than simple algebra? May 31, 2020 at 4:27

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.
If all you want to do is derive $$\cos(x+y)=\cos(x)\cos(y)-\sin(x)\sin(y)$$ from $$\sin(x+y)=\sin(x)\cos(y)+\cos(x)\sin(y)$$ then you actually don't really care about the case where $$\frac{dy}{dx}=-1$$ - the implication only uses any single evaluation of this general derivative. You could get the same result by differentiating treating $$x$$ as constant or $$y$$ as constant or taking $$y=x+c$$. The only case that wouldn't work is if you tried to derive this taking $$x+y$$ to be constant.
A bit more justified would be to take a total derivative of this expression; you would get: $$d\sin(x+y) = \cos(x+y)\,dx + \cos(x+y)\,dy$$ and $$d(\sin(x)\cos(y)+\cos(x)\sin(y))=\cos(x)\cos(y)\,dx-\sin(x)\sin(y)\,dy-\sin(x)\sin(y)\,dx+\cos(x)\cos(y)\,dy$$ which tells you how the expression must change no matter which direction you move in - geometrically, this tells you about the tangent plane to the bivariate function $$\sin(x+y)$$. Since these tangent planes are equal, you can actually just set the coefficient of $$dx$$ (or, equally well, $$dy$$) on either to be equal to get: $$\cos(x+y)=\cos(x)\cos(y)-\sin(x)\sin(y).$$ In more elementary terms, this is just the derivative of the given expression with respect to $$x$$ taking $$y$$ to be constant - but it's a bit more insightful to see that this is just half of an expression where the change in the given terms is written as a weighted sum of the change in $$x$$ and $$y$$.
After differentiation, you can proceed as follows $$\cos(x+y)\left(1+\frac{dy}{dx}\right)=\left(\cos(x)\cos(y)-\sin(x)\sin(y)\right)\left(1+\frac{dy}{dx}\right)$$ $$\cos(x+y)\left(1+\frac{dy}{dx}\right)-\left(\cos(x)\cos(y)-\sin(x)\sin(y)\right)\left(1+\frac{dy}{dx}\right)=0$$ $$\left(\cos(x+y)-\left(\cos(x)\cos(y)-\sin(x)\sin(y)\right)\right)\left(1+\frac{dy}{dx}\right)=0$$ $$\text{If}\ \ 1+\frac{dy}{dx}=0\quad \implies \quad \cos(x+y)-\left(\cos(x)\cos(y)-\sin(x)\sin(y)\right)\ne0$$ $$\text{If}\ \ \frac{dy}{dx}=-1\quad \implies \cos(x+y)\ne\cos(x)\cos(y)-\sin(x)\sin(y)$$
• I didn't ask why $\frac{dy}{dx} \neq -1$ i asked what happens when it is, this answer is literally what I did May 31, 2020 at 5:14
• You can now check my answer saying that if $\frac{dy}{dx}=-1\implies \cos(x+y)\ne \cos x\cos y-\sin x\sin y$ May 31, 2020 at 5:21