Is the function $y=\ln x^2$ the same as $y=2\ln |x|$? Suppose I have a function
$$y=\ln x^2$$
Then is this function the same as
$$y=2\ln |x|?$$
 A: A function has both a domain and a rule which tells you what to do with elements in the domain.  If we are assuming $x \in \mathbb{R}$, then both functions listed have domain all reals other than 0.  And, since $2 \ln |x| = \ln |x|^2 = \ln (x^2)$, these two functions have the same rule for all $x$ in their identical domains.  So, they are the same function.
A: As many have shown, if $x$ is real the functions are the same.
However, if $x$ is a complex number the result is not true.
In fact if $z$ is complex and nonzero 
$$\log(z^2) = 2\log|z| + i \mathrm{Arg}(z^2) + 2\pi n i$$
where $\mathrm{Arg}(z^2)$ is the principal value of the complex argument of $z^2$ and where $n=0,\pm1,\pm2,\ldots$.
If $z$ is real and we choose the principal branch of the logarithm then
$$\log(z^2) = 2\log|z|$$
since in this case $\mathrm{Arg}(z^2) = \mathrm{Arg}\,1 = 0$ and $n=0$.
A: Over $\Bbb R,$ the question whether $\ln |x|^2 \overset{?}{=} \ln x^2$ is essentially $|x|^2 \overset{?}{=} x^2.$ The proof is trivial, but oh well:
Proposition: For all $x \in \Bbb R$ we have $|x|^2 = x^2.$
Proof: If $x \ge 0,$ then $|x| = x,$ and $|x|^2 = x^2.$ If $x < 0,$ then $|x| = -x,$ and $|x|^2 = (-x)^2 = x^2.$
A: Yes, indeed $$ \ln(x^2) = 2\ln \lvert x \lvert .$$
First though we have (as proved in J.D.'s answer) that $x^2 = \lvert x \lvert^2$. And so
$$\begin{align}
\ln(x^2) &= \ln(\lvert x\lvert^2) \\
&= 2\ln\lvert x \lvert.
\end{align}
$$
