# How to draw the graph of this function? (very difficult)

I'm trying to draw the graph of this function:

$$f(x) = \begin{cases} |x|^{|x|}, & \text{if x\neq 0} \\ 1, & \text{if x=0} \\ \end{cases}$$

I divided the question in two parts, if $x\lt 0$ and $x\gt0$.

If $x\gt 0$

We have the first and second derivatives:

$f'(x)=e^{x\ln x}(\ln x+1)$

$f''(x)=e^{x\ln x}(\ln x+1)^2+\frac{e^{x\ln x}}{x}$

the only information I have is these derivatives are positive everywhere and never zero, so it's increasing, what else can I say about $f$?

I need help to draw this graph.

-
$\ln x+1=0\quad\Rightarrow x=e^{-1}$ –  Dario Jul 3 at 22:34
You can make this a little easier by noting that $f$ is even, so $f'(-x)=-f'(x)$ and $f''(-x)=f''(x)$. –  Ian Jul 3 at 22:39
Click me –  TonyK Jul 3 at 22:39
How about f(x)=f(-x) and plain f(1),f(2),... –  Silenttiffy Jul 3 at 22:40
preview: desmos.com/calculator/j8l7qzfvka –  chharvey Jul 3 at 23:27

Using LaTeX and my package xpicture it is very easy to do it. This is the LaTeX code:

\documentclass{article}
\usepackage{xpicture}
\begin{document}
\setlength{\unitlength}{1cm}
\PRODUCTfunction{\IDENTITYfunction}{\LOGfunction}{\f}
\COMPOSITIONfunction{\EXPfunction}{\f}{\F}
\begin{Picture}(-3.5,-0.5)(3.5,10.5)
\cartesiangrid(-3,0)(3,10)
\PlotFunction[10]\F{0.01}{2.5}
\changereferencesystem(0,0)(-1,0)(0,1)
\PlotFunction[20]\F{0.01}{2.5}
\end{Picture}
\end{document}


We define the function as $F(x)=\exp(x\log x)$, and plot it a positive interval. Then we change of reference system to (0,0)(-1,0)(0,1) and replot the same function, because $F$ is a even function. This is the result:

-

First, this is an even function, since if $x>0$, we have $f(-x) = |-x|^{|-x|} = x^x = f(x)$. Thus we only need to concern ourselves with the graph for $x\ge 0$. As @Dario noted, $f'(x) = 0$ when $x = \frac{1}{e}$, at which point $f(x) = e^{-1/e}\approx 0.692$. For $0<x<\frac{1}{e}$, we have $f'(x) < 0$, while for $x>\frac{1}{e}$, $f'(x) > 0$. Thus $f$ decreases from $x=0$ to a minimum at $x=\frac{1}{e}$ and increases thereafter. For $x>0$, the second derivative is always positive (the first term is always nonnegative, and the second term is always positive), so the graph is concave up everywhere. A graph of $f(x)$ is

-