Integrals of $1/x$ and $1/x^2$ Why is the integral of $1/x$ is $\ln|x|$, while the integral of $1/x^2$ is not $\ln|x^2|/(2x)$?
I figured that it has something to do with the power of $-1$ because if you add $+1$ to $-1$ it will be $0$ and you can not divide to zero. But this is just a theory.
 A: Why should it?
$$\left(\ln|x|\right)'=\frac 1 x$$
$$\left(\frac{\ln|x^2|}{2x}\right)'=\frac{1}{{{x}^{2}}}-\frac{\ln{(x)}}{{{x}^{2}}}\ne\frac 1 {x^2}$$
A: It looks like you are assuming the following rule: if $F$ is an antiderivative of $f$, and $g'$ is the derivative of $g$, then an antiderivative of $f(g)$ is $F(g)/g'$ (in your example: $f(x)=\frac1x,F(x)=\ln(\vert x\vert),g(x)=x^2$). The probable misconception being that to differentiate this function we can just differentiate $F(g)$, whose derivative is $g'f(g)$, and that the $g'$ will cancel with $1/g'$. This is not so. You have a quotient $\frac{F(g)}{g'}$, so you need the quotient rule to differentiate, which gives
$$\frac{g'f(g)g'-F(g)g''}{g'^2}=f(g)-\frac{F(g)g''}{g'^2}$$
as the derivative. So you're stuck with the superfluous term on the right. In general, there is no easy rule to find antiderivatives of compositions of functions.
A: If you have a function $f:(\infty,0)\cup(0,\infty)\rightarrow\mathbb{R}$ defined by $$f(x)=\begin{cases}\ln(-x)+A&x\lt0\\\ln(x)+B&x\gt0\end{cases}$$ for fixed $A,B\in\mathbb{R},$ then $$\forall{x\in(\infty,0)\cup(0,\infty)},\;f'(x)=\frac1{x}.$$ As such, we say that $$\int\frac1{x}\,\mathrm{d}x=\begin{cases}\ln(-x)+A&x\lt0\\\ln(x)+B&x\gt0\end{cases}.$$ On the other hand, if $$f(x)=\begin{cases}-\frac1{x}+A&x\lt0\\-\frac1{x}+B&x\gt0\end{cases}$$ for fixed $A,B\in\mathbb{R},$ then $$\forall{x\in(\infty,0)\cup(0,\infty)},\;f'(x)=\frac1{x^2}.$$ As such, we say that $$\int\frac1{x^2}\,\mathrm{d}x=\begin{cases}-\frac1{x}+A&x\lt0\\-\frac1{x}+B&x\gt0\end{cases}.$$ In fact, for the general case, what you will have is that $$\int{x^n}\,\mathrm{d}x=\begin{cases}\frac{x^{n+1}}{n+1}+A&n\neq-1,\,x\lt0\\\frac{x^{n+1}}{n+1}+B&n\neq-1,\,x\gt0\\\ln(-x)+A&n=-1,\,x\lt0\\\ln(x)+B&n=-1,\,x\gt0\end{cases}.$$ This is because there is no $A,n$ such that if $f(x)=Ax^n,$ then $$f'(x)=\frac1{x}.$$ On the other hand, notice that $$\frac{x^{n+1}}{n+1}=\frac{e^{\ln(x)(n+1)}}{n+1}=\frac{1+\ln(x)(n+1)+\sum_{m=2}^{\infty}\frac{\ln(x)^m(n+1)^m}{m!}}{n+1}$$ $$=\frac1{n+1}+\ln(x)+\ln(x)\sum_{m=1}^{\infty}\frac{\ln(x)^m(n+1)^m}{(m+1)!}.$$ What this implies is that $$\lim_{n\to-1}\frac{x^{n+1}}{n+1}-\frac1{n+1}=\ln(x),$$ and notice that $$\lim_{n\to-1}\frac{x^{n+1}}{n+1}-\frac1{n+1}=\lim_{n\to-1}\int_1^xt^n\,\mathrm{d}t,$$ so $$\lim_{n\to-1}\int_1^xt^n\,\mathrm{d}t=\ln(x).$$
