# What is the derivative of $\cos(x^2 + 1)$? [duplicate]

Derivative is to be found out by using the first principle. What I did was that after applying the first principle, I applied the trigonometric identity $$\cos A-\cos B = -2\sin(( A+B)/2) \sin((A-B)/2),$$ then divided and multiplied the whole by $$(A+B)/2$$ and $$(A-B)/2$$. Since $$\sin x/x$$ is $$1$$, I got the answer as $$x^3 + x$$. But the correct answer was $$-2x\sin(x^2 + 1)$$. So please tell what mistake I made.

$2nd$ picture's first step is not being cut in that step ">

• Please edit in your calculations in more detail so we can spot your mistake. – J.G. Jan 29 at 10:36
• The correct answer is found by means of the chain-rule. Are you familiar with it? I cannot really follow your attempt. – drhab Jan 29 at 10:37
• $\sin{x}/x=1$? Oh boy, you're in for trouble ... – Matti P. Jan 29 at 10:38
• @MattiP. Maybe the OP means the limit of it if $x\to0$. – drhab Jan 29 at 10:39
• @drhab The OP wants a solution from first principles, presumably because an educator requested it. – J.G. Jan 29 at 10:42

Since $$\cos A-\cos B=-2\sin\frac{A-B}{2}\sin\frac{A+B}{2}$$, your strategy should give\begin{align}\frac{d}{dx}\cos(x^2+1)&=\lim_{h\to0}\frac{\cos((x+h)^2+1)-\cos(x^2+1)}{h}\\&=\lim_{h\to0}\frac{-2\sin(hx+h^2/2)\sin(x^2+1+hx+h^2/2)}{h}\\&=-2\sin(x^2+1)\lim_{h\to0}\frac{\sin(hx+h^2/2)}{hx+h^2/2}\frac{hx+h^2/2}{h}\\&=-2\sin(x^2+1)\underbrace{\lim_{h\to0}\frac{\sin(hx+h^2/2)}{hx+h^2/2}}_{1}\cdot\underbrace{\lim_{h\to0}\frac{hx+h^2/2}{h}}_x,\end{align}which gets the right answer. In particular, the first underbraced limit is $$1$$ because, as $$h\to0$$, $$hx+h^2/2\to0$$.