When solving a formula with $lim$ approaching to infinity, you sometimes rewrite it by changing a variable in it, e.g.:
$$ \lim_{x \to \infty} (1 + \frac{1}{x})^x $$
rewrites to:
$$ \lim_{z \to 0} (1 + z)^{\frac{1}{z}} $$
by changing $x$ to $\frac{1}{z}$, or:
$$ \frac{1}{ \lim_{n\to\infty}\left(1 + \frac{1}{n - 1}\right)^{n-1} \cdot \left(1 + \frac{1}{n - 1}\right) } $$
rewrites to:
$$ \frac{1}{ \lim_{n\to\infty}\left(1 + \frac{1}{n}\right)^{n} \cdot \left(1 + \frac{1}{n}\right) } $$
Intuitively, I understand such rewritings hold, but can you describe more generally when rewritings like these are possible and what kinds of changing variable are possible? I would like to know exact rule behind this.