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

Are the following functions equal or one is the restriction of the other?

$f(x) = \ln(x^2)$

$g(x) = 2\ln(x)$

My book says that $g(x)$ is the restriction of $f(x)$ to $\mathbb{R^+}$ and I can verify that on my calculator.

But that doesn't make any sense to me. Shouldn't $2\ln(x) = \ln(x^2)$ ? Or is it because my calculator does $\ln(x)$ first, and then multiplies the result by 2, and so $x$ cannot take a negative value?

Does that mean that these functions are analitically equal but diferent in practice? Or does this happen just because this is the way my calculator is programmed?

Can someone explain this to me?

• Woah, this never occured to me! – goblin Nov 21 '16 at 2:34
• What is $2\ln(-1)$? – Thomas Andrews Nov 21 '16 at 2:44
• @ThomasAndrews It's ERR:NONREAL ANS – Mark Read Nov 21 '16 at 2:44
• I am going to put this on a quiz for my pre-calculus students. – The Count Nov 21 '16 at 3:39

## 3 Answers

The function $f(x)$ has as domain $x\ne0$, $g(x)$ has $x>0$ as domain so they are different. In fact $\ln(-4)^2$ exists for the first function, not for the second one $2\ln(-4)=???$. You can transform the first function in $2\ln|x|$, but you must pay attention to put the absolute value so that the domain remains the same!

• But when $2\ln(x)$ becomes $\ln(x^2)$ its domain changes, so in this case you know the domain without modifying the function. However, what if you have a more complex function which you have to simplify in order to get the domain analitically, rather than using a calculator? What if the simplification changes the domain? Does that mean it is impossible to take the domain of that function analitically? – Mark Read Nov 21 '16 at 2:25
• Ah. I understand now – Mark Read Nov 21 '16 at 2:28
• Great!! Good job;-) – MattG88 Nov 21 '16 at 2:31

$\ln x^2 = 2 \ln \vert x \vert$

The logarithm of a negative number requires delving into the land of complex numbers. See here.

It turns out that $2\operatorname{Log}(-5) = 2\ln 5 +\pi i$ for the so-called principal branch of the complex logarithm, which is a good thing to Google if you're interested.

• So $\ln(x^2)$ is not $2\ln(x)$, but $2\ln|x|$. I see – Mark Read Nov 21 '16 at 2:28
• It's slightly less vulgar to instead say $\ln(x^2) = 2 \ln(x)$ only holds for positive $x$. – Tac-Tics Nov 21 '16 at 2:34
• @Tac-Tics I'm a slightly vulgar kind of guy – GFauxPas Nov 21 '16 at 2:36
• @Tac-Tics, no way, this is much better. – goblin Nov 21 '16 at 2:36

$\ln(x)$ domain is $\mathbb{R}^+$, so any function used as its argument must not have a range that exceeds $\mathbb{R}^+$. $x^2$'s range $\mathbb{R}^+$, whereas $x$'s range is $\mathbb{R}$.