How consistent can solving an equation be if one way of solving it might give an undefined answer? If solving for an equation one way gives me an undefined answer, does that mean solving it in other ways too will give me an undefined answer? If no, then how consistent is math? (I'm not sure if I'm using the term "consistent" correctly, since I'm aware that it's also used in Gödel's incompleteness theorems which I have very little knowledge about) I also apologize if the way I word my question is confusing.
For example, solving for $a$ in $ab=0$ by the "traditional" way (the way it's taught in elementary and high school) will be like:
$$ab=0$$
$$a=\frac 0 b$$
Assuming $b \neq 0$,
$$a=\frac{0}{b}=0$$
Hence, $a=0$.
But if $a=b$, then the only number $b$ can be is $0$ or else by the zero product definition, the product of $a$ and $b$ can't be $0$. But this brings a problem because it'll show $b=0$ which contradicts what I assumed and will show that $a=\frac 0 b=\frac 0 0=0$. And $\frac 0 0$  is undefined. But if I try solving for it by taking the square roots of both sides:
$$ab=0$$
$$aa=0$$
$$a^2=0$$
$$\sqrt{a^2}=|a|=\sqrt 0$$
$$a=±0=0$$
It gives me an answer (that's not undefined). This confuses me, because I always thought that solving an equation in one way will give me the same and consistent answer as solving the equation in any other way. Maybe I'm getting some concepts wrong from the start which needs to be corrected.
So if solving for an equation gives me an undefined answer, then does that mean I'll need to try to solve for it in another way to see if I can get a defined answer? If so, then how "far" or how many ways should I try until I get the correct answer?
 A: You're either forgetting that $b≠0$ is merely an assumption, or forgetting to consider the meaning of that word. When you also know that $a=b,$ then that assumption simply isn't viable. After all, an assumption is tentative and falsifiable, and just a premise.
While it is valid to introduce an assumption then derive conclusions from it, these conclusions are provisional and are firmed only when that assumption gets justified (then it is no longer merely an assumption). If it gets falsified, then we can conclude that its negation is true. If we can neither justify nor falsify that assumption, then we simply cannot derive any conclusion from our working, because our argument may be valid but unsound.

@ryang Do you mean that the assumption $b≠0$ could be false at the end? If the assumption turns out to be false, then does that count as a contradiction?

Indeed. The contradiction comes from the supposition $\color{red}{b≠0}$ clashing with the subsequent derivation $b=0;$ since the supposition is the only possible culprit, it must be actually false; in other words, it must be that $\color{green}{b=0}.$

@ryang but wouldn't that give $a=\dfrac0b=\dfrac00\;?$ I thought division by zero is undefined and that any division or fraction properties won't work if that happens, and hence, I can't have $\dfrac0b=0.$

Since we've determined that $\color{green}{b\text{ is indeed zero}},$ then naturally $ab=0\kern.6em\not\kern-.6em\implies a=\frac0b.$
