TITLE: Two apparently different antiderivatives of $\frac{1}{2 x}$
QUESTION [8 upvotes]: What is right way to calculate this integral and why?

$$
\int\frac{1}{2x}\text dx
$$

I thought, that this substitution is right:
$$
t = 2x
$$
$$
\text dt = 2\text dx
$$
$$
\frac{\text dt}{2} = \text dx
$$
$$
\int\frac{1}{2x}\text dx=\int\frac{1}{t}\frac{\text dt}{2}=\frac{1}{2}\ln|2x| + C .
$$
But it's not right, because this is the correct answer:
$$
\int\frac{1}{2x}\text dx=\frac{1}{2}\int\frac{1}{x}\text dx=\frac{1}{2}\ln|x| + C .
$$
Can someone explain me, why is the first way wrong? When I derive both results, I get the same result.

REPLY [2 votes]: Note that in most cases, a good practice is to factor out the constants in front of the integral. Except for the case when the constant is zero, then the integral is also zero.