4

I am asked the following problem:

Find $f$ if $$f'(x)=\frac{x^2-1}{x}$$

I am not sure about my solution, which I will describe below:

My solution:

The first thing that I've done is separate the terms of $f'(x)$

\begin{align*} f'(x)&=\frac{x^2-1}{x}\\ &=x-\frac{1}{x}\\ \therefore \quad f(x)&=\frac{x^2}{2}-\ln|x|+c \end{align*}

For ( x > 0 ):

\begin{align*} f(x)&=\frac{x^2}{2}-\ln x+c\\ f(1)&=\frac{1^2}{2}-\ln 1+c=\frac{1}{2} \quad \Rightarrow \quad c=0\\ f(x)&=\frac{x^2}{2}-\ln |x| \end{align*}

For ( x < 0 )

\begin{align*} f(x)&=\frac{x^2}{2}-\ln (-x)+c\\ f(-1)&=\frac{(-1)^2}{2}-\ln [-(-1)]+c=0 \quad \Rightarrow \quad c=-\frac{1}{2}\\ f(x)&=\frac{x^2}{2}-\ln |x|-\frac{1}{2} \end{align*}

Is my solution correct? Should I really find two different answers, one for $x > 0$ and another for $x < 0$?

Thank you.

bru1987
  • 2,045

1 Answers1

2

Looks fine! However a little typo when calculate $f(-1)=0$ not $-1$

Matata
  • 2,138