I'm reading Larson's AP Calculus textbook and in the section on limits (1.3) it suggests finding functions that "agree at all but one point" in order to evaluate limits analytically. For example, given $$ f(x) = \frac{x^3-1}{x-1} $$ we can factor and reduce to get $$ \frac{x^3-1}{x-1} = \frac{(x-1)(x^2+x+1)}{x-1} = \frac{\require{cancel} \bcancel{(x-1)}(x^2+x+1)}{\require{cancel} \bcancel{(x-1)}}=x^2+x+1 $$ But it then refers to this reduced expression as $$ g(x) = x^2+x+1 $$ suggesting that $f(x) \neq g(x)$ (also implied by the figure below).
Is it true that $f(x) \neq g(x)$? I realize that $f(x)$ as originally expressed is indeterminate at $x=1$, but doesn't the cancellation of $(x-1)$ allow us to calculate the "true" value of $f(1)$? If so, I believe the graph of $f(x)$ in the figure is misleading at best by drawing the plot as being undefined at $x=1$.

The first function is not defined when $x = 1$, whereas the second is. The cancelling is only possible assuming that $x \neq 1$; when $x = 1$ the denominator is zero and hence the expression is undefined.
Since the domains are different, the functions are different. However, the functions are obviously equal when restricted to the domain that excludes $x = 1$.