Find $\sup$ and $\inf$ of $x\sin(\frac{1}{x})$ on $(0,\infty)$. Find $\sup$ and $\inf$ of $x\sin(\frac{1}{x})$ on $(0,\infty)$.
I found an example.
Example:
Let $f(x)=x\sin(\frac{1}{x})$. We are interested in its behaviour for $x\geq1$.
$f'(x)=\sin(\frac{1}{x})-\frac{1}{x}\cos(\frac{1}{x})$. $f''(x)=-\frac{1}{x^3}\sin(\frac{1}{x})$, and this is negative for any $x\geq1$.
Then, $f'$ is decreasing. But $\lim_{x\rightarrow\infty}f'(x)=0$.
Then $f'(x)>0$, for all $x\geq1$. So $f$ is increasing on $[1,\infty)$.
Therefore the sequence $n\sin(\frac{1}{n})$ is increasing for all  $n\geq1$. Therefore
$$\inf n\sin(\frac{1}{n})=1\cdot\sin(\frac{1}{1}) = \sin(1).$$
$$\sup n\sin(\frac{1}{n})=\lim_{n\rightarrow\infty}n\sin(\frac{1}{n})=\lim_{n\rightarrow\infty}\frac{\sin(\frac{1}{n})}{\frac{1}{n}}=1.$$
I understood that the above example is when $x$ is more than $1$. However, I have to find inf and sup in the interval $(0,\infty)$, so I have to find inf and sup in the interval $(0,1)$. But I don't know what to do. I need some help.

The tangent function has a unique fixed point in the interval $[\pi,3\pi/2)$, which we call $p$, and no fixed points in $(3\pi/2,2\pi]$. To verify this, consider the function $g(x)=\tan(x)-x$. The derivative will show you that $g$ is strictly increasing in $[\pi,3\pi/2)$ and $(3\pi/2,2\pi]$, hence $g(x)=0$ cannot have more than $1$ solution in those intervals. Since $g(2\pi)=-2\pi<0$, the equation has no solution in the second interval. Since $g(\pi)=-\pi<0$ and $\lim_{x\to(3\pi/2)^-}g(x)=\infty$ and $g$ is continuous, there's a solution in the first interval.
Back to your problem. We show that $f$ has a minimum value so the infimum will be equal to that minimum. Let $I$ be the interval $[\frac{1}{2\pi},\frac{1}{\pi}]$. $f$ is continuous in $I$ so $f$ attains a minimum there for some $x=x_0\in I$. Since $\frac{2}{3\pi}\in I$, we have $f(x_0)\le f\left(\frac{2}{3\pi}\right)=-\frac{2}{3\pi}$. For $x>\frac{1}{\pi}\Rightarrow 0<\frac{1}{x}<\pi$ we have $\sin\left(\frac{1}{x}\right)>0$ and so $f(x)>0$. Next, $-x\le x\sin\left(\frac 1x\right)$ for $x>0$ so $-\frac{1}{2\pi}\le f(x)$ for $0<x<\frac{1}{2\pi}$. Since $-\frac{2}{3\pi}<-\frac{1}{2\pi}$, we've shown that $f(x)\ge f(x_0)$ for $x>0$ which implies $f$ has a global minimum at $x=x_0$. It's also a local minimum so $f'(x_0)=0$. The case $\cos\left(\frac{1}{x_0}\right)=0\Rightarrow x_0=\frac{2}{3\pi}$ is not possible (we get $f'(x_0)=-1$ then) so divide $f'(x_0)=0$ by $\cos\left(\frac{1}{x_0}\right)$ to obtain $\tan\left(\frac{1}{x_0}\right)=\frac{1}{x_0}$. Since $\frac{1}{x_0}\in[\pi,2\pi]\setminus\{3\pi/2\}$, $\frac{1}{x_0}$ is the previously mentioned fixed point of the tangent, i.e. $\frac{1}{x_0}=p\Leftrightarrow x_0=\frac{1}{p}$. Thus,
$$\inf_{x>0}f(x)=f\left(\frac 1p\right)=\frac{\sin(p)}{p}=\frac{\sin(p)}{\tan(p)}=\cos(p) $$
I'm not aware of any closed form for the above. If numerical approximations work for you:
$$p\approx 4.4934094579\\
x_0=\frac{1}{p}\approx 0.2225481584\\
\cos(p)\approx -0.2172336282$$
