An example I instantly came up with is:
If $x\in \mathbb{Z}$ I say that $f(x)=1$
If $x\notin \mathbb{Z}$ I say that $f(x)=\frac{1}{x^2}$
Now, I am pretty sure that this example is correct. However, first I wondered if there is a simpler example. Second, we were taught that if a function $g$ is different than $f$ in a FINITE number of points, then $\int\limits_{a}^{b} f(x) dx=\int\limits_{a}^{b} g(x) dx$ (So the integral CAN'T be improper).
I was trying to say that $\int\limits_{1}^{\infty} f(x) dx=\lim_{M\to\infty} \int\limits_{1}^{M} f(x) $, and that for all $M\in \mathbb{R}$ we have a finite number of points where we change the value of $g(x)=\frac{1}{x^2}$, which equals $\lfloor M \rfloor -1$.
This way, I am not quite sure that I use the theorem properly, but unsure if there is a problem. I only use it that way for proper integrals, I think, but again not sure.
Any input will be appreciated.
Yes. By your definition of $f$, $f$ differs from $g$ at finitely many points on the interval $[1, M]$ whence $$ \int_1^M f(x)\, dx=\int_1^M g(x)\, dx $$ for each $M>1$. Now let $M\to \infty$ to deduce the result.