Is this proof about limit involving e correct? I know that this is a pretty basic limit, I found this limit in this forum but not the way I did, so I need to know if this is right:
We know that 
$$\lim_{x \to \infty}\left(1 + \frac{1}{x} \right)^x = e$$
ans I was wondering how to calculate 
$$\lim_{x \to \infty}\left(1 + \frac{a}{x} \right)^x$$
The way I tough was like this:
$$\lim_{x \to \infty}\left(1 + \frac{a}{x} \right)^x = \lim_{ax \to \infty}\left(1 + \frac{a}{ax} \right)^{ax} = \left[\lim_{ax \to \infty}\left(1 + \frac{1}{x} \right)^x\right]^a = e^a$$
Can I make this $ax$ substitution in the limit? I was wondering about this, and for me is ok, because I'm considering the entire $ax$ thing going to infinity. 
 A: Yes, assuming you're in Calc I that's a good proof.
As to your question, "when can we make those substitutions," the following is true: 

Theorem. If $\lim_{x\to a}g(x)=b$ and $\lim_{x\to b}f(x)=L$ and $g$ is not equal to $b$ for some interval around $x=a$, then $$\lim_{x\to a}f\big(g(x)\big)=L$$ 

So as long as the substitution is not locally constant (or abnormally degenerate), you can make the substitution. In this case you let $g(x)=ax$ which is, for $a\ne 0$, bijective. Therefore your proof is valid for all $a$ except $a=0$ (and note, you divided by $a$ in your proof so that was a warning sign). The case of $a=0$ is however fairly trivial to prove, and I doubt your teacher will be that picky - but impress them anyway!
EDIT: And as noted by @Voldemort in the comments, you made a limit mistake for the case of $a<0$ because then $ax\to -\infty$ as $x\to\infty$. But otherwise the above stands.
Also note that I did not handle the case of limits at infinity, for which there would need  to exist some $N$ such that for all $x>N$ we would have $g(x)\ne b$.
