A textbook way to integrate $\frac{a}{x}$ is $\int \frac{a}{x} dx = a\ln(x) $
However the answer to the question $\int \frac{x+1}{x} dx$
is not $(x+1)\ln(x)$
but is rather $\frac{x}{x} + \frac{1}{x} = 1 + ln(x) $
I see the logic of the latter answer but I don't understand why the former is wrong.
Thanks for your help.
The former is wrong because your way of integrating $a/x$ works (in general) only if $a$ does not depend on $x$. Since $x+1$ does depend on $x$, you can not use this rule.
An analogy: For a constant $a$, we have $\int a\, \mathrm dx = a x + C$. However, we don’t have $\int \dfrac1x\, \mathrm dx = 1 + C$.