In chemistry, we came across an equation as follows:
$$\frac{Z_1^2}{n_1^2}-\frac{Z_1^2}{n_2^2}=\frac{Z_2^2}{n_3^2}-\frac{Z_2^2}{n_4^2}$$
We were supposed to assume that this implied that
$$\frac{Z_1}{Z_2}=\frac{n_1}{n_3}=\frac{n_2}{n_4}$$
Is there any mathematical reason why this holds true, or is it just a result that usually (but not always) holds true. All the $6$ variables mentioned are small positive integers (small would mean less than $100$ for sure).