# Integration by substitition: replacing function of x by function of u

I'm having trouble understanding a specific step used to solve the integral below, where instead of replacing $$g(x)$$ by $$u$$, it is replaced by a function of $$u$$: $$tan(u)$$

$$\int sin(x)\sqrt{1+cos^2(x)}dx$$ The following substitution is used: $$cos(x) = tan(u)$$ $$\mathbf{-sin(x)dx = sec^2(u) du}$$ Resulting in the standard integral which can be solved : $$\int sec^2(U)\sqrt{1+tan^2(u)}du = \int sec^2(u) \sqrt{sec^2(u)} = \int sec^3(u) du$$

The substition in boldface is the one I am having trouble understanding. The left part is the same as usual, i.e. $$\frac{du}{dx}dx = du$$, yet it is set equal to the derivative of $$tan(u)$$. I understand this is due to replacing $$cos(x)$$ by $$tan(u)$$ instead of $$u$$, but I am having trouble understanding the exact steps. An explanation or name of the method would be greatly appreciated.

Implicitly;

$$\frac{d}{du}(\cos x) = -\sin x\frac{dx}{du}$$ $$\frac{d}{du}(\tan u) = \sec^2 u$$ They equate so:

$$-\sin x \frac{dx}{du} = \sec^2 u$$

Then multiply by $$du$$ which is allowed.

$$-\sin x \ dx = \sec^2 u \ du$$

• Thank you for your answer. I'm having trouble understanding the first line. You're taking the derivative of $cos x$ with respect to u (assuming this is a typo)? Which results in: $\frac{d}{dx}(cos x) \frac{dx}{du} = -sin x \frac{dx}{du}$? How does the $\frac{dx}{du}$ come in? – Ross Feb 1 '19 at 20:11
• It's no typo, this is how you differentiate with respect to another variable, and it is because of the chain rule: $$\frac{dy}{du}=\frac{dy}{dx}\cdot\frac{dx}{du}$$. In this case in my first line we take $y=\cos(x)$ which leads to $\frac{dy}{dx}=-\sin x$, then we must multiply by $\frac{dx}{du}$ to make this valid. – Rhys Hughes Feb 1 '19 at 20:16
• Ah the chain rule, my apologies. If I'm understanding this correctly, this is the reasoning: $$cos(x) = tan(u)$$ then $$\frac{d}{du}(cos(x)) = \frac{d}{du}(tan(u))$$ After which your next steps apply. Is this correct? – Ross Feb 1 '19 at 20:20
• Precisely that. – Rhys Hughes Feb 1 '19 at 20:33