To add or subtract expressions, expand them to make their denominators the same. Least common multiple of $x^{2}$ and $x$ is $x^{2}$. Multiply $\frac{2}{x}$ times $\frac{x}{x}$.
$$\frac{1}{x^{2}}-\frac{2x}{x^{2}}+3x$$
Since $\frac{1}{x^{2}}$ and $\frac{2x}{x^{2}}$ have the same denominator, subtract them by subtracting their numerators.
$$\frac{1-2x}{x^{2}}+3x$$
To add or subtract expressions, expand them to make their denominators the same. Multiply $3x$ times $\frac{x^{2}}{x^{2}}$.
$$\frac{1-2x}{x^{2}}+\frac{3xx^{2}}{x^{2}}$$
Since $\frac{1-2x}{x^{2}}$ and $\frac{3xx^{2}}{x^{2}}$ have the same denominator, add them by adding their numerators.