How does fundamental theorem of calculus and chain rule work? I came across a problem of fundamental theorem of calculus while studying Integral calculus.

A problem:
$\frac{d}{dx}\int_{\pi}^{x^2}\cot^2t\ dt$
which was salved as :
Step I : Let, F(x) = $\int_{\pi}^{x^{ }}\cot^2t\ dt$
⇒ $F'(x)= \frac{d}{dx}\int_{\pi}^{x^{ }}\cot^2t\ dt=cot^2(x)$
Step II : $\frac{d}{dx}\int_{\pi}^{x^2}\cot^2t\ dt$ = $\frac{d}{dx}[F(x^2)]$ = $F'(x^2)*\frac{d}{dx}(x^2)$
Step III : $F'(x^2)*\frac{d}{dx}(x^2) = cot^2(x^2)*2x$

I don't understand how can they salve 
$F'(x^2)$ in third step by putting $x^2$ directly into $F'(x)=cot^2x$
Reference : problem video
 A: I think you're confusing $F'(x^2)$ and $(F(x^2))'$. The first is the function $F'$ $\bf{evaluated}$ at $x^2$ and the second is the derivative of the function $x \mapsto F(x^2).$ These are two different things ! 
If you take the function $x \mapsto F(x) = 2x + 1$. Then $F'(x) = 2$ so $F'(x^2) = 2$ but $$(F(x^2))' = (x^2)' \cdot F'(x^2) = 2x \cdot 2 = 4x.$$
Similarly for any differentiable function $h$, $h'(2)$ is not necessarily equal to $0$ since $$h'(2) \neq (h(2))' = 0.$$
A: The problem is totally nonsensical since $$F(u):=\int_\pi^u \cot^2 t\>dt$$
is undefined for any $u\ne\pi$. Apart from this the treatment suffers from using the letter $x$ in "different worlds". In order to make this clear I'm dealing with the function
$$G(u):=\int_{\pi/2}^u \cot^2 t\>dt$$
instead (I have replaced $\pi$ by ${\pi\over2}$). This function $u\mapsto G(u)$ is then defined for $\left|u-{\pi\over2}\right|<{\pi\over2}$. One has $$G'(u)=\cot^2 u\ ,\tag{1}$$
by the FTC. You would then be interested in the function
$$f(x):=\int_{\pi/2}^{x^2}=G(x^2)$$
and want to know $f'(x)$. By the chain rule and $(1)$ one has
$$f'(x)=G'(x^2)\cdot{d\over dx}x^2=\cot^2(x^2)\cdot(2x)\ ,$$
as stated at your source.
