Show that $\ln\left(1+\frac1n\right)=\frac1n-\frac{\theta_n}{2n^2}$ I've been asked to show that for any natural number $n$, there exists $\theta_n\in (0,1)$ such that
$$\ln\left(1+\frac1n\right)=\frac1n-\frac{\theta_n}{2n^2}$$
I've tried to use integral identities in order to convert the logarithm into something easier to handle but it didn't work, so I would appreciate some hints. Thanks in advance.

$$\ln\left(1+\frac1n\right) = \frac1n + \frac{\theta_n}{2n^2}$$
Write $f(x) = \ln(1+x)$. Then by definition of the derivative $$f(x) = f(0) + f'(0)x + \frac{f''(0)}{2}x^2 + o(x^2).$$ Where $o(x^2)/x^2 \to 0$ as $x \to 0$.
$f(0)= \ln(1+0) = 0$.
$f'(x) = \frac{1}{1+x}$ so $f'(0) = 1/(1+0) = 1$.
$f''(x) = \frac{-1}{(1+x)^2}$ and $f''(0) = -1$.
Thus $$f(1/n) = \frac{1}{n} - \frac{1}{2n^2} + o\left( \frac{1}{n^2} \right).$$
$o(1/n^2)$ represents a function for which $n^2o(1/n^2) \to 0$ as $n \to \infty$. Hence $o(1/n^2) \to 0$ as $n \to \infty$, and $$f(1/n) = \frac{1}{n} - \frac{1 - 2n^2o\left( \frac{1}{n^2} \right)}{2n^2}.$$
Now we must employ the taylor theorem to estimate the size of $o(1/n^2)$, henceforth write $E(x)=o(x^2)$.
If we constrain $f(x)$ to the interval $[0,1/n]$, $E(x)$ can be determined via bounds on $f'''(x)$. Note that $f'''(x) = \frac{2}{(1+x)^3}$. This function is decreasing and is bounded below by $0$. Thus $2/(1+1/n)^3 \le f'''(x) \le 2$ on $[0,1/n]$.
By the Remainder theorems for Taylor's formula (arising from the Mean Value Theorem), we have
$$0 < E(1/n) \le 2 \frac{1}{n^3 3!}.$$
Thus $$0< 2n^2 o\left(\frac{1}{n^2}\right) = 2n^2 E(1/n) \le \frac{4n^2}{n^3 3!} = \frac{2}{3n} < 1.$$
This yields $0 < \theta_n = 1-2n^2 E(1/n) < 1$.
