Why is it ok to factor an equation with no limit so it has a limit? I'm just starting out in calculus, so please bear with me if this is not a sensible question.

In the book I'm reading, the author gives the example of the problem of finding the limit of $\lim\limits_{x\to 5}(\frac{x^2 - 25}{x-5})$, because if you substitute in $x=5$, you get a denominator of $0$, so the output of the function at $x=5$ is undefined.

He then goes on to demonstrate how by factoring this equation to $\lim\limits_{x\to 5}(x+5)$, you can now plug in $x=5$ to get $\lim\limits_{x\to 5}(x+5) = 10$.

But is not the fact that 'at $x=5$ the function is undefined' an integral part of the original function? By factoring it, have you not added to the domain of the original function and therefore created a different function? So now you have the limit of a different function?
Consider $\displaystyle f(x)=\frac{x^2-25}{x-5}$ and $g(x)=x+5$.

If $x\neq 5$ then $f(x)=g(x)$, so for all $x$, except for $x=5$, the graphs of $f(x)$ and $g(x)$ are identical.

At $x=5$, $f(x)$ is undefined but $g(5)=10$.

Therefore the graph of $f(x)$ is the same as $g(x)$ except that it has a hole at $x=5$.

If you draw this picture it is clear why the limits are the same.

+1 for asking the question --- it is one that students often don't ask about unless the instructor actually shows that functions that are equal at all points - except perhaps at a single point - have equal limits.
First, I will show you the solution to your problem:

$$\lim_{x\to5}\frac{x^2-25}{x-5}=$$
$$\lim_{x\to5}\frac{(x-5)(x+5)}{x-5}=$$
$$\lim_{x\to5}x+5=5+5=\boxed{10}.$$

To answer you question in short, you are simplifying the continuous function. So essentially, $\frac{x^2-25}{x-5}$ is equivalent to $x+5$ by means of factoring to make the function unchanged. Just simplified.



We can also prove this limit bye performing a delta-epsilon proof:

Proof. Let $\epsilon&gt;0$. Choose $\delta=\epsilon$. If $0&lt;|x-5|&lt;\delta$, then 
$$\left|\frac{x^2-25}{x-5}-10\right|=\left|\frac{(x+5)(x-5)}{(x-5)}-10\right|=|x+5-10|=|x-5|&lt;\delta=\epsilon.$$

Thus, we have $\left|\frac{x^2-25}{x-5}-10\right|&lt;\epsilon. \ \ \ \ \ \ \ \blacksquare$