How can I convince my math teacher?
Solution 1:
$$\begin{align}\frac00&=\frac{2\times0}{1\times0}=\frac21=2\\\\\\=\frac00&=\frac{3\times0}{1\times0}=\frac31=3\\\\\\\implies2&=3\end{align}$$ NOPE.
Solution 2:
Here's an old chestnut, customized for your example
$$\begin{align}
x&=-2\\
x^2&=(-2)^2=4\\
x^2+2x&=4+2x\\
(x+2)x&=2(x+2)\\
\frac{(x+2)x}{x+2}&=2\\
x&=2 &\longleftarrow\text{ OOPS!}
\end{align}$$
but we assumed $x=-2$ in the first line, so -2 = 2.
The problem here is going from the line just before to the line labeled OOPS. As you said, you can't conclude $$ \frac{(x+2)x}{x+2}=x $$ when the denominator is zero (i.e., when $x=-2$), though to be fair to your teacher the statement above is indeed true if you include the clause whenever both sides of the equality are defined, which is perhaps what she was thinking.