Is $\frac {x^2 + 5x}{x} = x+5$? We are graphing functions in class and the function $f(x) = \frac {x^2 + 5x}{x}$, came up and our teacher simplified it to $x+5$ and graphed that with a hole in the function at $x=0$.
I started wondering, how in algebra can we say that $\frac {x^2 + 5x}{x} = x+5$, when the graphs of each function are not equal?
Thanks

The key here is that the domain of the function $f$ is not all real numbers.  It's $\Bbb R \setminus \{0\}$ (meaning all real numbers except $0$).  So once you know that it should be clear that $\frac{x^2+5x}{x}$ is exactly equal to $x+5$ on that domain.
If we wanted to specify that, we'd write $f: \Bbb R \setminus \{0\} \to \Bbb R$ is given by $f(x)=x+5$.  Then we'd immediately see that the domain of $f$ is $\Bbb R \setminus \{0\}$ and the codomain$^\dagger$ is $\Bbb R$.  But often mathematicians and teachers are a little lazy and will just expect you to realize that sometimes when they write $A=B$, they mean $A=B$ on the largest domain where both $A$ and $B$ are defined.
$^\dagger$: If you've never heard of a codomain, don't worry about it exactly.  It's related to the range of the function, but it's not super important to know to understand basic algebra.
