Suppose you want to prove that $$ f(x)\delta(x-x_0) = f(x_0)\delta(x-x_0) $$
In my homework, I was instructed to show that the integral of both sides of the equations will lead to the fact that the above statement is true.
My answer - why? Since when two functions with the same integral are necessarily equal? This almost never happens. What is different with the Dirac distribution?
The expression "$ f(x)\delta(x-x_0) = f(x_0)\delta(x-x_0) $" is a shorthand.
It doesn't mean (in any ordinary sense) that
To start, neither $g$ and $h$ are functions $\mathbb R \to \mathbb R$, because the delta function is not such a function either.
Instead, we can think of the delta function as a map from the space of functions over the reals--say the Lebesgue integrable functions-- to the reals, i.e., a function $L^1(\mathbb R) \to \mathbb R$. Write $\Delta_{x_0}$ for that function and define it as
$$\Delta_{x_0}(f) = f(x_0) \quad - (1)$$
Equivalently $\Delta_{x_0}(f(x)) = f(x_0)$. That is usually written as
$$\int_{-\infty}^{\infty} f(x) \delta(x - x_0) \ dx = f(x_0) \quad - (2)$$
This notation arises naturally from the idea that $\delta$ function is a limit of a sequence of probability density functions that in their limit put "infinite" weight on $x_0$ and zero elsewhere.
The integral notation can be finessed further by limiting integration to an interval $I \subset \mathbb R$, as mentioned in other answers. In which case
$$\int_I f(x)\delta(x - x_0) \ dx = \begin{cases} f(x_0), & x_0 \in I \\ 0, & x_0 \not\in I \end{cases}$$
Thus "$ f(x)\delta(x-x_0) = f(x_0)\delta(x-x_0) $" can be construed to mean
$$\Delta_{x_0}(f(x)) = \Delta_{x_0}(f(x_0)) \quad - (3)$$ where $f(x_0)$ is a constant function of value $f(x_0)$ everywhere.
Or to construe the expression in integral notation
$$\int_{-\infty}^{\infty} f(x)\delta(x-x_0) \ dx = \int_{-\infty}^{\infty} f(x_0)\delta(x-x_0) \ dx \quad - (4)$$
To demonstrate statement (3) using the definition (1), we have $$\Delta_{x_0}(f(x)) = f(x_0) \\ \text{ and } \quad \Delta_{x_0}(f(x_0)) = f(x_0) \ \text{, as } \Delta_{x_0}(c) = c \text{ for any constant function } c$$
That is $\Delta_{x_0}(f(x)) = \Delta_{x_0}(f(x_0))$.
For the record, almost no one uses the $\Delta$ notation or its equivalent in practice. The integral notation of equation (2) is the standard. In those terms
$$\int_{-\infty}^{\infty} f(x) \delta(x - x_0) \ dx = f(x_0) \quad\text{ and } \int_{-\infty}^{\infty} f(x_0) \delta(x - x_0) \ dx = f(x_0)$$
For any interval $I \subset \mathbb R$ which contains $x_0$,
$$\int_I f(x) \delta(x - x_0) \ dx = f(x_0) = \int_I f(x_0) \delta(x - x_0) \ dx$$
and if $x_0 \not\in I$, then
$$\int_I f(x) \delta(x - x_0) \ dx = 0 = \int_I f(x_0) \delta(x - x_0) \ dx$$