$\ln(x^2)$ vs $2\ln x$

These two are supposed to be equivalent because of the properties of logarithms, but the domains of $\ln(x^2)$ and $2\ln x$ seem different to me. For example, if I substitute $x=-1$ into the first, I get 0. But in the second, I get a non-real answer.

Why is this? The domains of these functions, when graphed, seem different as well. But everything I've been taught so far, and most of the things I can find on the web, do not explain this inconsistency. Typically, I consider the property $\ln(a^b) = b \ln a$ to be true...

I am only a senior in high school, currently in Calculus I, but hopefully the explanation won't be too outside of the realm of my understanding. But even if it is, I would still like to know the answer.

Thanks in advance


Solution 1:

You are right. In the reals, you can define $\ln(x^2)$ for all of $\mathbb{R}$ except 0, while $2\ln x$ is only defined for $x \gt 0$. Where they are both defined, they agree. The proper way to write the equality is $\ln (x^2)=2\ln |x|$, in which case the domains agree. People get sloppy sometimes.

Solution 2:

When the identity is stated as $\ln(a^b)=b\ln(a)$, it is assumed that $a$ is positive. Thus, regardless of whether it is possible to extend $\ln(a^b)$ to a larger range of $a$ values for special choices of $b$, this is a valid identity with this domain restriction.

If the case where $b$ is an even integer were singled out, then it would be good to point out that the identity can be generalized to $\ln(a^b)=b\ln(|a|)$ for all nonzero $a$. But the more general (domain restricted) identity allows $b$ to be any real number, including not only odd integers, but fractions, and even irrational numbers. In most cases, $\ln(a^b)$ wouldn't be defined in an ordinary (real) sense when $a$ is negative.

To properly define a function, its domain should be specified. Things aren't always done properly. For example, a typical question used in precalculus classes gives a formula defining a function, like $\displaystyle{f(x)=\frac{\sqrt{x+4}}{x-2}}$ and asks the student to "find the domain". The idea is that you're supposed to figure out all possible numbers you can plug into the formula such that the result is defined as a real number. This is a good exercise because it can help to build familiarity with the functions and test algebra skills, but it can be misleading. The domain can depend on context, and whoever is defining the function can decide. E.g., if $f$ is the function defined on $(0,\infty)$ by $f(x)=\ln(x^2)$, then I have stipulated the domain to be $(0,\infty)$. The identity $f(x)=2\ln(x)$ is valid on this domain.

Nonetheless, I absolutely agree with you and Ross that if you're just starting with $\ln(x^2)$ with no context to imply that $x$ is positive, then the negative case has to be taken into account, and thus the more general identity $\ln(x^2)=2\ln(|x|)$ would be required.

Similarly, in the identity $\ln(ab)=\ln(a)+\ln(b)$, it is assumed that $a$ and $b$ are positive. The left-hand side would also be defined when $a$ and $b$ are both negative, and in general you would have $\ln(ab)=\ln(|a|)+\ln(|b|)$ whenever $a$ and $b$ have the same sign. The fact that $\ln(ab)$ can be defined while $\ln(a)$ and $\ln(b)$ are not leads to so-called "extraneous solutions" in precalculus problems on solving logarithmic equations, if one is not careful about domain restrictions.

Example Problem: Solve the equation $\ln(x)+\ln(x+1)=-10$.

Solution: Using the identity $\ln(ab)=\ln(a)+\ln(b)$, the equation becomes $\ln(x^2+x)=-10$. Exponentiating yields $x^2+x=\frac{1}{e^{10}}$. Solving the quadratic equation, $x=-\frac{1}{2}\pm\frac{1}{2}\sqrt{1+4/e^{10}}$. But wait, one of these doesn't work in the original equation, because $-\frac{1}{2}-\frac{1}{2}\sqrt{1+4/e^{10}}$ is negative. This "solution" is a solution to $\ln(x^2+x)=-10$, but not to the original equation, because $\ln(x^2+x)$ has larger domain than $\ln(x)+\ln(x+1)$.

(Also, you can see that there should only be one solution to the original equation, because $\ln(x)+\ln(x+1)$ is always increasing where it is defined.)