Am I differentiating this wrong?

Differentiation is the opposite of Integration

\begin{align}\int \cos^2x dx\end{align}

\begin{align}-\frac{\cos^3x}{3\sin x}\end{align}

Now if we differentiate $-\frac{\cos^3x}{3\sin x}$ we should get $\cos^2x$. But I have always thought the differentiation goes like (and works out fine).

\begin{align}\frac{d}{dx}(-\frac{\cos^3x}{3\sin x})= \frac{-3 \cos^2x (\frac{d}{dx}\cos x)}{3\sin x}=\cos^2x\end{align}

And Tarda we get the answer as expected ($\cos^2x$). I normally never thought about it, but today this came to my mind. How come this isn't wrong. And it should be wrong I think. Why?

\begin{align}\frac{d}{dx}(-\frac{\cos^3x}{3\sin x})\end{align}

This is in the form $u/v$ , so we we need to use the chain rule/quotient rule, right? But here we havent used Quotient Rule which should be:

\begin{align}\frac{d}{dx}\frac{-\cos^3x}{3\sin x}=\frac{-9\sin x\cos^2x \sin x+3\cos^4x}{9\sin^2x}\end{align}

But Stilll even without using Quotient rule, I end u with the correct answer. Why is that ? we totally forget about the $3\sin x$ in denominator and differentiate only the top which is $-\cos^3x$ and still gets it right.

• There are so many wrong things with your differentiation that it's hard to make sense of the question itself. You didn't use the quotient rule and you seemed to have indeed have used the chain rule at some point, contrarily to what you say. – Git Gud Sep 18 '14 at 10:59
• @Git Gud ,Yes exactly what Im saying this is that I differentiated it wrong, because u/v we should apply quotient rule, but doing it this way(wrong way) makes me end up in the corrrect answer, why is that ? – anon Sep 18 '14 at 11:01
• @Tharindy But in your question you didn't say 'quotient rule', you said 'chain rule'. As for the question in your comment, it's a coincidence. – Git Gud Sep 18 '14 at 11:02
• You are working with indefinite integral $\frac{-\cos ^3x}{3\sin x}$ is not the exact integral of $\cos ^2x$. – Hassan Muhammad Sep 18 '14 at 11:07

You are wrong in $\int \cos^2 x dx = -\frac{\cos^3 x}{3\sin x}$. You seem to be confused with power rule ($\int x^n dx = \frac{x^{n+1}}{n+1} + c$, for $n \neq -1$), which is only valid for powers of $x$, not $f(x)$. Also, there's an extra $\sin x$ in denominator...
The correct way to evaluate $\int \cos^2 x dx$ is:
$\int \cos^2 x dx = \int \frac{1+\cos 2x}{2} dx = \int \frac12 (1 + \cos 2x) dx = \frac 12(x + \frac{\sin 2x}{2}) + c$.

Now, if you differentiate this, you do get $\frac{1 + \cos 2x}{2}$ back, which equals $\cos ^2 x$.

Proof of $\cos^2 x = \frac{1+\cos 2x}{2}$:
Now, $1 + \cos 2x = \cos 0 + \cos 2x = 2\cos(\frac{0+2x}{2})\cos(\frac{0-2x}{2}) = 2\cos(x)\cos(-x) = 2\cos^2 x$, because $\cos (-x) = \cos x$.

Also, we know that $\cos2x=2\cos^2x-1$, then $\cos2x+1=\cos^2x$.

As taninamdar pointed out, the integration is wrong. The differentiation is also not correct.

Let us consider A=\begin{align}-\frac{cos^3x}{3sinx}\end{align}=-\frac{1}{3}\frac{cos^3x}{sinx} Now, set $u=cos^3x$ and $v=\sin(x)$ so $u'=-3 \sin (x) \cos ^2(x)$ and $v'=\cos(x)$. Now, apply the quotient and get $$\frac{d}{dx}\Big(\frac{cos^3x}{sinx}\Big)=-\frac{3 \sin^2(x)\cos^2(x)-\cos^4(x)}{\sin^2(x)}=-2 \cos ^2(x)-\cot ^2(x)$$ So, $$\frac{dA}{dx}=\frac{2 \cos ^2(x)}{3}+\frac{\cot ^2(x)}{3}$$

You can't compute $\int \cos^2x dx$ as if it is $\int y^2 dy$ with $y=\cos x$.

But you can if you wish - and here you almost certainly don't wish, because the double angle formula for $\cos 2x$ is available - change the variable within the integral. If you do this in ordinary cases you have to take care about three things.

First you want your substitution function to be strictly increasing or strictly decreasing over the interval of integration.

Second, you need to attend to the $dx$ part of the integral - if $y=\cos x$ then $$\int \cos^2x dx=\int y^2 \frac{dx}{dy}dy$$

So here differentiating $y=\cos x$ with respect to $y$ we obtain $1=-\sin x \frac {dx}{dy}$ and $\sin x=\sqrt {1-y^2}$ so that $\frac {dx}{dy}=-\frac 1{\sqrt {1-y^2}}$ (care is required with signs now the square root function is involved depending on which quadrant(s) we are working in)

Third you have to attend to the limits of integration which will be for an interval of values of $y$, rather than an interval of values of $x$.