# How do you use the first and second derivatives to sketch y = x - ln |x|?

Jan 12, 2017

$y \left(x\right)$ is monotone increasing in $\left(- \infty , 0\right)$ and $\left(1 , + \infty\right)$, decreasing in $\left(0 , 1\right)$, reaches a local minimum for $x = 1$ and is concave up in its whole domain.

#### Explanation:

We can calculate the first derivative separately for $x < 0$ and $x > 0$:

1) For $x < 0$ we have:

$y = x - \ln \left(- x\right)$

$\frac{\mathrm{dy}}{\mathrm{dx}} = 1 - \frac{1}{x}$

2) For $x > 0$ we have:

$y = x - \ln \left(x\right)$

$\frac{\mathrm{dy}}{\mathrm{dx}} = 1 - \frac{1}{x}$

Thus the derivative is the same in the two intervals $\left(- \infty , 0\right)$ and $\left(0 , + \infty\right)$. The second derivative is:

$\frac{{d}^{2} y}{{\mathrm{dy}}^{2}} = \frac{d}{\mathrm{dx}} \left(1 - \frac{1}{x}\right) = \frac{1}{x} ^ 2$

We can therefore see that the function has only a critical point for $x = 1$ and that

$y ' \left(x\right) < 0$ for $x \in \left(- \infty , 0\right) \cup \left(0 , 1\right)$
$y ' \left(x\right) > 0$ for $x \in \left(1 , + \infty\right)$

so this critical point is a local minimum. It has no inflection points and is concave up in its domain.

We can also note that:

${\lim}_{x \to - \infty} y \left(x\right) = - \infty$

${\lim}_{x \to + \infty} y \left(x\right) = + \infty$

${\lim}_{x \to 0} y \left(x\right) = + \infty$

So $y \left(x\right)$ starts from $- \infty$ strictly increases approaching $+ \infty$ for $x \to {0}^{-}$, then decraeses starting from $+ \infty$ as $x \to {0}^{+}$, reaches a minimum for $x = 1$ and then starts increasing again approaching $+ \infty$ for $x \to + \infty$.