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