$f(x) = \frac{x^2 - 1}{x-1} $ is different from $f(x) = x + 1$, in spite of the fact that rules of algebra is followed, why? Suppose there be a function, $$ f(x) = \frac {x^2-1}{x-1} $$
For $x=1$, the function becomes un defined. But, in Algebra we know it is allowed to Cancel Denominator and numerator by the common factor and this would result in the same expression which is equivalent to the first one. But,
$$\require{cancel} f(x) = \frac{(x+1)\cancel{(x-1)}}{\cancel{(x-1)}} =y$$
$$\Rightarrow y = x + 1 $$
But, here when I see that Graph of both the equation they look same however the first one is undefined for x = 1 which is not with the case of the second one. But, just canceling a common term in numerator and denominator or multiplying them, changes the whole function why?
So, rules of algebra don't work? or there is a problem with my understanding?
 A: The functions are different because they have different domains.
A function is defined by its domain, codomain, and graph or, alternatively, by its domain, codomain, and a rule that specifies how elements of the domain are mapped to elements in the codomain.
The implied domain of the function defined by 
$$f(x) = \frac{x^2 - 1}{x - 1}$$
is the largest set of real numbers that do not make the denominator equal to zero, which is 
$$\{x \in \mathbb{R} \mid x \neq 1\} = \mathbb{R} - \{1\}$$
Thus, we should write that $f$ is the function $f: \mathbb{R} - \{1\} \to \mathbb{R}$ defined by 
$$f(x) = \frac{x^2 - 1}{x - 1}$$
Its graph is the line $y = x + 1$ with a hole at the point $(1, 2)$ since 
$$\lim_{x \to 1} f(x) = \lim_{x \to 1} = \frac{x^2 - 1}{x + 1} = \lim_{x \to 1} (x + 1) = 1 + 1 = 2$$
Its graph is the punctured line shown below.

Notice that at every point in the domain of $f$, the denominator does not equal to zero. Thus, we may divide by $x - 1$ to obtain
$$f(x) = \frac{x^2 - 1}{x - 1} = \frac{(x + 1)(x - 1)}{x - 1} = x + 1$$
for each $x \in \text{Dom}_f = \mathbb{R} - \{1\}$.
The function $g: \mathbb{R} \to \mathbb{R}$ defined by $g(x) = x + 1$ is defined for every real number.  Its graph is just the line $y = x + 1$.

While the two functions agree on the intersection of their domains, they have different domains.  Therefore, they are different functions.
A: We can prove that both of these functions have the same graph for domain $D=\mathbb{R}-\{1\}$:
let $a \in D$ be any number from domain. Then we have:
$f(a) = a + 1 = a + 1 \cdot \frac{a-1}{a-1} = \frac{a^{2}-1}{a-1} = f(a)$
So the graph is the same for $D=\mathbb{R}-\{1\}$: but in general these two functions are different because of Domain.
A: The problem is, that $f(x)=\frac{x^2-1}{x-1}$ is not a function, for the simple reason, that a function has to be defined with a domain and image like:
$f:\mathbb{R}\setminus\{1\}\to\mathbb{R}$.
One might consider $\mathbb{R}\setminus\{1\}$ as the domain of $f$, since for $x=1$ we get $1-1=0$ in the denominator, which leads to an illegal operation (dividing by zero). 
So this is a pole. 
Or is it? 
It is completly fine to define $f:\mathbb{R}\to\mathbb{R}$, since the pole is "liftable".
A fake pole, if you please.
A: The only difference is that $\frac{(x^2-1)}{(x-1)} $ is not defined at x=1, although the limit as x tends to 1 exists and is equal to 2. Rest everything is same.
