Integration by parts of $\cot x$ I attempted to integrate $\cot x$ by parts by taking $u$ as $\csc x$ and $\dfrac{dv}{dx}$ as $\sin x$.
Then:
$$\int \cot x\,dx = \int \csc x \cos x\,dx \\
= \sin x \csc x - \int- \sin x \csc x \cot x \, dx \\
= \frac{\sin x}{\sin x} + \int \frac{\sin x}{\sin x}\cot x$$
$$\int \cot x \,dx = 1 + \int \cot x\\
0 = 1$$
I'm fairly sure that the last line isn't true, so where is the mistake?
 A: It's not all that unusual that two different methods of antidifferentiating a function lead to this:
\begin{align}
\int\cdots\cdots & = \text{something} \\[10pt]
\int\cdots\cdots & = \text{something} + 1
\end{align}
If the difference is constant (as $1$ is) then this doesn't mean anything was done wrong, since in either case you should have
\begin{align}
\int\cdots\cdots & = \text{something} + \text{constant} \\[10pt]
\int\cdots\cdots & = \text{something} + 1 + \text{constant}
\end{align}
and those both say the same thing.
A: When we do take the indefinite integral of $f$, what we mean is not the function $F$ such that $F' = f$, but rather the set of all such functions. But we know that if $F_{1}, F_{2}$ are both such that $F_{1}' = F_{2}' = f$, then $F_{1} - F_{2}$ is a constant function, which we usually call $C$. So when we write $\int f(x) \mathrm{d} x = F(x) + C$, what we mean is that the set of all functions whose derivative is $f$ is exactly the set of all functions $G$ such that $G(x) - F(x) = C$ for some real number $C$, i.e. the set of all functions that can be had by taking $F$ and adding a constant (try showing that all solutions of $G' = f$ differ by a constant).
So to your example, let's suppose you had found $F$ such that $F'(x) = \cot x$. Then $\int \cot x \mathrm{d} x = F(x) + C$. Now let $D = C + 1$. Then $1 + \int \cot x \mathrm{d} x = F(x) + (C + 1) = F(x) + D$. So we replace $C$ with $D$ and we're all good. This is because if $G$ differs with $F$ by an additive constant, then $G$ differs with $F + 1$ on an additive constant as well.
BONUS ROUND (if you have some linear algebra): Consider the vector space $V$ comprised of all continuously differentiable functions on $(a, b)$, i.e. the set of functions whose derivatives on $(a, b)$ are continuous (check it's a vector space). Then $T: V \to W$, where $W$ denotes the set of continuous functions from $(a, b)$, given by $T(f(x)) = f'(x))$ is a linear transformation. The trouble is that $T$ is not one-to-one, which is to say the dimension of $\ker T$ is not $0$. In fact, the kernel of $T$ is the set of all constant functions, i.e. $$ \ker T = \{ f_{C} \in V : (\forall x \in (a, b))(f(x) = C) \} .$$ But when we write $\int f(x) \mathrm{d} x$, what we refer to is $T^{-1} f(x)$, which is not actually a function in $V$ but a set of functions in $V$.
But we know that if $F, G \in T^{-1} f$, then $F - G \in \ker T$, and moreover that if $F \in T^{-1} f$, then $T^{-1} f = F + \ker T$. So when you write $\int \cot x \mathrm{d} x = 1 + \int \cot x \mathrm{d} x$, we shouldn't be worried because
\begin{align*}
1 + T^{-1}(f) & = 1 + \ker T + T^{-1} f \\
& = (1 + \ker T ) + T^{-1} f \\
& = \ker T + T^{-1} f \\
& = T^{-1} f .
\end{align*}
The change between lines two and three comes from the fact that in a vector space $U$, if we have $u \in U$ then $u + U = U$, and the kernel of a linear map is a vector space in its own right.
