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