# $\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.

-
Do you talk about $x \in \mathbb{R}$ or $x \in \mathbb{C}$? For real numbers you should restrict yourself to $x>0$... For complex numbers things get a bit more complicated. –  Fabian Apr 6 '11 at 14:47

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.

-
Reid, I just want to emphasize the last line here - "People get sloppy sometimes". Many high school teachers outright ignore the absolute value when teaching sections on exponents. They accept work such as $\sqrt(x^6) = x^3$, when it should be $\left | x^3 \right |$... –  The Chaz 2.0 Apr 6 '11 at 14:56
Very interesting... I've ran into that idea before, but I didn't even think about applying it here. I assume there's no hard-and-fast rule for when to use an absolute value? Is it just where I notice such a discrepancy like this? –  Reid Apr 6 '11 at 15:09
Indeed $x^2=|x|^2$. –  Américo Tavares Apr 6 '11 at 15:11
@Americo - That's only true for real $x$. $(a + b i)^2 = a^2 + a b i - b^2$, whereas $|a + b i|^2 = \sqrt{(a + b i)(a - b i)}^2 = \sqrt{a^2 + b^2}^2 = a^2 + b^2$. The two are not the same. –  Brian Vandenberg Apr 6 '11 at 18:16
@Brian: Right! I thought of the real case only. –  Américo Tavares Apr 6 '11 at 18:38

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.)

-
+1. Thanks for this answer, especially the part about extraneous solutions -- that's something I've been curious about for a while. One of my majors will be math, so hopefully I'll get into more stuff like this in college. It honestly interests me more than the (rather bland) everyday classroom experience I have now. –  Reid May 7 '11 at 2:17
@Reid: I'm glad you find the extraneous solution stuff interesting. It isn't something you'll probably study much for its own sake in college, but rather something to look out for in general when solving equations. The idea is that we usually want to solve an equation through a sequence of simplifying steps. Sometimes, in order to simplify, equivalence to the original equation is lost; that is, some steps are irreversible. (You would also find this when solving $\sqrt x=x-1$.) I hope you find, as I did, that mathematics gets way more interesting than solving logarithmic equations. –  Jonas Meyer May 7 '11 at 3:02