TITLE: A question regarding the constant of integration
QUESTION [8 upvotes]: Consider the indefinite integral $\int\sin(2x) dx$. There appear to be three seemingly different answers once this integral is evaluated. These are $\frac{-1}{2} \cos(2x) + C$, $\sin^2(x) + C$ and $-\cos^2(x) + C$. This is because all three functions differ only by a constant and thus differentiating them yields $\sin(2x)$. Is it therefore simply a matter of convention which one we decide to choose? 
In a somewhat more artificial sense, one could say $\int\ 2x dx = (x+n)(x-n) + C$ for any $n \in  \mathbb{R}$. Why this is invalid makes more sense because we expand it and add $-n^2$ to $C$ which will give the accepted answer of $x^2 + C$ (the new $C$ is different, of course). Is this simply done for convenience? Can this rule be generalized/formalized in some way such that more tricky functions, in which the extra constant isn't quite as conspicuous as it is with basic polynomials, can be tackled?

REPLY [7 votes]: The principle behind the "$+C$" notation is that the value of an
antiderivative is really a class of functions.
Any two members of that class of functions differ by a constant.
Hence if $F(x)$ is a member of that class, then you can write any
other member of the class in the form $F(x) + C,$ where $C$ is
the appropriate constant.
In principle, any member of the class is on equal standing with any
other member, so I would say there is (in principle) no reason why you
must write $\int 2x\;dx = x^2 + C$ rather than (for example)
$\int 2x\;dx = (x^2 - 4) + C$.
In the case of an explicit constant term (such as $-4$), however,
it seems unnecessary to carry such a term through calculations
when there is already an arbitrary constant term $C$ in the formula.
So it seems unlikely that one would want to do so.
In the example of the multiple representations of $\int\sin(2x) \;dx$
which you gave, the same principle applies, but in this case,
where $\sin^2 x = -\cos^2 x + 1$, one would hardly want to
write $\int\sin(2x) \;dx = (-\cos^2 x + 1) + C$
just to make the answer "the same" as $\int\sin(2x) \;dx = \sin^2 x + C$;
one would more likely write $\int\sin(2x) \;dx = -\cos^2 x + C$,
since $-\cos^2 x$ is just as much a member of the
desired class of functions as $\sin^2 x$ is.
So congratulations on presenting a good example of what the
$\int f(x)\;dx = F(x) + C$ notation really means.