integration by substitution, if substituted by a function. All the other proofs I have saw rely on $\int f(\phi(x))\phi'(x) \,\mathrm{dx} = \int f(u)\,\mathrm{du}$, hence $\int f(x)\,\mathrm{dx} = \int f(\phi(u))\frac{\mathrm{d}}{\mathrm{du}}\phi\,\mathrm{du}$
To me this means I can sub: $\mathrm{dx} = \frac{\mathrm{d}}{\mathrm{du}}\phi(u)\,\mathrm{du}$.
However this doesn't seem to be true in my case: if I want to substitute $\cos(u)= \frac{x}{a}$, then dx becomes: $\mathrm{dx}=-a\,\sin(u)\,\mathrm{du}$. I can't explain this with the formula above.
 A: The first kind of substitution most students learn is the one you describe first:  in an integral of the form $\int f(\phi(x)) \phi'(x)\,dx$, you can replace $\phi(x)$ with $u$ and $\phi'(x)\,dx$ with $du$ to get $\int f(u)\,du$.  If the answer to this last integral is $F(u) + C$, then the answer to the original is $F(\phi(x)) + C$.  To express this, people write $u = \phi(x)$ and $du = \phi'(x)\,dx$, and then
$$
\int f(\phi(x)) \phi'(x)\,dx = \int f(u)\,du = F(u) + C = F(\phi(x)) + C.
$$
It is justified by the chain rule:  if $d/du(F(u)) = f(u)$, then by the chain rule $d/dx(F(\phi(x))) = f(\phi(x)) \phi'(x)$.
But there is a second version of substitution that is essentially a backwards version of this: in an integral $\int f(x)\,dx$, you can replace $x$ with $\phi(u)$ and $dx$ with $\phi'(u)\,du$, to turn the integral into $\int f(\phi(u)) \phi'(u)\,du$.  If the answer to this integral is $F(u) + C$ and $\phi$ is invertible, then the answer to the original integral is $F(\phi^{-1}(x)) + C$.  To express this, you would write $x = \phi(u)$, $dx = \phi'(u)\,du$, $u = \phi^{-1}(x)$, and then
$$
\int f(x)\,dx = \int f(\phi(u)) \phi'(u)\,du = F(u) + c = F(\phi^{-1}(x)) + C.
$$
For a more complete explanation of why this is justified, see my book Calculus: A Rigorous First Course, Section 8.4: Substitution with Inverse Functions.
I think you are probably doing the second version of substitution, although it's a little hard to tell, since you haven't said what integral you are solving.
