I often see people just say time average of cos^2(nwt) is 1/2, I want to know in what cases this is not valid? w is just the frequency, can be assumed as a constant.
Assuming you are always integrating over whole number of period, then it's always to give 1/2?
What if i only integrate up to 1/2? a quarter ? 1/3? or period, will the answer be different..
Also does the n in the expression i gave affect the outcome ?
When averaging a periodic function, you must always take a complete period, no more, no less. Otherwise, it will give a biased estimate of the average. The n does not affect the outcome because $\displaystyle \sin(2n\omega t)$ is always 0 when $t=T$, where T is the period of oscillation.
The $\displaystyle \sin(2n\omega t)$ arises because of this:
Average $\displaystyle = \frac{1}{T}\int_0^T \cos^2{(n\omega t)}dt\\\displaystyle =\frac{1}{2T}\int_0^T(\cos{(2n\omega t)} + 1)dt\\\displaystyle = \frac{1}{2T}.(\frac{1}{2}\sin{(2n\omega T)} + T)\\\displaystyle = \frac{1}{2}$