A student asks:

I’ve got to work out: $\int \cosec^2(x) \cot(x) \d x$. I did it letting $u = \cosec(x)$ and got an answer – but when I did it with $u = \cot(x)$, I got something else. What gives?

Ah! A substitution question! My favourite – and it sounds like you’re off to a good start.

If $u = \cosec(x)$, then $\d u = - \cosec(x)\cot(x) \d x$, the integral turns into $- \int u \d u$, which is $C-\frac 12 \cosec^2(x)$. ((The constant can go at the end if you prefer, obviously.))

How about with $u = \cot(x)$?

In that case, $\d u = -\cosec^2(x) \d x$, so the integral becomes $-\int u \d u$ again, which is $C - \frac{1}{2} \cot^2 (x)$.

But wait! Those are different answers!

They certainly look that way, don’t they? However, I’ve done something a bit underhand in my answers, which will become apparent.

There’s a relationship between $\cot(x)$ and $\cosec(x)$: $1 + \cot^2(x) \equiv \cosec(x)$. Playing around with our second answer, that could be written as $C - \frac{1}{2} \left(\cosec^2 (x) - 1 \right)$, or $(C+\frac{1}{2})- \frac{1}{2} \cosec^2(x)$.

That’s very similar to the first answer, but there’s a rogue half in there. How do we get rid of that?

Easy. $C$ is an arbitrary constant, which means we could replace $C+\frac12$ with, say, $K$, and everything would be sweet and dandy - we’d have the same answer.

So, what did I do wrong?

The thing I did wrong was to use the same $C$ for both integrals! There’s no reason to expect two arbitrary constants to be the same, and I should have used $C_1$ and $C_2$ or different letters. Using the same letter to mean different things is an easy path to confusion.

* Edited 2014-11-15 to fix some LaTeX