# Find functions such that for all $x \neq 0$, $g'(x) = \frac{1}{x^2}$

How to find all functions $g: \mathbb{R} \to \mathbb{R}$ such that for all $x \neq 0$,

$$g'(x) = \frac{1}{x^2}$$

I know that the antiderivative is $-1/x$, but how to find all $g$?

• Do you have a good first guess at a solution? (Do you know any functions with derivative $1/x^2$?) Nov 30 '15 at 16:59
• @MarioCarneiro f(x) = - 1/x Nov 30 '15 at 17:07
• If $g(x)$ is a solution, then $(g-f)'(x)=0$ everywhere except $0$, so $g-f$ is locally a constant on $\Bbb R^{>0}$, $\Bbb R^{<0}$, and $\{0\}$. Thus the solutions enumerated by copper.hat are the only ones. Nov 30 '15 at 17:10

There are three sets to consider, $x <0$, $\{0\}$ and $x>0$. The first and last are connected and $g'$ is continuous there, hence we can write $g(x) = g(1)+ \int_1^x g'(t)dt$ for $x >0$ and $g(x) = g(-1)+ \int_{-1}^x g'(t)dt$. We can choose $g(0)$ arbitrarily.
Hence we need to choose constants $g(-1), g(0)$ and $g(1)$, then we have $g(x) = \begin{cases} g(-1)- ({1 \over x} +1), & x <0 \\ g(0), & x = 0 \\ g(1)-({1 \over x}-1), & x > 0 \end{cases}$