# How to calculate limits of functions?

I am currently trying to calculate the following limit (we are the whole time working in $$\mathbb{R}$$):

$$\lim_{x\rightarrow 4}\frac{\sqrt{1+2x}-3}{\sqrt{x}-2}$$

My lecturer is uploading handwritten notes with some examples where she just writes down limits without any explanations. It looks like in some cases we can just substitute the (in this case) $$4$$ for the $$x$$ and get the limit and in other cases we can't. I did rewrite the function to $$\frac{2(\sqrt{x}+2)}{\sqrt{1+2x}+3}$$ substituted the $$4$$ and got $$\frac{4}{3}$$ as limit.

But sadly in her examples are few to no explanations and from my perspective I don't really understand the substituting. How can I comprehensible explain why I am currently substituting with the $$4$$? It just doesn't feel right for me to just say "I just substitute with the $$4$$ and if I am lucky I get the correct limit. If I get something undefined I just rewrite the function such that it works." When am I allowed to substitute and why am I allowed to substitute?

From my understanding we can always substitute the $$4$$ for the $$x$$ when we know that the limit exists. And the limit exists if the right-hand limit is equal to the left-hand limit. That means I first have to calculate the left-hand limit and right-hand limit.

But how do I calculate the right-hand limit and left-hand limit? In the examples I was given we just sometimes substitute again and sometimes not, so I am at the same problem.

For example we have one example where we just substitute (this is the full example there is nothing more written to it):

Let $$f:\mathbb{R}\rightarrow\mathbb{R}, x\mapsto x^2-3x+2$$. Let $$(x_{n})$$ with $$x_n\nearrow 2\Rightarrow\lim_{n\rightarrow\infty}f(x_n)=\lim_{n\rightarrow\infty}f(2)=0$$. The same for $$x_n\searrow 2$$. Together $$\lim_{x\rightarrow 2}f(x)=0$$.

Okay it looks like we are calculating the right-hand limit and left-hand limit and because they are equal we can calculate the limit as $$x$$ is approaching $$2$$. But for the left-hand limit and right-hand limit I am just substituting $$2$$ again and I don't get why. It seems so not rigorous to me.

Here is a second example:

Let $$f:\mathbb{R}\rightarrow\mathbb{R}, x\mapsto\lfloor x\rfloor$$. For $$\hat{x}=1, \lim_{x\nearrow 1}f(x)=0$$ and $$\lim_{x\searrow 1}f(x)=1$$. $$1\neq 0\Rightarrow \text{no limit}$$.

I understand in this example why the left-hand limit is $$0$$, because we are approaching $$1$$ from below we are always near $$1$$ but still always below $$1$$. So we have to round down to $$0$$. And the other way around we are always bigger then $$1$$ but also near $$1$$ so we have to round down to $$1$$.

Here it is still easy to see that I can't just substitute with $$1$$. But I couldn't explain why. I would just see that we have like these different values. But what if we have a more difficult function whichs limit doesn't exist? For example $$\lim_{x\rightarrow\infty}\sqrt{\sin{x}^2-1}$$? And even if this limit would exist I can't just substitute infinity so how to handle that?

In general I think that my lecturer just wants me to rewrite the function and then substitute the $$4$$ without thinking much and I would get full marks for the result $$\frac{4}{3}$$. But this looks not rigorous from my perspective. When am I allowed to just substitute and why am I allowed to substitute? How to handle cases where I have the values going against infinity?

I think that I read that it has somewhat to do with continous functions, but we didn't talk about them in the lecture. And the function which I should analyse is not continous I think and the one in the first example is continous.

I tried to write a rigorous (shortend) solution for the following: Let $$f:\mathbb{R}\rightarrow\mathbb{R}, f(x)=\frac{\sqrt{1+2x}-3}{\sqrt{x}-2}$$. I want to calculate $$\lim_{x\rightarrow 4}\frac{\sqrt{1+2x}-3}{\sqrt{x}-2}$$. I then show that $$f$$ is not continous for $$x=4$$, hence I can not substitute with $$x=4$$. I then consider the function $$g:\mathbb{R}\rightarrow\mathbb{R}, g(x)=\frac{2(\sqrt{x}+2)}{\sqrt{1+2x}+3}$$ whichs only difference is that it is continous for $$x=4$$. So now I thought that I can just substitute with $$x=4$$ and get $$\frac{4}{3}$$. But the function is still not continous for all $$x$$. If $$x$$ gets negative it's discontinous. But my question now is, is it important that the function is continous for all $$x$$ or only continous for $$x=4$$. And as soon as it is continous for $$x=4$$ I can substitute with $$x=4$$. Because $$x$$ approaches $$4$$ I dont have to care about negative values, because 4 is positive?

• In this example, just substituting $x=4$ then requires you to divide $\sqrt 9 -3=0$ by $\sqrt 4 -2 =0$, so that does not work. It would have worked if you had had a function which was well defined at $x=4$ and continuous around $x=4$. Commented Jun 17 at 13:09
• @Henry But after I rewrote the function to $\frac{2(\sqrt{x}+2)}{\sqrt{1+2x}+3}$ I can substitute the $4$ and get the correct limit $\frac{4}{3}$. This is what also confuses me, because I thought that I read that I can always substite when the function is continous. But then I thought that this is wrong because in this case I can substitute after rewriting the function. To that comes the fact that we didnt talk about continous functions. So I thought that it has something to do with the stuff I already learned. Commented Jun 17 at 13:14
• You have not explained how you got $\frac{2(\sqrt{x}+2)}{\sqrt{1+2x}+3}$ but it is likely you cancelled a term in the numerator and denominator which is $0$ when $x=4$, perhaps by multiplying numerator and denominator by $\frac{(\sqrt{1+2x}+3)(\sqrt{x}+2)}{(\sqrt{x}-2)}$. In effect you used a technique for handling a removable discontinuity before substituting. Commented Jun 17 at 13:45
• "Is it true that every discontinous function then doesnt have a limit?" This is true indeed, in some sense. Note that both "continuous" and "limit" are defined point-wise: You have a limit to some point, and a function is continuous at some point. E.g. $\lim_{x\to\frac12}\lfloor x\rfloor$ exists and is $0$, bc $\lfloor x\rfloor$ is continuous at $\frac12$. A possible definition for continuity is "$f$ is continuous at $a$ when $\lim_{x\nearrow a}f(x)=\lim_{x\searrow a}f(x)=f(a)$". So when a function is not continuous at $a$, then one of these equalities does not hold. Commented Jun 17 at 14:08
• You multiplied it by something which is $1$ when $x\not=4$. But at some stage you used something like $\frac00$ when $x=4$. Commented Jun 17 at 14:16

This is one of those things that's easily ignored (by teacher and student!) when learning/teaching algebraic simplification of fractions, which is that you get two expressions that are equal where they are both defined (which may not always be the same). So in this case your two fractions $$f(x) = \frac{\sqrt{1+2x}-3}{\sqrt{x}-2}, \qquad g(x) = \frac{2(\sqrt{x}+2)}{\sqrt{1+2x}+3}$$ match almost everywhere, but they don't actually match at $$x=4$$: $$f(4)$$ does not exist, while $$g(4) = 4/3$$ (since you canceled out a factor of $$x-4$$ that caused both top and bottom to be zero).
As to continuity: continuity is generally defined as "a function is continuous at a point $$x_0$$ if the limit as $$x\to x_0$$ exists and it equals the value of the function", so yes if you know a function is continuous then you can substitute in and get the limit. The catch then comes from knowing whether a function is continuous; that's one of those things that technically has to be shown for all the usual operations you can do with your calculator (it sounds like your class hasn't done that part yet), but sticking with the intuitive idea of "the graph can be drawn without lifting your pencil" will maybe at least give you an idea of when it will work. So that should allow you to understand (at least visually/intuitively) why polynomials are continuous, and rationals (where they're defined!), and $$e^x$$ and $$\ln(x)$$, and sine/cosine, and all those sorts of graphs; but something like $$\lfloor x\rfloor$$ isn't (because that graph can't be drawn smoothly). (Or to be more precise: $$\lfloor x\rfloor$$ isn't continuous at the points where it jumps.)
For instance if you look at a graph for $$g(x)$$ you can see that it is continuous around $$x=4$$ (we're well away from where the square roots stop existing, or a zero in the denominator, or any other thing that could cause weirdness in the graph), so that is the fact that allows you to deal with the limit in this "easy" way: we know that the graphs for $$f(x)$$ and $$g(x)$$ must agree everywhere except at the single point $$x=4$$, and $$g(x)$$ is a nice smooth graph in that area, so $$f(x)$$ must also have a nice smooth graph in that area, except with a hole in it at that point. But the limit doesn't care about the hole, so the limit must agree with the value at $$g(x)$$.
• I still have one problem with understanding. So $f(x)$ is not continous for $x=4$. And $g(x)$ is continous for $x=4$ and because then the values of the functions just are different for $x=4$ the limit of $f(x)$ for $x\rightarrow 4$ is the same as the limit of $g(x)$ for $x\rightarrow 4$. But isn't g(x) still not continous for negative $x$? So if the function really goes from $\mathbb{R}\rightarrow\mathbb{R}$ I still couldn't just substitute $4$? Should I just assume that the function instead only takes positive values as input? Commented Jun 17 at 16:32
• @David Krell: The Update in this MSE answer may be of interest. Also, regarding the question in your most recent comment, for the purposes of taking a limit as $x \rightarrow a,$ it is sufficient that $f(x)$ and $g(x)$ have the same value throughout -- with the possible exception of $x=a$ -- some (possibly very very tiny) open interval containing $a.$ This is something one would prove in a more rigorous (in the proof-formalism sense, as contrasted with the difficulty sense) treatment of limits, such as in a first course in real analysis. Commented Jun 17 at 17:16
• Neither $f(x)$ nor $g(x)$ is defined for $x<0$, so in some sense these functions can't go from $\mathbb R \to \mathbb R$ -- people often say "we're working in the reals" to mean "we're not considering complex results", so you shouldn't just take that to mean that domain and range are both $\mathbb R$. It's not so much that you're "assum[ing] that the function ... only takes positive values as input" as the function only has valid outputs for those inputs, so the domain of the function is in fact just $[0,\infty)$. Commented Jun 17 at 18:39