TITLE: Is this question too easy or am I getting it wrong?
QUESTION [14 upvotes]: In my homework, I am asked to find the limit
$$\lim\limits_{x\to0}{\frac{x}{e^x}}$$
But obviously, you could just substitute $x = 0$:
$$\lim\limits_{x\to0}{\frac{x}{e^x}} = \lim\limits_{x\to0}{\frac{0}{e^0}}=\lim\limits_{x\to0}{\frac{0}{1}}=\lim\limits_{x\to0}{0} = 0$$
This seemed – by far – too easy. Is this really all there is to it? Is my solution valid?
Edit:
Apparently, this is valid. Still, I do wonder if these are the only conditions that allow me to actually substitute my limit variable.

REPLY [17 votes]: One of your questions is “When can I substitute the limit variable”, which I take to mean 

“When is $$\lim_{x\to a} f(x) = f(a)?”$$

A sufficient condition for this to work is that $f$ must be continuous at $a$.  (In fact, this is the definition of what it means for a function to be continuous at $a$!)  This doesn't immediately answer the question, because continuity can be very complicated.  However, the following rules cover a great many situations:

Constant functions $x\mapsto c$ are continuous everywhere  (“$x\mapsto c$” means “the function that takes $x$ and maps it to $c$”.)
The identity function $x\mapsto x$ is continuous everywhere
The addition and multiplication functions $(x,y)\mapsto x+y$ and $(x,y)\mapsto xy$ are continuous everywhere
The division function $(x,y)\mapsto \frac xy$ is continuous  except where the denominator $y$ is $0$
The exponential function $x\mapsto e^x$ is continuous everywhere
Compositions of continuous functions are continuous

Here we have the  function $x\mapsto \frac x{e^x}$.  The function $x\mapsto x$ is continuous by (2).  The function $x\mapsto e^x$ is continuous by (5).  The quotient of these will be continuous by (6) and (5), except when the denominator $e^x$ is $0$—but it never is. So $x\mapsto\frac x{e^x}$ is continuous everywhere.
The upshot of all this is that $$\lim_{x\to a} \frac x{e^x} = \frac a{e^a}$$ for all $a$, and in particular for $a=0$.
To consider the simplest possible counterexample, take $x\mapsto \frac1x$.  This is continuous everywhere except possibly at $x=0$, and indeed we have $\lim_{x\to a}\frac1x = \frac 1a$ for all $a\ne 0$.  For $a=0$ there is no limit.
A more interesting counterexample is $x\mapsto \frac{\sin x}{x}$.  Again, we have $\lim_{x\to a}\frac{\sin x}{x} = \frac{\sin a}{a}$ for all $a\ne 0$.  For $a=0$ we have the interesting and nontrivial fact that $\lim_{x\to 0}\frac{\sin x}{x} = 1$.