# If the solve the problem

Question:

If $f^{\prime}(x)=x-\frac{1}{x^{2}}$ and $f(1)=\frac{1}{2}$, find $f(x)$

Solution:

Given $\mathrm{f}^{\prime}(\mathrm{x})=\mathrm{x}-\frac{1}{\mathrm{x}^{2}}$ and $\mathrm{f}(1)=\frac{1}{2}$

On integrating the given equation, we have

$\int f^{\prime}(x) d x=\int\left(x-\frac{1}{x^{2}}\right) d x$

We know $\int \mathrm{f}^{\prime}(\mathrm{x}) \mathrm{dx}=\mathrm{f}(\mathrm{x})$

$\Rightarrow \mathrm{f}(\mathrm{x})=\int\left(\mathrm{x}-\frac{1}{\mathrm{x}^{2}}\right) \mathrm{d} \mathrm{x}$

$\Rightarrow \mathrm{f}(\mathrm{x})=\int\left(\mathrm{x}-\mathrm{x}^{-2}\right) \mathrm{dx}$

$\Rightarrow \mathrm{f}(\mathrm{x})=\int \mathrm{xdx}-\int \mathrm{x}^{-2} \mathrm{dx}$

$\operatorname{Recall} \int \mathrm{x}^{\mathrm{n}} \mathrm{dx}=\frac{\mathrm{x}^{\mathrm{n}+1}}{\mathrm{n}+1}+\mathrm{c}$

$\Rightarrow \mathrm{f}(\mathrm{x})=\frac{\mathrm{x}^{1+1}}{1+1}-\frac{\mathrm{x}^{-2+1}}{-2+1}+\mathrm{c}$

$\Rightarrow \mathrm{f}(\mathrm{x})=\frac{\mathrm{x}^{2}}{2}-\frac{\mathrm{x}^{-1}}{-1}+\mathrm{c}$

$\Rightarrow \mathrm{f}(\mathrm{x})=\frac{\mathrm{x}^{2}}{2}+\frac{1}{\mathrm{x}}+\mathrm{c}$

On substituting $x=1$ in $f(x)$, we get

$\mathrm{f}(1)=\frac{1^{2}}{2}+\frac{1}{1}+\mathrm{c}$

$\Rightarrow \frac{1}{2}=\frac{1}{2}+1+\mathrm{c}$

$\Rightarrow 0=1+\mathrm{c}$

$\Rightarrow 1+\mathrm{c}=0$

$\therefore c=-1$

On substituting the value of $c$ in $f(x)$, we get

$\mathrm{f}(\mathrm{x})=\frac{\mathrm{x}^{2}}{2}+\frac{1}{\mathrm{x}}+(-1)$

$\therefore \mathrm{f}(\mathrm{x})=\frac{\mathrm{x}^{2}}{2}+\frac{1}{\mathrm{x}}-1$

Thus, $f(x)=\frac{x^{2}}{2}+\frac{1}{x}-1$