I am a little bit lost with how absolute values are treated in the integration process for inverse trigonometric functions. Say we have an integral:
a) $$\int \frac{dx}{\sqrt{a^2 - x^2}} = \int \frac{dx}{\sqrt{a^2(1 - x^2/a^2)}} = \int \frac{dx}{|a|\sqrt{1 - \big(\frac{x}{|a|}\big)^2}} = \arcsin(\frac{x}{|a|}) + C$$
Notice that after taking the square root of $a^2$ we receive $|a| \neq a$, and it is used as the scaling factor in the final integral. However, with $\arctan$ the situation is different:
b) $$\int \frac{dx}{a^2 + x^2} = \int \frac{dx}{a^2 \Big(1 + \big(\frac{x}{a}\big)^2\Big)} = \frac{1}{a}\arctan(\frac{x}{a})$$
In example (b), the square root of $a^2$ is taken to be simply $a \neq |a|$, even though when separating the factor $1/a$ we effectively separating $1/|a|$. Can someone explain the logic/algorithm behind this? Why in (a) $\sqrt{a^2} = |a|$, and in (b) $\sqrt{a^2} = a$. In Apostol calculus text these are 2 separate exercises, with the answers I provided above (derivation is mine).
I also checked the reverse: derivative given derived integral. In fact Apostol's answers make sense in both cases. What I am trying to understand here: how absolute values are treated? I should not always find derivatives or plot the integrated function to check that I correctly integrated them I suppose (to check the derivative sign which can be either plus or minus depending on how $\sqrt{a^2}$ is treated).
For a) one possible solution is given by $$\arctan\frac{x}{\sqrt{a^2-x^2}}+C$$ For b) it is as you stated $$\frac{\arctan\left(\frac{x}{a}\right)}{a}+C$$