# Why are the domains for $\ln x^2$ and $2\ln x$ different?

If I have a function like this $f(x)=2 \ln(x)$ and I want to find the domain, I put $x>0$. But if I use the properties of logarithmic functions, I can write that function like $f(x)=\ln(x^2)$ and so the domain is all $\mathbb{R}$ and the graphic of function is different. Where is the mistake?

• You can't have a function without having a domain. You can have an expression however and then ask for what values is the expression meaningful. That seems to be what you're doing. – zhw. Nov 4 '16 at 21:31
• My question is: why for example $ln(x)+ln(x-3)$ that is the same of $ln(x(x-3))$ have two different domains and graphs. – L.G.A.G. Nov 4 '16 at 22:13
• @L.G.A.G. They are the same where they are both defined, but they need not be defined in the same places. This is a tricky thing about logarithms that I find precalculus references don't cover very well. – Ian Nov 5 '16 at 2:23
• just because they tell you in algebra that you can't have log(n) n<=0 doesn't mean that you can't... youtube.com/watch?v=IX_23EWpF5U also youtube.com/watch?v=soFDU-1knNE – cmarangu Jul 6 at 0:09

First, you could use $\ln x$ to define functions with different domains as long as $\ln x$ is defined in that domain.

Second, the rule $\ln x^n=n\cdot \ln x$ is a bit sloppy. It should always be pointed out that $x>0$. Likewise, $\ln ab=\ln a+\ln b$, only if $a,b>0$.

Note that: $$\ln (x^2)=2\ln |x| \ne 2 \ln x$$

so the two functions are different and have different domains.

• Thanks. But if I take $ln(x)+ln(x-3)$, this function is $ln(x(x-3))$ from the properties of logarithmic functions, but the domains are different. Why if they should be the same thing? – L.G.A.G. Nov 4 '16 at 18:26

The functions $f(x) =2 \ln x$ and $g(x) = \ln x^2$ have different domains. The domain of $f$ is $(0,\infty)$, and the domain of $g$ is $\mathbb{R} - \{0\}$. But as you said, when $x$ is in the domain of $f$ and the domain of $g$, we have $f(x) = g(x)$.

The domain of a function is part of its definition. Restricting ourselves to functions from subsets of the real numbers to the real numbers, the logarithm function $x \mapsto \ln x$ is defined to have the domain $(0,\infty) \subset \mathbb R$. (I mention the restriction to $\mathbb R$ because there is also a function named $\ln$ whose domain is the non-zero complex numbers.)

There is nothing to stop you from defining a function with $f_1$ with domain $[17,23]$ such that $f_1(x) = \ln x$ whenever $17\leq x \leq23$. The new function $f_1$ does not have all of the nice properties of $\ln$, for example it is never true that $f_1(x) + f_1(y) = f_1(xy)$, because $x$, $y$, and $xy$ cannot all simultaneously be in the domain of $f_1$. Nevertheless, $f_1$ is a perfectly well-defined function, even if it is far less useful than $\ln$, just as the function $\ln$ with domain $(0,\infty)$ is a perfectly-well defined function despite being less useful (for some purposes) than the complex principal logarithm function.

Because the domain of $f_1$ is different from the domain of $\ln$, $f_1$ is not the same function as $\ln$.

Now you want to define a function with the formula $f(x) = 2 \ln x$, but the definition needs a domain. I would argue that there is no such thing as "the" domain for a function defined by that formula, since it is possible to use the mapping $x \mapsto 2 \ln x$ to define functions over many different domains such as $(0,10]$, $[17,71]$, or $(3,4]\cup[10,11)\cup\{37\}$, but there is a maximal domain for functions of that kind, namely, the union of the domains of all possible functions that can be defined by that formula. That domain is again $(0,\infty)$. So if someone asks me for "the" domain of $f(x) = 2 \ln x$ I would guess that they meant the domain $(0,\infty)$; it is the "best" choice for most purposes.

An alternative definition of the function $f(x) = 2 \ln x$ on the domain $(0,\infty)$ is to say that $f(x) = \ln(x^2)$ when $x \in (0,\infty)$. This is the same function because it has the same domain and takes the same value at each point in that domain.

It is also possible to define a function $g(x) = \ln(x^2)$ for all $x \in \mathbb R - \{0\}$. That is a perfectly well-defined function, but it is a different function than $f$ since it has a different domain.

Natural log of x^2 can take negative values because they are squared before they are fed to the logarithm function.