Integral equation, certain rule 
I have the following equation:
$$2\int_{0}^{1/n}(1-nx)^{2}dx=\frac{2}{n}\int_{0}^{1}(1-x)^{2}dx.$$

My question is: Is this a rule and where does it come from and if so when are you allowed to use it?
What I have done so far:
I calculated both the integrals by hand and from that I did see they are indeed equal but I am interested in the rule that is being used to see this immediately. I found:
$$2\int_{0}^{1/n}(1-nx)^{2}dx=2\int_{0}^{1/n}(1-2nx+n^{2}x^{2})dx=2\left[ x-nx^{2}+\frac{1}{3}n^{2}x^{3} \right]_{0}^{1/n}= \\ 2\left[\left( \frac{1}{n}-n\frac{1}{n^{2}}+\frac{1}{3}n^{2}\frac{1}{n^{3}}\right)-0\right]=\frac{2}{3n},$$
and
$$\frac{2}{n}\int_{0}^{1}(1-x)^{2}dx=\frac{2}{n}\int_{0}^{1}(1-2x+x^{2})dx=\frac{2}{n}\left[ x-x^{2}+\frac{1}{3}x^{3} \right]_{0}^{1}= \\ \frac{2}{n}\left[\left( 1-1+\frac{1}{3}\right)-0\right]=\frac{2}{3n}.$$
Maybe another example would also be nice to see how this rule works.
 A: It's always good to understand the "why" behind the "rule". It's ultimately the result of the chain rule, which is used when we substitute, e.g., $u = nx \implies du = n\,dx \implies dx = \dfrac{du}{n} = \dfrac 1n du$.
But we can save a lot of work if we use the substitution $u = 1 - nx;\;$ then $du = -n\,dx \implies dx = -\dfrac 1n \,du$. 
So substituting, we get $$2 \int u \dfrac{-du}{n} = -\dfrac {2}{n}\int u^2\,du $$ 
$$= -\dfrac{2}{n} \dfrac{u^3}{3}\Big|_0^1 = \dfrac{-2}{3n}(1 - x)^3\Big|_0^1$$
$$ = -\dfrac{2}{3n}\left[(1-1)^3 - (1 - 0)^3\right] = \dfrac 2{3n}$$
A: Hint
Try to change the variable let $t=nx$ so $dt=ndx$ and and  change the limits of the integral you find the desired result.
A: See integration by substitution. In your example, $nx = u = u(x)$, and $u(0) = 0$, $u(1/n) = 1$, and $\frac{du}{dx} = n$, so $dx = \frac{du}{n}$. Then you get that
$$
\int_0^{1/n}\!\left(1 - nx\right)^2\,dx = \int_{u(0)}^{u(1/n)}\!\left(1 - u\right)^2\frac{1}{n}\,du = \frac{1}{n}\int_{0}^{1}\!\left(1 - u\right)^2\,du.
$$
A: Let $u=nx$ so that $x=\frac{u}{n}$. If $x=\frac{1}{n}$ then $u=1$ and $dx=\frac{du}{n}$. Substitute
$$2\int_{0}^{1/n}(1-nx)^{2}dx=\frac{2}{n}\int_{0}^{1}(1-u)^{2}du. $$
Now you can rename once again the integration variable as $x$
