Demystify integration of $\int \frac{1}{x} \mathrm dx$ I've learned in my analysis class, that

$$ \int \frac{1}{x} \mathrm dx = \ln(x). $$

I can live with that, and it's what I use when solving equations like that.
But how can I solve this, without knowing that beforehand.
Assuming the standard rule for integration is

$$ \int x^a \, \mathrm dx = \frac{1}{a+1} \cdot x^{a+1} + C .$$

If I use that and apply this to $\int \frac{1}{x} \,\mathrm dx$:
$$ \begin{align*}
  \int \frac{1}{x}\mathrm  dx &= \int x^{-1} \,\mathrm dx \\
                      &= \frac{1}{-1+1} \cdot x^{-1+1} \\
                      &= \frac{x^0}{0}
\end{align*} $$
Obviously, this doesn't work, as I get a division by $0$. I don't really see, how I can end up with $\ln(x)$. There seems to be something very fundamental that I'm missing.
I study computer sciences, so, we usually omit things like in-depth math theory like that. We just learned that $\int \frac{1}{x} dx = \ln(x)$ and that's what we use.
 A: Let's use your result :
$$\int x^a \, dx = \frac{x^{a+1}}{a+1} + C=\frac{x^{a+1}-1}{a+1} +C'$$
and take the limit as $\,a\to -1\,$ (since $\;x^{a+1}=e^{(a+1)\ln(x)}$) :
$$\lim_{a\to\,-1}\int x^a \, dx = C'+\lim_{a\to\,-1}\frac{e^{(a+1)\ln(x)}-1}{a+1}=C'+\ln(x)$$
Hoping this will help your intuition,
A: Along with the other fine responses, I would also like to point out you could reason this through limits.
The regular formula for integral of $x^n$ actually still works, only that it adds a huge constant to it as $n$ goes towards $-1$. That's because $\frac{x^{n+1}}{n+1}$ can be well approximated as $\ln x+\frac{1}{1-n}$ as $n$ goes to $-1$.
$$\begin{array}{rcl} \lim_{\alpha \to 1}\int x^{-\alpha}dx &=& \lim_{\alpha \to 1} \frac{x^{1-\alpha}}{1-\alpha}+C \\
&=& \lim_{\alpha \to 1} \frac{x^{1-\alpha}-1}{1-\alpha}+C+\frac{1}{1-\alpha} \\
&=&\lim_{\beta \to 0} \frac{x^{\beta}-1}{\beta}+C+\frac{1}{1-\alpha}\\
&=&\ln x+\left(C+\frac{1}{1-\alpha}\right)\\
\end{array}$$
A: To show $\int\frac{dx}{x}=\ln{x}+C$ for positive $x$, we can show that the derivative of $\ln{x}$ is $\frac{1}{x}$. This can be done using the standard limit
$$\lim_{x\to0}\frac{\ln(1+x)}{x}=1$$
and the definition of the derivative. We have
$$
\frac{d}{dx}\left(\ln{x}\right)=
\lim_{h\to0}\frac{\ln(x+h)-\ln{x}}{h}=
\lim_{h\to0}\frac{1}{h}\ln\left(1+\frac{h}{x}\right)=\left[t=
\frac{1}{x}\right]=
\lim_{t\to0}\frac{1}{x}\cdot\frac{\ln(1+t)}{t}=
\frac{1}{x},
$$
which is what we wanted to show.
A: The rule doesn't work when $a = -1$. There is a nice way you can get at the derivative of an inverse function if you know the derivative of the function, by way of something called implicit differentiation. Thus if you are willing to grant that $\frac{d}{dx} e^x = e^x$, then I can show that $\frac{d}{dx} \ln x = 1/x$, which is the result that you want.  Write $y = \ln x$, then $e^y = x$ so that by the chain rule, $$\frac{d}{dx} e^y = e^y\frac{dy}{dx}$$ thus $$1 = e^y \frac{dy}{dx}$$ thus $$1 = x \frac{dy}{dx}$$ thus $$\frac{dy}{dx} = 1/x$$ which by definition is equivalent to the equation $$ \int \frac{1}{x} dx = \ln x +c $$
A: There are several approaches. One is based on the limit
$$
\lim_{n\to\infty}n\left(x^{1/n}-1\right)=\log(x)\tag{1}
$$
By adjusting the constant of integration, we have
$$
\int x^n\,\mathrm{d}x=\frac1{n+1}\left(x^{n+1}-1\right)+C\tag{2}
$$
Taking the limit of $(2)$ as $n\to-1$ and using $(1)$ yields
$$
\int x^{-1}\,\mathrm{d}x=\log(x)+C\tag{3}
$$
$(1)$ is essentially a rewrite of the standard limit
$$
\lim_{n\to\infty}\left(1+\frac xn\right)^n=e^x\tag{4}
$$
A: I did sign up just to say some answers here are misleading.
$$\int \frac{1}{x} dx = \ln(x). $$
is not  a calculation but a definition. This is how ln(x) is defined. ln(x) is defined before exp(x)
http://en.wikipedia.org/wiki/Natural_logarithm#Definitions
A: One must not intermingle, what is definition and what is theorem. Before handling the given question, one should clearly state what we mean by exponential function, and what we mean by logarithmic function. There are a lot of theorems in between the definition and the final result. For a nice and accurate answer one should go through W Rudin's Pr of Math Analysis. A little known book "Beardon's Complex analysis is marvelous in this respect.  
A: In my opinion, the primitive of the function $1/x$ has to be studied without mentioning the exponential function $e^x$. Indeed, the exponential function is the inverse function of the primitive of $1/x$ function. This recalls the story of the chicken and the egg: what we consider as known, $e^x$ or $\ln (x)$ ?
A: Actually your first equation should read
$$ \ln(x) = \int_{1}^{x}\frac{1}{t} dt$$
Now we show this.
Here is an approach that starts from the basics.
Define the exponential map by the power series in the usual way. Then $\exp: \mathbb{R} \to \mathbb{R}_{+}$ is an increasing bijective map. Thus, it has an increasing inverse function
$$ \ln: \mathbb{R}_{+} \to \mathbb{R} $$
We know that $\exp$ is a differentiable function such that
$$ \exp^{\prime}(x) = \exp(x) \qquad \forall \; x \in \mathbb{R}$$
Now we use the followgin theorem:

Theorem: Let $U \subset \mathbb{R}$ and suppose $f : U \to \mathbb{R}$ is an injective function, differentiable at some $a \in U$. In addition, suppose that $f^{-1}: f(U) \to U$ is continuous at $b = f(a)$. Then $f^{-1}$ is differentiable at $b$ if and only if $f^{\prime}(a) \neq 0$ and in that case,
$$ (f^{-1})^{\prime}(b) = \frac{1}{f^{\prime}(a)}$$

So we get that $\ln(x)$ is differentiable for all $y \in \mathbb{R}_{+}$ (since $\exp(x) \neq 0$) and (assuming $ y = \exp(x)$)
$$ \ln^{\prime}(y) = \frac{1}{\exp(x)} = \frac{1}{y}$$
Now use Fundamental Theorem of Calculus to get the first equation.
A: If you want to try to prove $\int\frac{\mathrm dx}x=\ln x + C $ (for $x \gt 0$), try the substitution
$$ \begin{align}
  x &= e^u \\
  \mathrm dx &= e^u \mathrm du
\end{align} $$
This substitution is justified because the exponential function is bijective from $\mathbb{R}$ to $(0,\infty)$ (hence for every $x$ there exists a $u$) and continuously differentiable (which allows an integration by substitution).
$$\int\frac{\mathrm dx}x=\int\frac{e^u\mathrm du}{e^u}=u+C$$
Now just use the fact that natural log is the inverse of the exponential function.  If $x=e^u,u=\ln x$.
