I have the following equality 

$\int\_{0}^{\pi}cos(nt)cos(mt)dt=0$ (if $m\neq n$)

This is in the context of Chebyshev polynomials and the book states the following to deduce ortoghonality.

"the orthogonality property is drawn by using the substitution t = arcos(x) in the interval [-1,1] relative to the weight function $(1-x^2)^{-\frac{1}{2}}$, which is verified by the system of polynomials {Tn(x)}:"

$\int\_{-1}^{1}Tn(x)Tm(x)dt=0$, (if m $\neq$ n)

Can anybody explain (or point me to an example) how to do the above variable change in the initial integral and where does the weight function come from?