# Definition of Limit of the Function

## Related Calculator: Limit Calculator

We already talked about limit of the sequence and since sequence is particular case of function then there will be similarity between sequence and function. And also we will extend some concepts.

**Example 1**. Let's investigate behavior of `y=x^2` near point `x=2`.

To do this let's take points sufficiently close to 2 and evaluate corresponding y-values.

`x` | 1.9 | 1.99 | 1.999 |
2.0001 |
2.001 | 2.01 |

`y=x^2` | 3.61 | 3.9601 | 3.996001 |
4.00040001 |
4.004001 | 4.0401 |

We see that as `x` approaches 2, `f(x)` approaches 4, no matter we take points greater than 2 or less than 2. We write this fact as `lim_(x->2)x^2=4`.

**Definition**. We write that `lim_(x->a)f(x)=L` and say "the limit of f(x), as x approaches a, equals L" if for any `epsilon>0` there exists `delta>0` such that `|f(x)-L|<epsilon` when `|x-a|<delta`.

In simple words this means that `lim_(x->a)f(x)=L` if we can make `f(x)` as close to `L` as we like by taking `x` sufficiently close to `a`.

We will also use following notation: `f(x)->L` as `x->a`.

From the definition it follows that we only care behavior of function at points near `a`, not at `a` itself. This means that `f(x)` can even not be defined in `a`, but still have `lim_(x->a)f(x)`.

For example, consider function `f(x)=x^2` and `g(x)={(x^2 if x!=2),(text(undefined) if x=2 ):}`.

Note that `lim_(x->2)f(x)=lim_(x->2)g(x)=4` even despite the fact that `g(x)` is not defined at 2. That's because we don't care about function at 2, we only interested in bevavior near 2.

Note that `|x-a|<delta` is equivalent to double inequality `-delta<x-a<delta` or `a-delta<x<a+delta`.

Let's do a couple of examples in trying to guess the limit. Note that this approach is not correct but it allows to better understand limits.

**Example 2**. Calculate `lim_(x->1)(x+1)`.

Lets see what value does `(x+1)` approach as `x` approaches 1.

x | 0.9 | 0.99 | 0.999 |
1.0001 |
1.001 | 1.01 |

`y=x+1` | 1.9 | 1.99 | 1.999 |
2.0001 |
2.001 | 2.01 |

So, as `x` approaches 1, `f(x)` approaches 2, thus `lim_(x->1)(x+1)=2`.

**Example 3**. Calculate `lim_(x->1)(x-1)/(x^2-1)`.

Lets see what value does `(x-1)/(x^2-1)` approach when `x` approaches 1.

x | 0.9 | 0.99 | 0.999 |
1.0001 |
1.001 | 1.01 |

`y=(x-1)/(x^2-1)` | `(0.9-1)/(0.9^2-1)=0.5263` | `(0.99-1)/(0.99^2-1)=0.5025` | 0.5003 |
0.499975 |
0.49975 | 0.4975 |

So, as x approaches 1, `f(x)` approaches 0.5, thus `lim_(x->1)(x-1)/(x^2-1)=1/2`.

**Example 4**. Calculate `lim_(x->0)cos(pi/x)`.

Lets see where `cos(pi/x)` goes when `x` approaches 0.

`x` | `f(x)` |

1 | `cos(pi/1)=-1` |

0.1 | `sin(pi/0.1)=-1` |

0.001 | `sin(pi/0.001)=-1` |

0.0001 | `sin(pi/0.0001)=-1` |

It seems that `lim_(x->0) cos(pi/x)=-1`, but this is WRONG answer! The reason is that we took only values at which `cos(pi/x)=-1`.

Note that `cos(pi/x)=-1` when `x=1/n` for any integer `n`.

But also `cos(pi/x)=0` for infinitely many values of `x` that approach 0. In fact as `x` approaches 0, cosine take any value from interval `[-1,1]`. In other words `cos(pi/x)` oscillates infinitely many times as `x` approaches 0.

Since `cos(pi/x)` doesn't approach any fixed value then `lim_(x->0)cos(pi/x)` doesn't exist.

This example shows that we can guess wrong value if we take inappropriate values of `x`. It is also difficult to understand when to stop calculating values. However, we will give correct methods for calculating limits.

**Example 5**. Calculate `lim_(x->0)1/x^2`.

As x approaches 0, `x^2` also approaches 0 so `1/x^2` becomes very large (for example when `x=0.001` we have that `1/x^2=1000000`). Thus, value of `f(x)` approach infinity without a bound, so `lim_(x->0)1/x^2=oo`.