# Why different sides of equation can be integrated with different terms?

I've always thought that when you manipulate an equation, you're supposed to do the same operation to both sides of the equation. If you do different operations to different sides, then the equality doesn't hold anymore. So why can different sides of an equation be integrated with different terms?

Example:

$$\frac{u' - uu'}{1 + u^2} = \frac{1}{x}$$

Apparently this equation can be integrated by $u$ on the left side and $x$ on the right side without breaking the equality. Why is this correct? Integration by $u$ is not the same operation as integration by $x$.

In fact, formally you are integrating both sides with respect to $x$ and then using substitution and the chain rule to express the left hand side in terms of $u$. Let me demonstrate it. You have the equation

$$\frac{u'(x) - u(x)u'(x)}{1 + u^2(x)} = \frac{1}{x}.$$

Integrating with respect to $x$ both sides (and ignoring for a second the issue that $\frac{1}{x}$ is defined on a disconnected domain), we have

$$\int \frac{u'(x) - u(x)u'(x)}{1 + u^2(x)} \, dx = \int \frac{u'(x)}{1 + u^2(x)} \, dx - \frac{1}{2} \int \frac{2 u(x) u'(x)}{1 + u^2(x)} \, dx = \int \frac{1}{x} \, dx + C.$$

To calculate the first integral, we substitute $v = u(x)$ and then $dv = u'(x) dx$ resulting in

$$\int \frac{u'(x)}{1 + u^2(x)} \, dx = \int \frac{dv}{1 + v^2} = \arctan(v) + C = \arctan(u(x)) + C.$$

To calculate the second integral, we substitute $v(x) = 1 + u^2(x)$ and then $dv = 2 u(x) u'(x) \, dx$ resulting in

$$\frac{1}{2} \int \frac{2 u(x) u'(x)}{1 + u^2(x)} \, dx = \frac{1}{2} \int \frac{dv}{v} = \frac{1}{2} \ln v = \frac{1}{2} \ln(1 + u^2(x)) + C'.$$

Combining everything, we get

$$\arctan(u) - \frac{1}{2} \ln (1 + u^2) = \ln(|x|) + C''.$$

Once you get used to this technique, you can do it without doing the $v$ substitution and the chain rule and then it looks like you integrate the left hand side with respect to $u$ and the right hand side with respect to $x$ but in some sense, this is just a shortcut.