# How to obtain the logarithm from this numerical integral?

Evaluate $\int_0^1\frac{dx}{1+x}$ using the trapezoidal rule for integration and hence find the value of $\log(2)$.

I solved the first part with an interval of 0.125 and obtained: $\int_0^1\frac{dx}{1+x} ≈ 0.694075$. However, how do I find the value of $\log(2)$ in this context?

• Hint: $\log2=0.69314718055994530941723212145818\cdots$. – Yves Daoust Sep 16 '18 at 9:55
• To clarify the problem statement, "hence" means that you've found $\log{\left(2\right)}$ by performing the trapezoid method. – Nat Sep 16 '18 at 22:03

You have already found the value of $\log(2)$. Congrats!

Hint:

$$\int_0^1\frac{\mathrm{d}x}{1+x}=\log(2)$$

So there you have your context and what you have found is the value of the integration i.e. $\log(2)$ by using numerical methods (Trapezoidal rule).

You could simply translate horizontally by $1$ to the right:

$\frac{1}{1+x}$ looks the same between $0$ and $1$ than $\frac{1}{x}$ between $1$ and $2$.

So:

$$\int_0^1\frac{\mathrm{d}x}{1+x}=\int_1^2\frac{\mathrm{d}x}{x}$$

Which is $\log(2)$ by definition.

$$\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b=\log_e(1+b) - \log_e(1+a)=\log_e\frac{1+b}{1+a}$$

For $$a=0$$ and $$b=1$$ this goes to $$\log_e2$$

But ... if you want to know why $$\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b$$ then here is the answer to that question.
We kind of have to work backwards, so let's start with: $$y=\log_e(1+x)$$ Using laws of indices:
$$1+x=e^y$$ Differentiate both sides with repect to $$x$$: $$1=e^y \frac{dy}{dx}$$ Divide both sides by $$e^y$$: $$\frac{1}{e^y}=\frac{dy}{dx}$$ We know that $$e^y =1+x$$ so let's sub that in: $$\frac{1}{1+x}=\frac{dy}{dx}$$ Multiply both sides by $$dx$$: $$\frac{1}{1+x}dx=dy$$ Integrate both sides from $$x=a$$ to $$x=b$$: $$\int_a^b \frac{1}{1+x}dx=\int_{y(a)}^{y(b)} dy$$ Left hand side is what we want, just integrate the right hand side: $$\int_a^b \frac{1}{1+x}dx=y|_{y(a)}^{y(b)}$$ We already have an expression for $$y$$ which we defined at the beginning, so let's sub that in: $$\int_a^b \frac{1}{1+x}dx=\log_e (1+x) |_a^b$$ This is the required relation.