I have an problem with the substitution in
$$\int \cos^3(x)dx$$
Ive seen some answers where the integration is done by substituting
$$\int \cos^3(x) = \int \cos(x)(1-\sin^{2}(x))$$
$u = \sin(x)$
I understand how we get the function in that form (trigonometric identity $\cos^2(x) + \sin^2(x) = 1 \implies \cos^2(x) = 1 - \sin^2(x)$, but I dont understand how the substitution can be done with $u = \sin(x)$, since the function needs to be in form $\int f(g(x))g'(x)$ before we can do the substitution to $u = g(x)$? Could you help me see what the $g(x)$ and $f(x)$ is here, thanks!
$$g(x) = \sin (x) \, $$
$$f(x) = 1-x^2$$
We indeed have our integration in the form of $\int g'(x)f(g(x)) \, dx$.