TITLE: Am I allowed to add and subtract expressions whose domain might not be $ \mathbb{R} $
QUESTION [2 upvotes]: We all know the trick of adding and subtracting an expression, for example to calculate:
$ \int \frac{2x}{2x + 1} \, dx = \int \frac{2x + 1 - 1}{2x + 1} \, dx = \int \frac{2x + 1}{2x + 1} \, dx + \int \frac{1}{2x + 1} \, dx = \int 1 \, dx + \int \frac{1}{2x + 1} = x + \frac{1}{2} ln\left|2x + 1\right| + C $.
But, is it OK to add expressions such as $ \frac{1}{x} $ or $ ln(x) $, whose domain is not $ \mathbb{R} $.

REPLY [1 votes]: Yes, but the validity of your solution is restricted to the range of $x$ that all your manipulations support.  In your example, $x$ is restricted by the problem to $\Bbb R \setminus \{-\frac 12\}$ by the denominator of the fraction and all the steps are valid over that domain.  Had you added and subtracted $\frac 1x$ somewhere your solution would not be valid at $0$.  Depending on the problem, you might not care.  There might be some reason you already know $x \gt 0$.  Otherwise, you might solve the problem separately for $x=0$ avoiding that step and get one answer valid at $0$ and another valid elsewhere.
{"set_name": "stack_exchange", "score": 2, "question_id": 4484288}