Error in an exponential/logarithmic limit calculation Below is my calculation, but the result is incorrect. It should be $21$ (WolframAlpha), but I get $2$. My textbook explains a different way to get the correct answer, but I couldn't figure out why my calculation leads to an incorrect result. Which part did I get wrong?
$$\lim_{x \to 0}\frac{2}{x} \ln \frac{e^x(e^{20x}-1)}{20(e^x-1)}$$
$$=\lim_{x \to 0}\frac{2}{x} \ln (e^x \times \frac{e^{20x}-1}{20x} \times \frac{x}{e^x-1})$$
$$=\lim_{x \to 0}\frac{2}{x} \ln (e^x \times 1 \times 1)$$
$$=\lim_{x \to 0}\frac{2}{x} \ln {e^x}=\lim_{x \to 0}\frac{2}{x} \times x=2$$
 A: In general, while computing a limit, you cannot apply the limit to part of an expression whereas leaving another part unchanged. Otherwise, you can make errors such as:\begin{align}1&=\lim_{x\to\infty}1\\&=\lim_{x\to\infty}x\times\frac1x\\&=\lim_{x\to\infty}x\times0\\&=0.\end{align}
You have$$\require{cancel}\frac{e^{20x}-1}{e^x-1}=\frac{(e^x)^{20}-1}{e^x-1}=1+e^x+e^{2x}+\cdots+e^{19x}.$$Therefore, if$$f(x)=\frac{e^x(e^{20x}-1)}{e^x-1},$$then$$f(x)=e^x+e^{2x}+e^{3x}+\cdots+e^{20x}.$$Now, let$$g(x)=\log\left(\frac{e^x\left(e^{20x}-1\right)}{20\left(e^x-1\right)}\right)=\log\left(\frac{f(x)}{20}\right).$$Then, since $g(0)=\log(1)=0$, what you are trying to compute is $2g'(0)$. But$$2g'(0)=2\frac{\frac{f'(0)}{\cancel{20}}}{\frac{f(0)}{\cancel{20}}}=2\frac{21}2=21.$$
A: The step from your second to your third line carries out three steps at once. Two of them are valid, but one is not, but as they are tangled together, it is not obvious which is the error. I'll give you some clues to find the mistake yourself.

*

*You swap the limit and logarithm, $\lim \left(\ln z\right)=\ln\left(\lim z\right)$. Recall that it is valid to move the limit inside of any continuous function.


*You twice distribute a limit over a product of terms, $\lim(a\cdot b)=\lim a \lim b$. Recall that this is valid iff the limits of the terms exist individually. You first do this over $\displaystyle \lim \left(\frac{2}{x}\cdot \ln z\right)$ and then do it over $\lim \left(e^x\cdot \ldots\right)$.
Can you spot the error now?
Ultimately, your mistake gives you an indeterminate form of the form $\displaystyle\frac00$. Limits of these forms can equal any value, depending on how fast the numerator and denominator grow relative to one another. Essentially, you were correct that the numerator, by itself, would be $0$, but for expressions of this type, you must address both the numerator and denominator together. This is how you got the wrong value.
